From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E2E8C6FA83 for ; Mon, 26 Sep 2022 10:35:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235885AbiIZKfW (ORCPT ); Mon, 26 Sep 2022 06:35:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235676AbiIZKdL (ORCPT ); Mon, 26 Sep 2022 06:33:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFBF64F3A7; Mon, 26 Sep 2022 03:20: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 F2BB660BB1; Mon, 26 Sep 2022 10:20:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E34B4C433D7; Mon, 26 Sep 2022 10:20:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187624; bh=Crs9yjD9A86Jv7JkmC1zHrtYGDtKccBbdtN3tQmWMPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bbwM03N5xYljJgQqyi3LnLM+sl3SqsLpMkj4TPGGuOe8hqcXMFxLIIG460X9MWyas RRhEjsMyVbTPRwdjLRLqhWqdw7ZFxeGUuEwEmEIo0mn3HwOBaoh6FcMsTJGVWR1JyL oZdydIVd1+WbHcCBVMvSiA8c0jWMdCDnSdSx25j0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Rob Herring , Sasha Levin Subject: [PATCH 5.4 001/120] of: fdt: fix off-by-one error in unflatten_dt_nodes() Date: Mon, 26 Sep 2022 12:10:34 +0200 Message-Id: <20220926100750.587398792@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergey Shtylyov [ Upstream commit 2f945a792f67815abca26fa8a5e863ccf3fa1181 ] Commit 78c44d910d3e ("drivers/of: Fix depth when unflattening devicetree") forgot to fix up the depth check in the loop body in unflatten_dt_nodes() which makes it possible to overflow the nps[] buffer... Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. Fixes: 78c44d910d3e ("drivers/of: Fix depth when unflattening devicetree") Signed-off-by: Sergey Shtylyov Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/7c354554-006f-6b31-c195-cdfe4caee392@omp.ru Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/of/fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 943d2a60bfdf..6d519ef3c5da 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -315,7 +315,7 @@ static int unflatten_dt_nodes(const void *blob, for (offset =3D 0; offset >=3D 0 && depth >=3D initial_depth; offset =3D fdt_next_node(blob, offset, &depth)) { - if (WARN_ON_ONCE(depth >=3D FDT_MAX_DEPTH)) + if (WARN_ON_ONCE(depth >=3D FDT_MAX_DEPTH - 1)) continue; =20 if (!IS_ENABLED(CONFIG_OF_KOBJ) && --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BBA6C32771 for ; Mon, 26 Sep 2022 10:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236038AbiIZKgo (ORCPT ); Mon, 26 Sep 2022 06:36:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236162AbiIZKeR (ORCPT ); Mon, 26 Sep 2022 06:34:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D73151427; Mon, 26 Sep 2022 03:21: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 5585A60B9A; Mon, 26 Sep 2022 10:21:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 651D1C433C1; Mon, 26 Sep 2022 10:21:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187661; bh=kng5jC/1zci+QWxcnKsqhCDG94Q2yEg6rNBISFkOGYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SUPCqUfyFbXgXV3FRGtqWLfz0T0ulpTo2YcoUTk7mQeMUA4Ljq4wMhAhUzkBjeQN7 QDyblifvcTma4CYZA0ou5VCk69eqtPoKV+B+fYEhg27v+IMxn5zfs9lrO2oTcc8fhw dqd47vWTw54CNiQ3vAMCEsrq/bv8dUISoTFlBHqk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever III , Trond Myklebust , Sasha Levin Subject: [PATCH 5.4 002/120] NFSv4: Turn off open-by-filehandle and NFS re-export for NFSv4.0 Date: Mon, 26 Sep 2022 12:10:35 +0200 Message-Id: <20220926100750.622104131@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trond Myklebust [ Upstream commit 2a9d683b48c8a87e61a4215792d44c90bcbbb536 ] The NFSv4.0 protocol only supports open() by name. It cannot therefore be used with open_by_handle() and friends, nor can it be re-exported by knfsd. Reported-by: Chuck Lever III Fixes: 20fa19027286 ("nfs: add export operations") Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/nfs/super.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/fs/nfs/super.c b/fs/nfs/super.c index a84df7d63403..ecc7277b3eda 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -2375,22 +2375,31 @@ void nfs_fill_super(struct super_block *sb, struct = nfs_mount_info *mount_info) if (data && data->bsize) sb->s_blocksize =3D nfs_block_size(data->bsize, &sb->s_blocksize_bits); =20 - if (server->nfs_client->rpc_ops->version !=3D 2) { - /* The VFS shouldn't apply the umask to mode bits. We will do - * so ourselves when necessary. + switch (server->nfs_client->rpc_ops->version) { + case 2: + sb->s_time_gran =3D 1000; + sb->s_time_min =3D 0; + sb->s_time_max =3D U32_MAX; + break; + case 3: + /* + * The VFS shouldn't apply the umask to mode bits. + * We will do so ourselves when necessary. */ sb->s_flags |=3D SB_POSIXACL; sb->s_time_gran =3D 1; - sb->s_export_op =3D &nfs_export_ops; - } else - sb->s_time_gran =3D 1000; - - if (server->nfs_client->rpc_ops->version !=3D 4) { sb->s_time_min =3D 0; sb->s_time_max =3D U32_MAX; - } else { + sb->s_export_op =3D &nfs_export_ops; + break; + case 4: + sb->s_flags |=3D SB_POSIXACL; + sb->s_time_gran =3D 1; sb->s_time_min =3D S64_MIN; sb->s_time_max =3D S64_MAX; + if (server->caps & NFS_CAP_ATOMIC_OPEN_V1) + sb->s_export_op =3D &nfs_export_ops; + break; } =20 nfs_initialise_sb(sb); --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16FF9C6FA83 for ; Mon, 26 Sep 2022 10:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236089AbiIZKhL (ORCPT ); Mon, 26 Sep 2022 06:37:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236313AbiIZKeu (ORCPT ); Mon, 26 Sep 2022 06:34:50 -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 D00285245D; Mon, 26 Sep 2022 03:21:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B565960BB7; Mon, 26 Sep 2022 10:21:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE4F8C43148; Mon, 26 Sep 2022 10:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187696; bh=2eD7QGliI3wXPdxG3FW/UmNFLlJHY7urDvH1z6VQP54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RgkcZ7RC8EVztKZ7tV0bbJNLUb3M1jQCWtjNbA6oVtGsxFl2WcCuelcl5a0lri+Yl 3EzWe0tCGfsBPXD86G6XOG2be/z55Ky+FRJ0voUudq/QWmcu9+PhbtrsdfppYtEsib 7/eTx+4SAY5yHZYsL3TOgfZcT3NzTexJ1VsrqJyc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.4 003/120] gpio: mpc8xxx: Fix support for IRQ_TYPE_LEVEL_LOW flow_type in mpc85xx Date: Mon, 26 Sep 2022 12:10:36 +0200 Message-Id: <20220926100750.666778118@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Roh=C3=A1r [ Upstream commit 279c12df8d2efb28def9d037f288cbfb97c30fe2 ] Commit e39d5ef67804 ("powerpc/5xxx: extend mpc8xxx_gpio driver to support mpc512x gpios") implemented support for IRQ_TYPE_LEVEL_LOW flow type in mpc512x via falling edge type. Do same for mpc85xx which support was added in commit 345e5c8a1cc3 ("powerpc: Add interrupt support to mpc8xxx_gpio"). Fixes probing of lm90 hwmon driver on mpc85xx based board which use level interrupt. Without it kernel prints error and refuse lm90 to work: [ 15.258370] genirq: Setting trigger mode 8 for irq 49 failed (mpc8xx= x_irq_set_type+0x0/0xf8) [ 15.267168] lm90 0-004c: cannot request IRQ 49 [ 15.272708] lm90: probe of 0-004c failed with error -22 Fixes: 345e5c8a1cc3 ("powerpc: Add interrupt support to mpc8xxx_gpio") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpio/gpio-mpc8xxx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index d72a3a5507b0..f3bf82efea8e 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c @@ -190,6 +190,7 @@ static int mpc8xxx_irq_set_type(struct irq_data *d, uns= igned int flow_type) =20 switch (flow_type) { case IRQ_TYPE_EDGE_FALLING: + case IRQ_TYPE_LEVEL_LOW: raw_spin_lock_irqsave(&mpc8xxx_gc->lock, flags); gc->write_reg(mpc8xxx_gc->regs + GPIO_ICR, gc->read_reg(mpc8xxx_gc->regs + GPIO_ICR) --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14477C32771 for ; Mon, 26 Sep 2022 10:37:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236143AbiIZKht (ORCPT ); Mon, 26 Sep 2022 06:37:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235951AbiIZKgd (ORCPT ); Mon, 26 Sep 2022 06:36:33 -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 8D06352837; Mon, 26 Sep 2022 03:21: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 E8FFCB80926; Mon, 26 Sep 2022 10:21:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12E20C433D6; Mon, 26 Sep 2022 10:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187711; bh=gd9sLiAsyp+E07Clr2bvxOlWLzwYfJagHCJJB39w5Bs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M+noossukkTGTxGfsKJoqucjUXQDXc4SbtpXdrxRLrSaSMHUQMZsQpHL1LMC5GiR7 XtBtNtp3n2wZwJYZDFBPYbS1y35OcY6/V68oz18Vju9MedX3qGCZiM9v3q6uCQptYt aF83U27LBA1Clxiskye5Q/KSfuGiNRZqEv1UDi9c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stuart Menefy , Neil Armstrong , Sasha Levin Subject: [PATCH 5.4 004/120] drm/meson: Correct OSD1 global alpha value Date: Mon, 26 Sep 2022 12:10:37 +0200 Message-Id: <20220926100750.704908425@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stuart Menefy [ Upstream commit 6836829c8ea453c9e3e518e61539e35881c8ed5f ] VIU_OSD1_CTRL_STAT.GLOBAL_ALPHA is a 9 bit field, so the maximum value is 0x100 not 0xff. This matches the vendor kernel. Signed-off-by: Stuart Menefy Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller= ") Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220908155103.686904-1= -stuart.menefy@mathembedded.com Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/meson/meson_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/me= son_plane.c index ed543227b00d..53f5d0581c35 100644 --- a/drivers/gpu/drm/meson/meson_plane.c +++ b/drivers/gpu/drm/meson/meson_plane.c @@ -128,7 +128,7 @@ static void meson_plane_atomic_update(struct drm_plane = *plane, =20 /* Enable OSD and BLK0, set max global alpha */ priv->viu.osd1_ctrl_stat =3D OSD_ENABLE | - (0xFF << OSD_GLOBAL_ALPHA_SHIFT) | + (0x100 << OSD_GLOBAL_ALPHA_SHIFT) | OSD_BLK0_ENABLE; =20 canvas_id_osd1 =3D priv->canvas_id_osd1; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E1ECC32771 for ; Mon, 26 Sep 2022 10:37:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236150AbiIZKh4 (ORCPT ); Mon, 26 Sep 2022 06:37:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236028AbiIZKgh (ORCPT ); Mon, 26 Sep 2022 06:36: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 7756C52DC7; Mon, 26 Sep 2022 03:21: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 dfw.source.kernel.org (Postfix) with ESMTPS id 9AD1760B9A; Mon, 26 Sep 2022 10:21:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 883B6C433C1; Mon, 26 Sep 2022 10:21:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187715; bh=xrRkTu9BEVuk84a5FzYfaxbwIhmMwPI5NfR3CH5GFAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wg6WEf/0TnC46qg8Cdk2Yv4ZbqwUcpfIzcguEUtW2RUi90gGQGfOL+x63JdsEH197 Qwb9S+GkXJbD+kkss3CSQBYTKgCi95QnXqA2jNOGC4zMqAj4/mgmSgyc/B2Y9V81ka s9xiBm1cLyU4nPnlDMr3oXH6gr0UuIYqFoyIYmUY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stuart Menefy , Neil Armstrong , Sasha Levin Subject: [PATCH 5.4 005/120] drm/meson: Fix OSD1 RGB to YCbCr coefficient Date: Mon, 26 Sep 2022 12:10:38 +0200 Message-Id: <20220926100750.741589682@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stuart Menefy [ Upstream commit 6463d3930ba5b6addcfc8f80a4543976a2fc7656 ] VPP_WRAP_OSD1_MATRIX_COEF22.Coeff22 is documented as being bits 0-12, not 16-28. Without this the output tends to have a pink hue, changing it results in better color accuracy. The vendor kernel doesn't use this register. However the code which sets VIU2_OSD1_MATRIX_COEF22 also uses bits 0-12. There is a slightly different style of registers for configuring some of the other matrices, which do use bits 16-28 for this coefficient, but those have names ending in MATRIX_COEF22_30, and this is not one of those. Signed-off-by: Stuart Menefy Fixes: 728883948b0d ("drm/meson: Add G12A Support for VIU setup") Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220908155243.687143-1= -stuart.menefy@mathembedded.com Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/meson/meson_viu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meso= n_viu.c index 9991f0a43b1a..8d0938525978 100644 --- a/drivers/gpu/drm/meson/meson_viu.c +++ b/drivers/gpu/drm/meson/meson_viu.c @@ -91,7 +91,7 @@ static void meson_viu_set_g12a_osd1_matrix(struct meson_d= rm *priv, priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF11_12)); writel(((m[9] & 0x1fff) << 16) | (m[10] & 0x1fff), priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF20_21)); - writel((m[11] & 0x1fff) << 16, + writel((m[11] & 0x1fff), priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF22)); =20 writel(((m[18] & 0xfff) << 16) | (m[19] & 0xfff), --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4C2EC07E9D for ; Mon, 26 Sep 2022 10:40:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236135AbiIZKkK (ORCPT ); Mon, 26 Sep 2022 06:40:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236136AbiIZKhm (ORCPT ); Mon, 26 Sep 2022 06:37:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5438C52DE3; Mon, 26 Sep 2022 03:22: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 89786B80682; Mon, 26 Sep 2022 10:21:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB665C433D7; Mon, 26 Sep 2022 10:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187718; bh=yDD+tEnuOOYBChulh8vKMrzIijmV/sFlusTqTAgudFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZDa07xeNKf7Y3VORy2eSM2fkO//uWGggIHzADJmTvu5hJdTPhfAJALMB9VO/pM5Wm boWJYU75sFbPzfwlrqHjlQRlBiBX98Tsi6KsjQJQCEQs/mJ+77tYyFyvLdih489QnO vn6Fh4OkDWOutfNbdmeiiXEnOxhzHciuLrxb64AA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Helge Deller , Sasha Levin Subject: [PATCH 5.4 006/120] parisc: ccio-dma: Add missing iounmap in error path in ccio_probe() Date: Mon, 26 Sep 2022 12:10:39 +0200 Message-Id: <20220926100750.789844366@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit 38238be4e881a5d0abbe4872b4cd6ed790be06c8 ] Add missing iounmap() before return from ccio_probe(), if ccio_init_resourc= es() fails. Fixes: d46c742f827f ("parisc: ccio-dma: Handle kmalloc failure in ccio_init= _resources()") Signed-off-by: Yang Yingliang Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/parisc/ccio-dma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index 6209d58e9492..fdd302d0a1c9 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c @@ -1544,6 +1544,7 @@ static int __init ccio_probe(struct parisc_device *de= v) } ccio_ioc_init(ioc); if (ccio_init_resources(ioc)) { + iounmap(ioc->ioc_regs); kfree(ioc); return -ENOMEM; } --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D70DAC6FA95 for ; Mon, 26 Sep 2022 10:39:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235981AbiIZKj5 (ORCPT ); Mon, 26 Sep 2022 06:39:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236117AbiIZKh3 (ORCPT ); Mon, 26 Sep 2022 06:37:29 -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 EE22A52DF5; Mon, 26 Sep 2022 03:22: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 B3073B80835; Mon, 26 Sep 2022 10:22:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C64D4C433D7; Mon, 26 Sep 2022 10:22:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187721; bh=jqnPyBN37PEz0xr+ig2bvxymuiERr5uZNWmJUI6FYcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OeAyUvu8fSoL+ci5wULiUwzUDd2BXwmnZRC9mPlIIYZOo/gBAfJtrYdtPsIksWGND niDdPLt9ctO1t9uU2MspMg7S6G3zQ6sM/+MEAjJQisWzHBACuN4Zd2ahUI4h+2ZUSz FtMjdKux5HCtYIpclAf1VartvHPFIDoPM8AGUxAw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Morse , Sami Tolvanen , Kees Cook , Ard Biesheuvel , Will Deacon , Sasha Levin Subject: [PATCH 5.4 007/120] efi/libstub: Disable Shadow Call Stack Date: Mon, 26 Sep 2022 12:10:40 +0200 Message-Id: <20220926100750.834421805@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sami Tolvanen [ Upstream commit cc49c71d2abe99c1c2c9bedf0693ad2d3ee4a067 ] Shadow stacks are not available in the EFI stub, filter out SCS flags. Suggested-by: James Morse Signed-off-by: Sami Tolvanen Reviewed-by: Kees Cook Acked-by: Ard Biesheuvel Signed-off-by: Will Deacon Stable-dep-of: 1a3887924a7e ("efi: libstub: Disable struct randomization") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/firmware/efi/libstub/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/l= ibstub/Makefile index 8c5b5529dbc0..f3540d5dd276 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -31,6 +31,9 @@ KBUILD_CFLAGS :=3D $(cflags-y) -DDISABLE_BRANCH_PROFILI= NG \ $(call cc-option,-fno-addrsig) \ -D__DISABLE_EXPORTS =20 +# remove SCS flags from all objects in this directory +KBUILD_CFLAGS :=3D $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS)) + GCOV_PROFILE :=3D n KASAN_SANITIZE :=3D n UBSAN_SANITIZE :=3D n --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55329C6FA83 for ; Mon, 26 Sep 2022 10:41:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236197AbiIZKlf (ORCPT ); Mon, 26 Sep 2022 06:41:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236123AbiIZKhe (ORCPT ); Mon, 26 Sep 2022 06:37: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 89C1A52E42; Mon, 26 Sep 2022 03:22: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 ams.source.kernel.org (Postfix) with ESMTPS id D660DB80924; Mon, 26 Sep 2022 10:22:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C942C433C1; Mon, 26 Sep 2022 10:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187724; bh=GBX0JFX1Jnc9kGAMgl+8H64Kis2TflBUuMzRAFsOVlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L5Fi+c3kxdO6hZCzz0IWxn3EXi0+U7ISpZNGucYFq7kPhy2CEcEX+Apw3/yXg8aAz to65S7I3i+A9tvWtn3N/gv0yxIq/iSDQxIYgb9hoig+M66NORmcJnA0k2W5RTuK6Y8 6VSDCAQDvb/Di/X6vxdMVcIlRbKJ5mQV3d/KSFeM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Marth , Ard Biesheuvel , Kees Cook , Sasha Levin Subject: [PATCH 5.4 008/120] efi: libstub: Disable struct randomization Date: Mon, 26 Sep 2022 12:10:41 +0200 Message-Id: <20220926100750.874865087@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel [ Upstream commit 1a3887924a7e6edd331be76da7bf4c1e8eab4b1e ] The EFI stub is a wrapper around the core kernel that makes it look like a EFI compatible PE/COFF application to the EFI firmware. EFI applications run on top of the EFI runtime, which is heavily based on so-called protocols, which are struct types consisting [mostly] of function pointer members that are instantiated and recorded in a protocol database. These structs look like the ideal randomization candidates to the randstruct plugin (as they only carry function pointers), but of course, these protocols are contracts between the firmware that exposes them, and the EFI applications (including our stubbed kernel) that invoke them. This means that struct randomization for EFI protocols is not a great idea, and given that the stub shares very little data with the core kernel that is represented as a randomizable struct, we're better off just disabling it completely here. Cc: # v4.14+ Reported-by: Daniel Marth Tested-by: Daniel Marth Signed-off-by: Ard Biesheuvel Acked-by: Kees Cook Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/firmware/efi/libstub/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/l= ibstub/Makefile index f3540d5dd276..34e4b31010bd 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -31,6 +31,13 @@ KBUILD_CFLAGS :=3D $(cflags-y) -DDISABLE_BRANCH_PROFIL= ING \ $(call cc-option,-fno-addrsig) \ -D__DISABLE_EXPORTS =20 +# +# struct randomization only makes sense for Linux internal types, which th= e EFI +# stub code never touches, so let's turn off struct randomization for the = stub +# altogether +# +KBUILD_CFLAGS :=3D $(filter-out $(RANDSTRUCT_CFLAGS), $(KBUILD_CFLAGS)) + # remove SCS flags from all objects in this directory KBUILD_CFLAGS :=3D $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS)) =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5948C07E9D for ; Mon, 26 Sep 2022 10:40:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236124AbiIZKkD (ORCPT ); Mon, 26 Sep 2022 06:40:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236132AbiIZKhg (ORCPT ); Mon, 26 Sep 2022 06:37:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E33DB52E4E; Mon, 26 Sep 2022 03:22: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 17669609D1; Mon, 26 Sep 2022 10:22:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C047C433C1; Mon, 26 Sep 2022 10:22:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187727; bh=2XsVl3heTzmq9Lyxn4mWy5hOBLXz/+TyJe/RKiBG/m8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wOPlNl4+H2sE7LhGymxlyCvCQKiwKOOZ/hbrFkFRnOwkdaU5Jz8mjOINMMnQyO+ff mhTiZ5BBLX7PQFAFZiHK1HDF/ABPN/ZxepV8I+ZKGyVZqMLllL/MJ4tC0nDmSQWyo/ ee8lZpTeHH4rImb6+i9VSADrs8acBhTB5xiWbDrE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaroslav Kysela , Takashi Iwai , Sasha Levin , butt3rflyh4ck Subject: [PATCH 5.4 009/120] ALSA: pcm: oss: Fix race at SNDCTL_DSP_SYNC Date: Mon, 26 Sep 2022 12:10:42 +0200 Message-Id: <20220926100750.908254133@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" [ Upstream commit 8423f0b6d513b259fdab9c9bf4aaa6188d054c2d ] There is a small race window at snd_pcm_oss_sync() that is called from OSS PCM SNDCTL_DSP_SYNC ioctl; namely the function calls snd_pcm_oss_make_ready() at first, then takes the params_lock mutex for the rest. When the stream is set up again by another thread between them, it leads to inconsistency, and may result in unexpected results such as NULL dereference of OSS buffer as a fuzzer spotted recently. The fix is simply to cover snd_pcm_oss_make_ready() call into the same params_lock mutex with snd_pcm_oss_make_ready_locked() variant. Reported-and-tested-by: butt3rflyh4ck Reviewed-by: Jaroslav Kysela Cc: Link: https://lore.kernel.org/r/CAFcO6XN7JDM4xSXGhtusQfS2mSBcx50VJKwQpCq=3D= WeLt57aaZA@mail.gmail.com Link: https://lore.kernel.org/r/20220905060714.22549-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/core/oss/pcm_oss.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index ad4e0af2d0d0..51d2911366e9 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -1661,13 +1661,14 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file= *pcm_oss_file) runtime =3D substream->runtime; if (atomic_read(&substream->mmap_count)) goto __direct; - if ((err =3D snd_pcm_oss_make_ready(substream)) < 0) - return err; atomic_inc(&runtime->oss.rw_ref); if (mutex_lock_interruptible(&runtime->oss.params_lock)) { atomic_dec(&runtime->oss.rw_ref); return -ERESTARTSYS; } + err =3D snd_pcm_oss_make_ready_locked(substream); + if (err < 0) + goto unlock; format =3D snd_pcm_oss_format_from(runtime->oss.format); width =3D snd_pcm_format_physical_width(format); if (runtime->oss.buffer_used > 0) { --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2A89C6FA83 for ; Mon, 26 Sep 2022 10:35:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235961AbiIZKfn (ORCPT ); Mon, 26 Sep 2022 06:35:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235623AbiIZKdY (ORCPT ); Mon, 26 Sep 2022 06:33:24 -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 08EDC22B1D; Mon, 26 Sep 2022 03:20: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 dfw.source.kernel.org (Postfix) with ESMTPS id E651360C62; Mon, 26 Sep 2022 10:20:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4567C43148; Mon, 26 Sep 2022 10:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187627; bh=NV8t6kDUuThjpl5lc0UTvDfmdAH4R9M0OUya7m0Jjw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nlWKpqMmp1YrYyICOnXn7i58w8aYbagWb4h7k0j8ZdWv30pUphijgbKXNjS2tW4A+ pUFABe5iS4aIWkfpqXnQMkVV8HIc6TEvEl9Ef0Z5TTFf5Q4xfEudXVc9xNaGL7p5Ik BvhY4mXGKi8YNtccJ77/41xcnbyzfRoOC/8DzgKc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.4 010/120] task_stack, x86/cea: Force-inline stack helpers Date: Mon, 26 Sep 2022 12:10:43 +0200 Message-Id: <20220926100750.941936998@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Borislav Petkov [ Upstream commit e87f4152e542610d0b4c6c8548964a68a59d2040 ] Force-inline two stack helpers to fix the following objtool warnings: vmlinux.o: warning: objtool: in_task_stack()+0xc: call to task_stack_page= () leaves .noinstr.text section vmlinux.o: warning: objtool: in_entry_stack()+0x10: call to cpu_entry_sta= ck() leaves .noinstr.text section Signed-off-by: Borislav Petkov Acked-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20220324183607.31717-2-bp@alien8.de Stable-dep-of: 54c3931957f6 ("tracing: hold caller_addr to hardirq_{enable,= disable}_ip") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/include/asm/cpu_entry_area.h | 2 +- include/linux/sched/task_stack.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/cpu_entry_area.h b/arch/x86/include/asm/c= pu_entry_area.h index ea866c7bf31d..0d1d37d8b279 100644 --- a/arch/x86/include/asm/cpu_entry_area.h +++ b/arch/x86/include/asm/cpu_entry_area.h @@ -133,7 +133,7 @@ extern void cea_set_pte(void *cea_vaddr, phys_addr_t pa= , pgprot_t flags); =20 extern struct cpu_entry_area *get_cpu_entry_area(int cpu); =20 -static inline struct entry_stack *cpu_entry_stack(int cpu) +static __always_inline struct entry_stack *cpu_entry_stack(int cpu) { return &get_cpu_entry_area(cpu)->entry_stack_page.stack; } diff --git a/include/linux/sched/task_stack.h b/include/linux/sched/task_st= ack.h index d10150587d81..1009b6b5ce40 100644 --- a/include/linux/sched/task_stack.h +++ b/include/linux/sched/task_stack.h @@ -16,7 +16,7 @@ * try_get_task_stack() instead. task_stack_page will return a pointer * that could get freed out from under you. */ -static inline void *task_stack_page(const struct task_struct *task) +static __always_inline void *task_stack_page(const struct task_struct *tas= k) { return task->stack; } --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 632A1C6FA83 for ; Mon, 26 Sep 2022 10:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235939AbiIZKfa (ORCPT ); Mon, 26 Sep 2022 06:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235872AbiIZKdV (ORCPT ); Mon, 26 Sep 2022 06:33:21 -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 EE56B4F65C; Mon, 26 Sep 2022 03:20:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 03A8B60BB7; Mon, 26 Sep 2022 10:20:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13308C433D6; Mon, 26 Sep 2022 10:20:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187630; bh=gQ1s/FiAXl9iYKZ/lkQN032VXwbMRyy9gtt37y6HU2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1Wqblb9M/ciyV63zNORM0YpJmkyBaSRx8Wrqi23qwCpID2bZg5awIzFw8MsLeyN8 NXPaHEyEHCyMvOzhRCvwMDtdeBKiDADTjODl4nLwa8Yb8LjPc5+xfDkl7PabP0fCIt 6vRjubJjOn5boSaKInHCthb15D+l7j4ZwJlG7CAc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yipeng Zou , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.4 011/120] tracing: hold caller_addr to hardirq_{enable,disable}_ip Date: Mon, 26 Sep 2022 12:10:44 +0200 Message-Id: <20220926100750.981656855@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yipeng Zou [ Upstream commit 54c3931957f6a6194d5972eccc36d052964b2abe ] Currently, The arguments passing to lockdep_hardirqs_{on,off} was fixed in CALLER_ADDR0. The function trace_hardirqs_on_caller should have been intended to use caller_addr to represent the address that caller wants to be traced. For example, lockdep log in riscv showing the last {enabled,disabled} at __trace_hardirqs_{on,off} all the time(if called by): [ 57.853175] hardirqs last enabled at (2519): __trace_hardirqs_on+0xc/0x= 14 [ 57.853848] hardirqs last disabled at (2520): __trace_hardirqs_off+0xc/0= x14 After use trace_hardirqs_xx_caller, we can get more effective information: [ 53.781428] hardirqs last enabled at (2595): restore_all+0xe/0x66 [ 53.782185] hardirqs last disabled at (2596): ret_from_exception+0xa/0x10 Link: https://lkml.kernel.org/r/20220901104515.135162-2-zouyipeng@huawei.com Cc: stable@vger.kernel.org Fixes: c3bc8fd637a96 ("tracing: Centralize preemptirq tracepoints and unify= their usage") Signed-off-by: Yipeng Zou Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/trace/trace_preemptirq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/trace/trace_preemptirq.c b/kernel/trace/trace_preemptir= q.c index 26b06b09c9f6..e9645f829b94 100644 --- a/kernel/trace/trace_preemptirq.c +++ b/kernel/trace/trace_preemptirq.c @@ -56,14 +56,14 @@ __visible void trace_hardirqs_on_caller(unsigned long c= aller_addr) this_cpu_write(tracing_irq_cpu, 0); } =20 - lockdep_hardirqs_on(CALLER_ADDR0); + lockdep_hardirqs_on(caller_addr); } EXPORT_SYMBOL(trace_hardirqs_on_caller); NOKPROBE_SYMBOL(trace_hardirqs_on_caller); =20 __visible void trace_hardirqs_off_caller(unsigned long caller_addr) { - lockdep_hardirqs_off(CALLER_ADDR0); + lockdep_hardirqs_off(caller_addr); =20 if (!this_cpu_read(tracing_irq_cpu)) { this_cpu_write(tracing_irq_cpu, 1); --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71F3CC32771 for ; Mon, 26 Sep 2022 10:35:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235950AbiIZKfj (ORCPT ); Mon, 26 Sep 2022 06:35:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235873AbiIZKdV (ORCPT ); Mon, 26 Sep 2022 06:33:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29D6E4F68A; Mon, 26 Sep 2022 03:20:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C23C5B80682; Mon, 26 Sep 2022 10:20:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24BE1C433D6; Mon, 26 Sep 2022 10:20:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187633; bh=CkLv4OO4iQ7u/ZD/WpTAtghCtQKcj/hHxNDBawxyRHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZmzjsKJtkWEv2dAoZnb9OZybnUGf4qbGO2ckH3zT1gCHsIUwrZ12AfBSjoIVuofp0 PWkx3Ooj4IobbXKjN4zBVzafRnAiCirvcjlpy1e+5ukERTLwMaQoNk69UjYKgme+Wf tnwcLrE+gZfXVj4SVL0aJMQskNuNI0IvWG/3yey8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Ronnie Sahlberg , Steve French Subject: [PATCH 5.4 012/120] cifs: revalidate mapping when doing direct writes Date: Mon, 26 Sep 2022 12:10:45 +0200 Message-Id: <20220926100751.029025056@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ronnie Sahlberg commit 7500a99281dfed2d4a84771c933bcb9e17af279b upstream. Kernel bugzilla: 216301 When doing direct writes we need to also invalidate the mapping in case we have a cached copy of the affected page(s) in memory or else subsequent reads of the data might return the old/stale content before we wrote an update to the server. Cc: stable@vger.kernel.org Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/cifs/file.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -3194,6 +3194,9 @@ static ssize_t __cifs_writev( =20 ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from) { + struct file *file =3D iocb->ki_filp; + + cifs_revalidate_mapping(file->f_inode); return __cifs_writev(iocb, from, true); } From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDBD8C07E9D for ; Mon, 26 Sep 2022 10:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235974AbiIZKfr (ORCPT ); Mon, 26 Sep 2022 06:35:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235611AbiIZKdX (ORCPT ); Mon, 26 Sep 2022 06:33:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C56E44F3A1; Mon, 26 Sep 2022 03:20:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D50160B9A; Mon, 26 Sep 2022 10:20:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58E62C433B5; Mon, 26 Sep 2022 10:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187636; bh=AXLqAExynxexynN+a64WeqYqgR2F9VxCs+rGGpDCrxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GalQYhq/PVRwmOdfiSe1ooeCq2HK8fx47MglQlFAvY9Wk8CQWB7HTfxi+1n5hR23e HV1L/wRUMiF6bVryITS3+uddwndAbE8k+gqyrXRuqkzFwvOhX62Fq4RSEs9USbPgoH 4tC1U4kPWD5WF/COnh06D/1g2irJsVAXhNNqcey0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Metzmacher , Ronnie Sahlberg , "Paulo Alcantara (SUSE)" , Steve French Subject: [PATCH 5.4 013/120] cifs: dont send down the destination address to sendmsg for a SOCK_STREAM Date: Mon, 26 Sep 2022 12:10:46 +0200 Message-Id: <20220926100751.074521978@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stefan Metzmacher commit 17d3df38dc5f4cec9b0ac6eb79c1859b6e2693a4 upstream. This is ignored anyway by the tcp layer. Signed-off-by: Stefan Metzmacher Cc: stable@vger.kernel.org Reviewed-by: Ronnie Sahlberg Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/cifs/transport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -209,8 +209,8 @@ smb_send_kvec(struct TCP_Server_Info *se =20 *sent =3D 0; =20 - smb_msg->msg_name =3D (struct sockaddr *) &server->dstaddr; - smb_msg->msg_namelen =3D sizeof(struct sockaddr); + smb_msg->msg_name =3D NULL; + smb_msg->msg_namelen =3D 0; smb_msg->msg_control =3D NULL; smb_msg->msg_controllen =3D 0; if (server->noblocksnd) From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63335C07E9D for ; Mon, 26 Sep 2022 10:36:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235962AbiIZKfz (ORCPT ); Mon, 26 Sep 2022 06:35:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235912AbiIZKdf (ORCPT ); Mon, 26 Sep 2022 06:33:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA45F4F67E; Mon, 26 Sep 2022 03:20: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 ams.source.kernel.org (Postfix) with ESMTPS id DC9CCB80924; Mon, 26 Sep 2022 10:20:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 347B2C433C1; Mon, 26 Sep 2022 10:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187640; bh=Gl3ox5AJR7lPGqGsDshH8oHQ85CLeBRjmba8YdWvd+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P1cvGEdaSgBE4irn1fxTAjbdT6YHv2JWOAZvftNQ2suR9JWfjSFMuOP9yd6DHgYxz JOSkYv8e2MskK8cDRHEDItfsV9HpHqaoi/RvWOCMd2fx43npW5njYVaEDGUMQ8AZBg BBg+u8d91uPg4Ge/qCAV+SYYNLQzbdKE9immYN+s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 014/120] MAINTAINERS: add Chandan as xfs maintainer for 5.4.y Date: Mon, 26 Sep 2022 12:10:47 +0200 Message-Id: <20220926100751.114438914@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chandan Babu R This is an attempt to direct the bots and humans that are testing LTS 5.4.y towards the maintainer of xfs in the 5.4.y tree. Update Darrick's email address from upstream and add Chandan as xfs maintaier for the 5.4.y tree. Suggested-by: Darrick J. Wong Link: https://lore.kernel.org/linux-xfs/Yrx6%2F0UmYyuBPjEr@magnolia/ Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17864,7 +17864,8 @@ S: Supported F: sound/xen/* =20 XFS FILESYSTEM -M: Darrick J. Wong +M: Chandan Babu R +M: Darrick J. Wong M: linux-xfs@vger.kernel.org L: linux-xfs@vger.kernel.org W: http://xfs.org/ From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84CC1C32771 for ; Mon, 26 Sep 2022 10:36:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236001AbiIZKgK (ORCPT ); Mon, 26 Sep 2022 06:36:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235978AbiIZKdp (ORCPT ); Mon, 26 Sep 2022 06:33: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 C5A664F6BC; Mon, 26 Sep 2022 03:20:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 947CAB80835; Mon, 26 Sep 2022 10:20:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 066B5C433C1; Mon, 26 Sep 2022 10:20:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187643; bh=/qy+wl376VZ2Qn1ipDOjXipIVOsRHSCbVcNW+nRvVyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KUWNpBeXVweOCgruM9wZuLLJXtZcErx7fl91quTFbHo+8RB6+qVlM0EQR6QL8Ycwz n/jXZTrVnPGBFfGbhYgiCGgz2YbNOvQcHlu9ixuP7b108a0jqAVPtp3hEQsfT2Zk2t KwOVUSdOwS67XLderFVYJcXiRbSxmhcwcDmllpLg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Chinner , Christoph Hellwig , "Darrick J. Wong" , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 015/120] iomap: iomap that extends beyond EOF should be marked dirty Date: Mon, 26 Sep 2022 12:10:48 +0200 Message-Id: <20220926100751.145723992@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chandan Babu R From: Dave Chinner commit 7684e2c4384d5d1f884b01ab8bff2369e4db0bff upstream. When doing a direct IO that spans the current EOF, and there are written blocks beyond EOF that extend beyond the current write, the only metadata update that needs to be done is a file size extension. However, we don't mark such iomaps as IOMAP_F_DIRTY to indicate that there is IO completion metadata updates required, and hence we may fail to correctly sync file size extensions made in IO completion when O_DSYNC writes are being used and the hardware supports FUA. Hence when setting IOMAP_F_DIRTY, we need to also take into account whether the iomap spans the current EOF. If it does, then we need to mark it dirty so that IO completion will call generic_write_sync() to flush the inode size update to stable storage correctly. Fixes: 3460cac1ca76 ("iomap: Use FUA for pure data O_DSYNC DIO writes") Signed-off-by: Dave Chinner Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong [darrick: removed the ext4 part; they'll handle it separately] Signed-off-by: Darrick J. Wong Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/xfs_iomap.c | 7 +++++++ include/linux/iomap.h | 2 ++ 2 files changed, 9 insertions(+) --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -1055,6 +1055,13 @@ xfs_file_iomap_begin( trace_xfs_iomap_alloc(ip, offset, length, XFS_DATA_FORK, &imap); =20 out_finish: + /* + * Writes that span EOF might trigger an IO size update on completion, + * so consider them to be dirty for the purposes of O_DSYNC even if + * there is no other metadata changes pending or have been made here. + */ + if ((flags & IOMAP_WRITE) && offset + length > i_size_read(inode)) + iomap->flags |=3D IOMAP_F_DIRTY; return xfs_bmbt_to_iomap(ip, iomap, &imap, shared); =20 out_found: --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -32,6 +32,8 @@ struct vm_fault; * * IOMAP_F_DIRTY indicates the inode has uncommitted metadata needed to ac= cess * written data and requires fdatasync to commit them to persistent storag= e. + * This needs to take into account metadata changes that *may* be made at = IO + * completion, such as file size updates from direct IO. */ #define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */ #define IOMAP_F_DIRTY 0x02 /* uncommitted metadata */ From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FFCCC07E9D for ; Mon, 26 Sep 2022 10:36:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235930AbiIZKgZ (ORCPT ); Mon, 26 Sep 2022 06:36:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236022AbiIZKdw (ORCPT ); Mon, 26 Sep 2022 06:33:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 232113DF3D; Mon, 26 Sep 2022 03:20: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 DA17060AD6; Mon, 26 Sep 2022 10:20:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3176C433C1; Mon, 26 Sep 2022 10:20:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187646; bh=MvrFLzVPgqzDsrlIxsZUvsUYtPzd3vuBgQC+nZ43MeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PqtbYIUhBZF4l6M4pbvS8xIc+5Ns+YIBKws5sHb6Im/Yj5nAwRmGgVZHrb3pTXpDn 7r+Xl8VwQFQ6yG4e1QvXKQSwIkov/fBhmRwomUvNB9NRJnvuFGrLJ2abQh1KI7/qQ1 4mlpIp6vGKt5zq9h5yPNNFZvO6+R8WwOEEgDES7w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Mark Brown , Sasha Levin Subject: [PATCH 5.4 016/120] ASoC: nau8824: Fix semaphore unbalance at error paths Date: Mon, 26 Sep 2022 12:10:49 +0200 Message-Id: <20220926100751.194408985@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit 5628560e90395d3812800a8e44a01c32ffa429ec ] The semaphore of nau8824 wasn't properly unlocked at some error handling code paths, hence this may result in the unbalance (and potential lock-up). Fix them to handle the semaphore up properly. Signed-off-by: Takashi Iwai Link: https://lore.kernel.org/r/20220823081000.2965-3-tiwai@suse.de Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/codecs/nau8824.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/nau8824.c b/sound/soc/codecs/nau8824.c index c8ccfa2fff84..a95fe3fff1db 100644 --- a/sound/soc/codecs/nau8824.c +++ b/sound/soc/codecs/nau8824.c @@ -1072,6 +1072,7 @@ static int nau8824_hw_params(struct snd_pcm_substream= *substream, struct snd_soc_component *component =3D dai->component; struct nau8824 *nau8824 =3D snd_soc_component_get_drvdata(component); unsigned int val_len =3D 0, osr, ctrl_val, bclk_fs, bclk_div; + int err =3D -EINVAL; =20 nau8824_sema_acquire(nau8824, HZ); =20 @@ -1088,7 +1089,7 @@ static int nau8824_hw_params(struct snd_pcm_substream= *substream, osr &=3D NAU8824_DAC_OVERSAMPLE_MASK; if (nau8824_clock_check(nau8824, substream->stream, nau8824->fs, osr)) - return -EINVAL; + goto error; regmap_update_bits(nau8824->regmap, NAU8824_REG_CLK_DIVIDER, NAU8824_CLK_DAC_SRC_MASK, osr_dac_sel[osr].clk_src << NAU8824_CLK_DAC_SRC_SFT); @@ -1098,7 +1099,7 @@ static int nau8824_hw_params(struct snd_pcm_substream= *substream, osr &=3D NAU8824_ADC_SYNC_DOWN_MASK; if (nau8824_clock_check(nau8824, substream->stream, nau8824->fs, osr)) - return -EINVAL; + goto error; regmap_update_bits(nau8824->regmap, NAU8824_REG_CLK_DIVIDER, NAU8824_CLK_ADC_SRC_MASK, osr_adc_sel[osr].clk_src << NAU8824_CLK_ADC_SRC_SFT); @@ -1119,7 +1120,7 @@ static int nau8824_hw_params(struct snd_pcm_substream= *substream, else if (bclk_fs <=3D 256) bclk_div =3D 0; else - return -EINVAL; + goto error; regmap_update_bits(nau8824->regmap, NAU8824_REG_PORT0_I2S_PCM_CTRL_2, NAU8824_I2S_LRC_DIV_MASK | NAU8824_I2S_BLK_DIV_MASK, @@ -1140,15 +1141,17 @@ static int nau8824_hw_params(struct snd_pcm_substre= am *substream, val_len |=3D NAU8824_I2S_DL_32; break; default: - return -EINVAL; + goto error; } =20 regmap_update_bits(nau8824->regmap, NAU8824_REG_PORT0_I2S_PCM_CTRL_1, NAU8824_I2S_DL_MASK, val_len); + err =3D 0; =20 + error: nau8824_sema_release(nau8824); =20 - return 0; + return err; } =20 static int nau8824_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) @@ -1157,8 +1160,6 @@ static int nau8824_set_fmt(struct snd_soc_dai *dai, u= nsigned int fmt) struct nau8824 *nau8824 =3D snd_soc_component_get_drvdata(component); unsigned int ctrl1_val =3D 0, ctrl2_val =3D 0; =20 - nau8824_sema_acquire(nau8824, HZ); - switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBM_CFM: ctrl2_val |=3D NAU8824_I2S_MS_MASTER; @@ -1200,6 +1201,8 @@ static int nau8824_set_fmt(struct snd_soc_dai *dai, u= nsigned int fmt) return -EINVAL; } =20 + nau8824_sema_acquire(nau8824, HZ); + regmap_update_bits(nau8824->regmap, NAU8824_REG_PORT0_I2S_PCM_CTRL_1, NAU8824_I2S_DF_MASK | NAU8824_I2S_BP_MASK | NAU8824_I2S_PCMB_EN, ctrl1_val); --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D61BCC32771 for ; Mon, 26 Sep 2022 10:36:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236010AbiIZKgO (ORCPT ); Mon, 26 Sep 2022 06:36:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235995AbiIZKds (ORCPT ); Mon, 26 Sep 2022 06:33:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06081402D2; Mon, 26 Sep 2022 03:20:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A4D5260BB7; Mon, 26 Sep 2022 10:20:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A4DBC433C1; Mon, 26 Sep 2022 10:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187650; bh=ej2tE7gZWV9cHhIiuMetz5wTyN3WfyfLSQZWx7J+Hu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tvD4tf7F+n298aNBzeZ9lT+CY0AyUb//dBtODZox38RJc9aWY+XNH81BpRGDlDyi2 R9/5izKLnblN2BJ81Bz9tLEbJHmY3nLIEmR0LKomOGTaheNRpNcdkBrfN5gG1BWsa+ 0HpT/kfNQJMm1v8gE70eco9+64BzVbo88CXQn+UQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaolei Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.4 017/120] regulator: pfuze100: Fix the global-out-of-bounds access in pfuze100_regulator_probe() Date: Mon, 26 Sep 2022 12:10:50 +0200 Message-Id: <20220926100751.233965623@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiaolei Wang [ Upstream commit 78e1e867f44e6bdc72c0e6a2609a3407642fb30b ] The pfuze_chip::regulator_descs is an array of size PFUZE100_MAX_REGULATOR, the pfuze_chip::pfuze_regulators is the pointer to the real regulators of a specific device. The number of real regulator is supposed to be less than the PFUZE100_MAX_REGULATOR, so we should use the size of 'regulator_num * sizeof(struct pfuze_regulator)' in memcpy(). This fixes the out of bounds access bug reported by KASAN. Signed-off-by: Xiaolei Wang Link: https://lore.kernel.org/r/20220825111922.1368055-1-xiaolei.wang@windr= iver.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/regulator/pfuze100-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfu= ze100-regulator.c index f873d97100e2..13609942d45c 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c @@ -788,7 +788,7 @@ static int pfuze100_regulator_probe(struct i2c_client *= client, ((pfuze_chip->chip_id =3D=3D PFUZE3000) ? "3000" : "3001")))); =20 memcpy(pfuze_chip->regulator_descs, pfuze_chip->pfuze_regulators, - sizeof(pfuze_chip->regulator_descs)); + regulator_num * sizeof(struct pfuze_regulator)); =20 ret =3D pfuze_parse_regulators_dt(pfuze_chip); if (ret) --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEFD3C32771 for ; Mon, 26 Sep 2022 10:36:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235967AbiIZKg3 (ORCPT ); Mon, 26 Sep 2022 06:36:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236021AbiIZKdw (ORCPT ); Mon, 26 Sep 2022 06:33:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40ED450196; Mon, 26 Sep 2022 03:20:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B674060B60; Mon, 26 Sep 2022 10:20:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6181C433D6; Mon, 26 Sep 2022 10:20:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187653; bh=11Vr/+rv4NoqlGZZbuKjZyicUsv1R4vQPEaYub1IdIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gRwpmPjrtj2BF1k5KRlSHIIVcI40NeNu61/ORsHr2ooZ76/0AC93pOKovZLqVMJGd SisYvsgYJnWX90WPW+0HAbEsEkE3I8t4pmJGhngGfgt5nbdEky98zEYjsxBZLOvr+L OwL5YOYaQL3SWQjHGvxMmtcMEN963GjGDHKq8Ayw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Sasha Levin Subject: [PATCH 5.4 018/120] rxrpc: Fix local destruction being repeated Date: Mon, 26 Sep 2022 12:10:51 +0200 Message-Id: <20220926100751.271312705@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Howells [ Upstream commit d3d863036d688313f8d566b87acd7d99daf82749 ] If the local processor work item for the rxrpc local endpoint gets requeued by an event (such as an incoming packet) between it getting scheduled for destruction and the UDP socket being closed, the rxrpc_local_destroyer() function can get run twice. The second time it can hang because it can end up waiting for cleanup events that will never happen. Signed-off-by: David Howells Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/rxrpc/local_object.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c index 01135e54d95d..fc784fcc3a94 100644 --- a/net/rxrpc/local_object.c +++ b/net/rxrpc/local_object.c @@ -448,6 +448,9 @@ static void rxrpc_local_processor(struct work_struct *w= ork) container_of(work, struct rxrpc_local, processor); bool again; =20 + if (local->dead) + return; + trace_rxrpc_local(local->debug_id, rxrpc_local_processing, atomic_read(&local->usage), NULL); =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EF6EC07E9D for ; Mon, 26 Sep 2022 10:36:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236005AbiIZKgd (ORCPT ); Mon, 26 Sep 2022 06:36:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236069AbiIZKeA (ORCPT ); Mon, 26 Sep 2022 06:34:00 -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 4FFE450536; Mon, 26 Sep 2022 03:20:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D46FF60BB1; Mon, 26 Sep 2022 10:20:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3475C433D6; Mon, 26 Sep 2022 10:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187658; bh=YMMAuHVuBVlqkhj3tEarEB5q1p39iQOnWCjOJtKu+K4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YgQR+mb56V8FvPhyfWbSyP078AiLAGlA/6FhR+pIaGO6heibpDWcria4SKpPeepiA 6YBjWHpLbNgSINd7wIklBuM2HjDA3z/ikdwmvGtYPcAlON4FEtozbaVx0Uw0pajfOX U4httd+TuRGmn3tcirOt7GPCMOkI5z3hiCnQ8yz4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Sasha Levin Subject: [PATCH 5.4 019/120] rxrpc: Fix calc of resend age Date: Mon, 26 Sep 2022 12:10:52 +0200 Message-Id: <20220926100751.304013914@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Howells [ Upstream commit 214a9dc7d852216e83acac7b75bc18f01ce184c2 ] Fix the calculation of the resend age to add a microsecond value as microseconds, not nanoseconds. Signed-off-by: David Howells Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/rxrpc/call_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c index 8574e7066d94..b5f173960725 100644 --- a/net/rxrpc/call_event.c +++ b/net/rxrpc/call_event.c @@ -166,7 +166,7 @@ static void rxrpc_resend(struct rxrpc_call *call, unsig= ned long now_j) _enter("{%d,%d}", call->tx_hard_ack, call->tx_top); =20 now =3D ktime_get_real(); - max_age =3D ktime_sub(now, jiffies_to_usecs(call->peer->rto_j)); + max_age =3D ktime_sub_us(now, jiffies_to_usecs(call->peer->rto_j)); =20 spin_lock_bh(&call->lock); =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4429C32771 for ; Mon, 26 Sep 2022 10:36:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236033AbiIZKgk (ORCPT ); Mon, 26 Sep 2022 06:36:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236105AbiIZKeI (ORCPT ); Mon, 26 Sep 2022 06:34: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 BB5B05071F; Mon, 26 Sep 2022 03:21: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 68E6360B60; Mon, 26 Sep 2022 10:21:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7629FC433D6; Mon, 26 Sep 2022 10:21:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187664; bh=vc2SaGyRnaZR4m3lZSMRuuhRvo3SBJwINntZoyb+sSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SZVcrOFO9I2tWZ1e6OsplpDTeqi+FyMEDcy92cTc09VjeGtN8z5FRkNqayZABr/+N 4ZcbXMRiTnhMcrmw2cyWKe7bymn3fzOH40QpTqOPevbkZfY9R1W1Yftm84qTJp5a7g UIVpVwQYGwucsLb7FMQ9ih40AP7ny7SwSlqh/hVo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 5.4 020/120] ALSA: hda/sigmatel: Keep power up while beep is enabled Date: Mon, 26 Sep 2022 12:10:53 +0200 Message-Id: <20220926100751.347617758@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit 414d38ba871092aeac4ed097ac4ced89486646f7 ] It seems that the beep playback doesn't work well on IDT codec devices when the codec auto-pm is enabled. Keep the power on while the beep switch is enabled. Link: https://bugzilla.suse.com/show_bug.cgi?id=3D1200544 Link: https://lore.kernel.org/r/20220904072750.26164-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_sigmatel.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index bfd3fe5eff31..7a8ecc21b347 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -209,6 +209,7 @@ struct sigmatel_spec { =20 /* beep widgets */ hda_nid_t anabeep_nid; + bool beep_power_on; =20 /* SPDIF-out mux */ const char * const *spdif_labels; @@ -4441,6 +4442,26 @@ static int stac_suspend(struct hda_codec *codec) stac_shutup(codec); return 0; } + +static int stac_check_power_status(struct hda_codec *codec, hda_nid_t nid) +{ + struct sigmatel_spec *spec =3D codec->spec; + int ret =3D snd_hda_gen_check_power_status(codec, nid); + +#ifdef CONFIG_SND_HDA_INPUT_BEEP + if (nid =3D=3D spec->gen.beep_nid && codec->beep) { + if (codec->beep->enabled !=3D spec->beep_power_on) { + spec->beep_power_on =3D codec->beep->enabled; + if (spec->beep_power_on) + snd_hda_power_up_pm(codec); + else + snd_hda_power_down_pm(codec); + } + ret |=3D spec->beep_power_on; + } +#endif + return ret; +} #else #define stac_suspend NULL #endif /* CONFIG_PM */ @@ -4453,6 +4474,7 @@ static const struct hda_codec_ops stac_patch_ops =3D { .unsol_event =3D snd_hda_jack_unsol_event, #ifdef CONFIG_PM .suspend =3D stac_suspend, + .check_power_status =3D stac_check_power_status, #endif .reboot_notify =3D stac_shutup, }; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34886C07E9D for ; Mon, 26 Sep 2022 10:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236055AbiIZKgx (ORCPT ); Mon, 26 Sep 2022 06:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236234AbiIZKe1 (ORCPT ); Mon, 26 Sep 2022 06:34: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 96F964B0E5; Mon, 26 Sep 2022 03:21: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 59432B80915; Mon, 26 Sep 2022 10:21:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A300AC433C1; Mon, 26 Sep 2022 10:21:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187668; bh=TdCfQyLqJOvLjXCjB0KIUoz/+y31ZtW2FxF/SkOgSh4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vElVgBVxGBDbXUqEBoPG88SklFwWs64KU+PfqOYBFGY9iSsvBVbZTvuU6gCt9sHk6 IKfXJBoA+gkOz37aC/dxjyOHUFoM/idgOgxVL4Ai+a8NH6uWrLF/hymWh/BfZKyjKf bwT+5gbiHssWlXRAH6ASQH5dvKmXLA/NrLPcdPOo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mohan Kumar , Takashi Iwai , Sasha Levin Subject: [PATCH 5.4 021/120] ALSA: hda/tegra: Align BDL entry to 4KB boundary Date: Mon, 26 Sep 2022 12:10:54 +0200 Message-Id: <20220926100751.389781960@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mohan Kumar [ Upstream commit 8d44e6044a0e885acdd01813768a0b27906d64fd ] AZA HW may send a burst read/write request crossing 4K memory boundary. The 4KB boundary is not guaranteed by Tegra HDA HW. Make SW change to include the flag AZX_DCAPS_4K_BDLE_BOUNDARY to align BDLE to 4K boundary. Signed-off-by: Mohan Kumar Link: https://lore.kernel.org/r/20220905172420.3801-1-mkumard@nvidia.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/hda_tegra.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 2971b34c87c1..e235c3ec634d 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -428,7 +428,8 @@ MODULE_DEVICE_TABLE(of, hda_tegra_match); static int hda_tegra_probe(struct platform_device *pdev) { const unsigned int driver_flags =3D AZX_DCAPS_CORBRP_SELF_CLEAR | - AZX_DCAPS_PM_RUNTIME; + AZX_DCAPS_PM_RUNTIME | + AZX_DCAPS_4K_BDLE_BOUNDARY; struct snd_card *card; struct azx *chip; struct hda_tegra *hda; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FEECC07E9D for ; Mon, 26 Sep 2022 10:36:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236029AbiIZKgh (ORCPT ); Mon, 26 Sep 2022 06:36:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236094AbiIZKeH (ORCPT ); Mon, 26 Sep 2022 06:34: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 5C36D51419; Mon, 26 Sep 2022 03:21: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 D61CD60BB1; Mon, 26 Sep 2022 10:21:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC5C3C433C1; Mon, 26 Sep 2022 10:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187671; bh=uUWHcUWBvnDVDeZ7BBNV3PTpQGI1NAAxX849kJe44sQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Ipl19/u2Z54ezcRpIcgtloV5B0TA9zHLMLJ0GYGusi/UP+kpMitv6iHSdTIosDG8 lbQ2yrd7OxKJXJ4Fv0lD7AL3H2O3/wdTb757zki2qY18HkqfpjpmboXjCrU7fUI9K9 Nz8HYKPgSYDcVdHbO0hExtNqMFPWmcMKDgmf3HQA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "jerry.meng" , =?UTF-8?q?Bj=C3=B8rn=20Mork?= , Paolo Abeni , Sasha Levin Subject: [PATCH 5.4 022/120] net: usb: qmi_wwan: add Quectel RM520N Date: Mon, 26 Sep 2022 12:10:55 +0200 Message-Id: <20220926100751.426999152@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: jerry.meng [ Upstream commit e1091e226a2bab4ded1fe26efba2aee1aab06450 ] add support for Quectel RM520N which is based on Qualcomm SDX62 chip. 0x0801: DIAG + NMEA + AT + MODEM + RMNET T: Bus=3D03 Lev=3D01 Prnt=3D01 Port=3D01 Cnt=3D02 Dev#=3D 10 Spd=3D480 Mx= Ch=3D 0 D: Ver=3D 2.10 Cls=3D00(>ifc ) Sub=3D00 Prot=3D00 MxPS=3D64 #Cfgs=3D 1 P: Vendor=3D2c7c ProdID=3D0801 Rev=3D 5.04 S: Manufacturer=3DQuectel S: Product=3DRM520N-GL S: SerialNumber=3D384af524 C:* #Ifs=3D 5 Cfg#=3D 1 Atr=3Da0 MxPwr=3D500mA I:* If#=3D 0 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3D30 Driver= =3Doption E: Ad=3D01(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D81(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 1 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D40 Driver= =3Doption E: Ad=3D83(I) Atr=3D03(Int.) MxPS=3D 10 Ivl=3D32ms E: Ad=3D82(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D02(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 2 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption E: Ad=3D85(I) Atr=3D03(Int.) MxPS=3D 10 Ivl=3D32ms E: Ad=3D84(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D03(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 3 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption E: Ad=3D87(I) Atr=3D03(Int.) MxPS=3D 10 Ivl=3D32ms E: Ad=3D86(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D04(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 4 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Dqmi_wwan E: Ad=3D88(I) Atr=3D03(Int.) MxPS=3D 8 Ivl=3D32ms E: Ad=3D8e(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D0f(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms Signed-off-by: jerry.meng Acked-by: Bj=C3=B8rn Mork Link: https://lore.kernel.org/r/tencent_E50CA8A206904897C2D20DDAE90731183C0= 5@qq.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 8ef0a013874c..cee90e505d17 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -1046,6 +1046,7 @@ static const struct usb_device_id products[] =3D { {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0620)}, /* Quectel EM160R-GL */ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */ + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0801)}, /* Quectel RM520N */ =20 /* 3. Combined interface devices matching on interface number */ {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18C49C32771 for ; Mon, 26 Sep 2022 10:37:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236083AbiIZKhJ (ORCPT ); Mon, 26 Sep 2022 06:37:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236291AbiIZKen (ORCPT ); Mon, 26 Sep 2022 06:34:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64CDC4A121; Mon, 26 Sep 2022 03:21:31 -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 756CCB80682; Mon, 26 Sep 2022 10:21:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D95EDC4314C; Mon, 26 Sep 2022 10:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187674; bh=u2rO/ercHtrvsYkINPsSjr86xEcZCu/JUchqEDLRKLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cdszsFlqTW7HZ+OS1DwkrzEAJEI0n9NOZr9qM0clkdJpq1CMJOFqyVgCEwxQWDep+ ADM2mYaz57l+2UhZXno528DFyZ7U+Em1mwnPmddN5x49lYHc0boMpiPiG+zOwyuHPj LbMVe3Zl+ROmpk+Mj9MTlkJsbQMNt7DpODVjNAlQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Jeffrey E Altman , Marc Dionne , linux-afs@lists.infradead.org, Linus Torvalds , Sasha Levin Subject: [PATCH 5.4 023/120] afs: Return -EAGAIN, not -EREMOTEIO, when a file already locked Date: Mon, 26 Sep 2022 12:10:56 +0200 Message-Id: <20220926100751.471507380@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Howells [ Upstream commit 0066f1b0e27556381402db3ff31f85d2a2265858 ] When trying to get a file lock on an AFS file, the server may return UAEAGAIN to indicate that the lock is already held. This is currently translated by the default path to -EREMOTEIO. Translate it instead to -EAGAIN so that we know we can retry it. Signed-off-by: David Howells Reviewed-by: Jeffrey E Altman cc: Marc Dionne cc: linux-afs@lists.infradead.org Link: https://lore.kernel.org/r/166075761334.3533338.2591992675160918098.st= git@warthog.procyon.org.uk/ Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/afs/misc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/afs/misc.c b/fs/afs/misc.c index 5334f1bd2bca..5171d6d99031 100644 --- a/fs/afs/misc.c +++ b/fs/afs/misc.c @@ -69,6 +69,7 @@ int afs_abort_to_error(u32 abort_code) /* Unified AFS error table */ case UAEPERM: return -EPERM; case UAENOENT: return -ENOENT; + case UAEAGAIN: return -EAGAIN; case UAEACCES: return -EACCES; case UAEBUSY: return -EBUSY; case UAEEXIST: return -EEXIST; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6108C07E9D for ; Mon, 26 Sep 2022 10:36:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236046AbiIZKgs (ORCPT ); Mon, 26 Sep 2022 06:36:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236182AbiIZKeU (ORCPT ); Mon, 26 Sep 2022 06:34:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5F075208B; Mon, 26 Sep 2022 03:21: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 E391160B60; Mon, 26 Sep 2022 10:21:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6827C433D6; Mon, 26 Sep 2022 10:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187677; bh=5QLnZeZk1iUlkHcoN3CoUqKZT2efnOAH3ucEpkO+tmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z0aDVjNFJ2jEflSOaKBGqgOLNrEz9ROMP7fL3h9u3M9NfRs4jXRTHofEscWFLM8WS lpONZrHEDN+CyEakMtLjmN8rGarm2i3fT3pWMMCdOaGspZMIEfnDu6aYyqEVyLPkNt n5VNmn0Ax8Xu+YzRCKRnyjFTUD8oZHQc6MghjfrA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Sverdlin , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.4 024/120] MIPS: OCTEON: irq: Fix octeon_irq_force_ciu_mapping() Date: Mon, 26 Sep 2022 12:10:57 +0200 Message-Id: <20220926100751.520562471@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Sverdlin [ Upstream commit ba912afbd611d3a5f22af247721a071ad1d5b9e0 ] For irq_domain_associate() to work the virq descriptor has to be pre-allocated in advance. Otherwise the following happens: WARNING: CPU: 0 PID: 0 at .../kernel/irq/irqdomain.c:527 irq_domain_associa= te+0x298/0x2e8 error: virq128 is not allocated Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.19.78-... #1 ... Call Trace: [] show_stack+0x9c/0x130 [] dump_stack+0x90/0xd0 [] __warn+0x118/0x130 [] warn_slowpath_fmt+0x4c/0x70 [] irq_domain_associate+0x298/0x2e8 [] octeon_irq_init_ciu+0x4c8/0x53c [] of_irq_init+0x1e0/0x388 [] init_IRQ+0x4c/0xf4 [] start_kernel+0x404/0x698 Use irq_alloc_desc_at() to avoid the above problem. Signed-off-by: Alexander Sverdlin Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/mips/cavium-octeon/octeon-irq.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon= /octeon-irq.c index 3ad1f76c063a..2d5e7b21d960 100644 --- a/arch/mips/cavium-octeon/octeon-irq.c +++ b/arch/mips/cavium-octeon/octeon-irq.c @@ -127,6 +127,16 @@ static void octeon_irq_free_cd(struct irq_domain *d, u= nsigned int irq) static int octeon_irq_force_ciu_mapping(struct irq_domain *domain, int irq, int line, int bit) { + struct device_node *of_node; + int ret; + + of_node =3D irq_domain_get_of_node(domain); + if (!of_node) + return -EINVAL; + ret =3D irq_alloc_desc_at(irq, of_node_to_nid(of_node)); + if (ret < 0) + return ret; + return irq_domain_associate(domain, irq, line << 6 | bit); } =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44755C32771 for ; Mon, 26 Sep 2022 10:37:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236078AbiIZKhF (ORCPT ); Mon, 26 Sep 2022 06:37:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236271AbiIZKec (ORCPT ); Mon, 26 Sep 2022 06:34:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56A5F5244F; Mon, 26 Sep 2022 03:21: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 ams.source.kernel.org (Postfix) with ESMTPS id 8DCB8B80835; Mon, 26 Sep 2022 10:21:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE502C433D6; Mon, 26 Sep 2022 10:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187680; bh=4rwkvD/DNcjNXfcsWGkTsOeqnSDE+8I7hUNF1BK6CT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q17Wk631CulZmLU3YU5NX2HDqkv7gYzOMd/6AFlFB0uMVWj81GNyE00Ha6A3/cVRr z4/ArQ5niZDvIrEMpgyR/s2fjk9F2UdANbEgZhSHIH39DF4WWp2NasOkmTRGcWMQ1h 2p2fyYHMRkDUY6S+abA4xcgGwsrWtX9MwUsfNIP8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Youling Tang , Masahiro Yamada , Sasha Levin Subject: [PATCH 5.4 025/120] mksysmap: Fix the mismatch of L0 symbols in System.map Date: Mon, 26 Sep 2022 12:10:58 +0200 Message-Id: <20220926100751.549437084@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Youling Tang [ Upstream commit c17a2538704f926ee4d167ba625e09b1040d8439 ] When System.map was generated, the kernel used mksysmap to filter the kernel symbols, we need to filter "L0" symbols in LoongArch architecture. $ cat System.map | grep L0 9000000000221540 t L0 The L0 symbol exists in System.map, but not in .tmp_System.map. When "cmp -s System.map .tmp_System.map" will show "Inconsistent kallsyms data" error message in link-vmlinux.sh script. Signed-off-by: Youling Tang Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- scripts/mksysmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mksysmap b/scripts/mksysmap index 9aa23d15862a..ad8bbc52267d 100755 --- a/scripts/mksysmap +++ b/scripts/mksysmap @@ -41,4 +41,4 @@ # so we just ignore them to let readprofile continue to work. # (At least sparc64 has __crc_ in the middle). =20 -$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)' > $2 +$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)\|\( = L0\)' > $2 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F2DFC32771 for ; Mon, 26 Sep 2022 10:37:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236106AbiIZKhV (ORCPT ); Mon, 26 Sep 2022 06:37:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236366AbiIZKe6 (ORCPT ); Mon, 26 Sep 2022 06:34:58 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33903474EB; Mon, 26 Sep 2022 03:21: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 sin.source.kernel.org (Postfix) with ESMTPS id EF3A5CE10E0; Mon, 26 Sep 2022 10:21:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEAA4C433D6; Mon, 26 Sep 2022 10:21:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187683; bh=Kqi3E0HjV/M/rUHNNJDAxMFwMxUuQgRy5Fn4G8zuY/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g52UnrWO5RTbOxRs7aQDqttmgUcFWo/V7HuqY3upC2F0edqQt6xhPhhxGnq7tunln YRv2cJu8JJMHxzWavtQwyydVkRdIBCznAv9zrYvCNRSofEuoKkDTMZLrm77EDxxPI1 L9sMzBELwsEXeXPPdyD0/jW/fmCHh84l8tTV3lw4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunwoo Kim , Helge Deller , Sasha Levin Subject: [PATCH 5.4 026/120] video: fbdev: pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write Date: Mon, 26 Sep 2022 12:10:59 +0200 Message-Id: <20220926100751.596636025@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hyunwoo Kim [ Upstream commit a09d2d00af53b43c6f11e6ab3cb58443c2cac8a7 ] In pxa3xx_gcu_write, a count parameter of type size_t is passed to words of type int. Then, copy_from_user() may cause a heap overflow because it is u= sed as the third argument of copy_from_user(). Signed-off-by: Hyunwoo Kim Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/video/fbdev/pxa3xx-gcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-= gcu.c index 7c4694d70dac..15162b37f302 100644 --- a/drivers/video/fbdev/pxa3xx-gcu.c +++ b/drivers/video/fbdev/pxa3xx-gcu.c @@ -382,7 +382,7 @@ pxa3xx_gcu_write(struct file *file, const char *buff, struct pxa3xx_gcu_batch *buffer; struct pxa3xx_gcu_priv *priv =3D to_pxa3xx_gcu_priv(file); =20 - int words =3D count / 4; + size_t words =3D count / 4; =20 /* Does not need to be atomic. There's a lock in user space, * but anyhow, this is just for statistics. */ --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48BD7C32771 for ; Mon, 26 Sep 2022 10:37:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236100AbiIZKhS (ORCPT ); Mon, 26 Sep 2022 06:37:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236345AbiIZKez (ORCPT ); Mon, 26 Sep 2022 06:34:55 -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 400CF52445; Mon, 26 Sep 2022 03:21:31 -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 C9367B80930; Mon, 26 Sep 2022 10:21:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 171C7C433C1; Mon, 26 Sep 2022 10:21:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187686; bh=Ji2r6XNoEewK9dXzBsIN8hQ9R8TMbrYeQHGZa3VUuHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1m2Q9jpRk4bFJrzVybIZ9DB/jOiOjy3owfUChDA9CMt/5pS3/OHyAZQbcMWHg9Ngb Fi5lMQS2/+QpvOI6z9O8kDzs70wjTAyOmSvPo6XBzlCxLU8at/pqO1WPa87nBb0n8b BHbhtkSpyZ/YnoZFE+RqhJbF+Vpr2vJYgCMeIYgg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Tejun Heo Subject: [PATCH 5.4 027/120] cgroup: Add missing cpus_read_lock() to cgroup_attach_task_all() Date: Mon, 26 Sep 2022 12:11:00 +0200 Message-Id: <20220926100751.633857388@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tetsuo Handa commit 43626dade36fa74d3329046f4ae2d7fdefe401c6 upstream. syzbot is hitting percpu_rwsem_assert_held(&cpu_hotplug_lock) warning at cpuset_attach() [1], for commit 4f7e7236435ca0ab ("cgroup: Fix threadgroup_rwsem <-> cpus_read_lock() deadlock") missed that cpuset_attach() is also called from cgroup_attach_task_all(). Add cpus_read_lock() like what cgroup_procs_write_start() does. Link: https://syzkaller.appspot.com/bug?extid=3D29d3a3b4d86c8136ad9e [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Fixes: 4f7e7236435ca0ab ("cgroup: Fix threadgroup_rwsem <-> cpus_read_lock(= ) deadlock") Signed-off-by: Tejun Heo Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/cgroup/cgroup-v1.c | 3 +++ 1 file changed, 3 insertions(+) --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -15,6 +15,7 @@ #include #include #include +#include =20 #include =20 @@ -62,6 +63,7 @@ int cgroup_attach_task_all(struct task_s int retval =3D 0; =20 mutex_lock(&cgroup_mutex); + cpus_read_lock(); percpu_down_write(&cgroup_threadgroup_rwsem); for_each_root(root) { struct cgroup *from_cgrp; @@ -78,6 +80,7 @@ int cgroup_attach_task_all(struct task_s break; } percpu_up_write(&cgroup_threadgroup_rwsem); + cpus_read_unlock(); mutex_unlock(&cgroup_mutex); =20 return retval; From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26643C07E9D for ; Mon, 26 Sep 2022 10:37:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236063AbiIZKg6 (ORCPT ); Mon, 26 Sep 2022 06:36:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236260AbiIZKeb (ORCPT ); Mon, 26 Sep 2022 06:34:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E50BD520BD; Mon, 26 Sep 2022 03:21:31 -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 56FE560687; Mon, 26 Sep 2022 10:21:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6847DC433D7; Mon, 26 Sep 2022 10:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187689; bh=1Yxffo6S0sxdEzmShPd7nwhUaHoU5kt7FLFKSwqHfpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WFmPzTetcl89O073mnAmnj6w/25lgZ8CCM4Wj1DCJXSI/D2ZBphVacuk1aajbI2za oLq5wtwlx7wcCuy9abMGS/Z5G4Lq33WX5izAMItlpUyDWqVsQK1/M9wESbD/1+N5lM 5Jllj9EeKVTkQ54nJ5N+dcdwM3ikP5Hkv0C61t8A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Takashi Iwai Subject: [PATCH 5.4 028/120] ALSA: hda/sigmatel: Fix unused variable warning for beep power change Date: Mon, 26 Sep 2022 12:11:01 +0200 Message-Id: <20220926100751.680244014@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai commit 51bdc8bb82525cd70feb92279c8b7660ad7948dd upstream. The newly added stac_check_power_status() caused a compile warning when CONFIG_SND_HDA_INPUT_BEEP is disabled. Fix it. Fixes: 414d38ba8710 ("ALSA: hda/sigmatel: Keep power up while beep is enabl= ed") Reported-by: kernel test robot Link: https://lore.kernel.org/r/20220905130630.2845-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_sigmatel.c | 2 ++ 1 file changed, 2 insertions(+) --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4445,7 +4445,9 @@ static int stac_suspend(struct hda_codec =20 static int stac_check_power_status(struct hda_codec *codec, hda_nid_t nid) { +#ifdef CONFIG_SND_HDA_INPUT_BEEP struct sigmatel_spec *spec =3D codec->spec; +#endif int ret =3D snd_hda_gen_check_power_status(codec, nid); =20 #ifdef CONFIG_SND_HDA_INPUT_BEEP From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BDB8C07E9D for ; Mon, 26 Sep 2022 10:37:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235004AbiIZKhC (ORCPT ); Mon, 26 Sep 2022 06:37:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236269AbiIZKec (ORCPT ); Mon, 26 Sep 2022 06:34:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 818644AD5F; Mon, 26 Sep 2022 03:21:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 91EEF60AD6; Mon, 26 Sep 2022 10:21:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84272C4314C; Mon, 26 Sep 2022 10:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187693; bh=hySRG2UVRTaeI4Q4gk6xmE/6JOw27WgqZsbbmA+cNNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i0iTH3HpZBLkFVLzKE9UFVrQHWc5WyvfajLWkMFqtDgUVAiG/yLwOMpd/btQ0xaEc 9h+ujXZBIfhhULU+uuU+05rm28Yhsqz8+Mkj67ikx+xMDq4qFnoQ9xmBAv/7Dpb3YV dxN21RfQEo9GqVPNfmAwT2BvynUDtQezwbmkHaao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felipe Balbi , Wesley Cheng , Sasha Levin Subject: [PATCH 5.4 029/120] usb: dwc3: gadget: Avoid starting DWC3 gadget during UDC unbind Date: Mon, 26 Sep 2022 12:11:02 +0200 Message-Id: <20220926100751.719085566@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wesley Cheng [ Upstream commit 8217f07a50236779880f13e87f99224cd9117f83 ] There is a race present where the DWC3 runtime resume runs in parallel to the UDC unbind sequence. This will eventually lead to a possible scenario where we are enabling the run/stop bit, without a valid composition defined. Thread#1 (handling UDC unbind): usb_gadget_remove_driver() -->usb_gadget_disconnect() -->dwc3_gadget_pullup(0) --> continue UDC unbind sequence -->Thread#2 is running in parallel here Thread#2 (handing next cable connect) __dwc3_set_mode() -->pm_runtime_get_sync() -->dwc3_gadget_resume() -->dwc->gadget_driver is NOT NULL yet -->dwc3_gadget_run_stop(1) --> _dwc3gadget_start() ... Fix this by tracking the pullup disable routine, and avoiding resuming of the DWC3 gadget. Once the UDC is re-binded, that will trigger the pullup enable routine, which would handle enabling the DWC3 gadget. Acked-by: Felipe Balbi Signed-off-by: Wesley Cheng Link: https://lore.kernel.org/r/20210917021852.2037-1-wcheng@codeaurora.org Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 040f2dbd2010 ("usb: dwc3: gadget: Avoid duplicate requests t= o enable Run/Stop") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/dwc3/core.h | 2 ++ drivers/usb/dwc3/gadget.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index da296f888f45..a93c61bc5a7d 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -994,6 +994,7 @@ struct dwc3_scratchpad_array { * @tx_max_burst_prd: max periodic ESS transmit burst size * @hsphy_interface: "utmi" or "ulpi" * @connected: true when we're connected to a host, false otherwise + * @softconnect: true when gadget connect is called, false when disconnect= runs * @delayed_status: true when gadget driver asks for delayed status * @ep0_bounced: true when we used bounce buffer * @ep0_expect_in: true when we expect a DATA IN transfer @@ -1196,6 +1197,7 @@ struct dwc3 { const char *hsphy_interface; =20 unsigned connected:1; + unsigned softconnect:1; unsigned delayed_status:1; unsigned ep0_bounced:1; unsigned ep0_expect_in:1; diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 80fee7ea83ca..079919b85d87 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2015,7 +2015,7 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, i= nt is_on) int ret; =20 is_on =3D !!is_on; - + dwc->softconnect =3D is_on; /* * Per databook, when we want to stop the gadget, if a control transfer * is still in process, complete it and get the core into setup phase. @@ -3791,7 +3791,7 @@ int dwc3_gadget_resume(struct dwc3 *dwc) { int ret; =20 - if (!dwc->gadget_driver) + if (!dwc->gadget_driver || !dwc->softconnect) return 0; =20 ret =3D __dwc3_gadget_start(dwc); --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85FD7C32771 for ; Mon, 26 Sep 2022 10:37:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235816AbiIZKhd (ORCPT ); Mon, 26 Sep 2022 06:37:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235908AbiIZKfZ (ORCPT ); Mon, 26 Sep 2022 06:35:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A6D252810; Mon, 26 Sep 2022 03:21: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 ams.source.kernel.org (Postfix) with ESMTPS id 90954B80915; Mon, 26 Sep 2022 10:21:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0E23C433C1; Mon, 26 Sep 2022 10:21:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187699; bh=vurixT+IAkm87enXMQlTqreARwuSLXbBG6K3jdg9MvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uhY1KGbUHujO75XmDf4TFZlO959xaFXPj3HWSUWHjeg/4RYrByMnak5BUrfF43N3o 1XMwuTEWniPDxLk++v1d6WJWtT4UUmOMfsFK4Xpjb4q4Ra3EPzYaPT7o1BUhLiGI6D x0agu5cduZgvkuu/6ORA9X4/oH8UGFvuTN6ocv5E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen , Wesley Cheng , Sasha Levin Subject: [PATCH 5.4 030/120] usb: dwc3: Issue core soft reset before enabling run/stop Date: Mon, 26 Sep 2022 12:11:03 +0200 Message-Id: <20220926100751.752939929@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wesley Cheng [ Upstream commit 0066472de157439d58454f4a55786f1045ea5681 ] It is recommended by the Synopsis databook to issue a DCTL.CSftReset when reconnecting from a device-initiated disconnect routine. This resolves issues with enumeration during fast composition switching cases, which result in an unknown device on the host. Reviewed-by: Thinh Nguyen Signed-off-by: Wesley Cheng Link: https://lore.kernel.org/r/20220316011358.3057-1-quic_wcheng@quicinc.c= om Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 040f2dbd2010 ("usb: dwc3: gadget: Avoid duplicate requests t= o enable Run/Stop") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/dwc3/core.c | 2 +- drivers/usb/dwc3/core.h | 2 ++ drivers/usb/dwc3/gadget.c | 11 +++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index f4655665a1b5..a9c49b2ce511 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -227,7 +227,7 @@ u32 dwc3_core_fifo_space(struct dwc3_ep *dep, u8 type) * dwc3_core_soft_reset - Issues core soft reset and PHY reset * @dwc: pointer to our context structure */ -static int dwc3_core_soft_reset(struct dwc3 *dwc) +int dwc3_core_soft_reset(struct dwc3 *dwc) { u32 reg; int retries =3D 1000; diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index a93c61bc5a7d..f320b989abd2 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -1422,6 +1422,8 @@ bool dwc3_has_imod(struct dwc3 *dwc); int dwc3_event_buffers_setup(struct dwc3 *dwc); void dwc3_event_buffers_cleanup(struct dwc3 *dwc); =20 +int dwc3_core_soft_reset(struct dwc3 *dwc); + #if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_RO= LE) int dwc3_host_init(struct dwc3 *dwc); void dwc3_host_exit(struct dwc3 *dwc); diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 079919b85d87..b95fc2ae8074 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2088,6 +2088,17 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, = int is_on) dwc->ev_buf->length; } } else { + /* + * In the Synopsys DWC_usb31 1.90a programming guide section + * 4.1.9, it specifies that for a reconnect after a + * device-initiated disconnect requires a core soft reset + * (DCTL.CSftRst) before enabling the run/stop bit. + */ + spin_unlock_irqrestore(&dwc->lock, flags); + dwc3_core_soft_reset(dwc); + spin_lock_irqsave(&dwc->lock, flags); + + dwc3_event_buffers_setup(dwc); __dwc3_gadget_start(dwc); } =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB62FC6FA86 for ; Mon, 26 Sep 2022 10:37:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236096AbiIZKhO (ORCPT ); Mon, 26 Sep 2022 06:37:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236341AbiIZKez (ORCPT ); Mon, 26 Sep 2022 06:34:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FA985280E; Mon, 26 Sep 2022 03:21:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F3CF060AD6; Mon, 26 Sep 2022 10:21:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA674C433D6; Mon, 26 Sep 2022 10:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187702; bh=Pa5i3GQRHsWpE8E+c1IYzrtig35n9v6kEKTYiDx+02o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QAWxXZsnY3yJV6PHMi9CS/vti0RSt30BG/QJPysCTyt2gFcNImVDJLXDMGCJrfc8w DZJEyvv/fS+7N2da11hikydO1ePAg5mzT5G6eCvzrr+pbQvq8/7auuf1Ys8hcVfnta EzYTRr5vRXEWCV36LwMTRzcSFx5HkXsUHrndj0YI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen , Sasha Levin Subject: [PATCH 5.4 031/120] usb: dwc3: gadget: Prevent repeat pullup() Date: Mon, 26 Sep 2022 12:11:04 +0200 Message-Id: <20220926100751.792836346@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thinh Nguyen [ Upstream commit 69e131d1ac4e52a59ec181ab4f8aa8c48cd8fb64 ] Don't do soft-disconnect if it's previously done. Likewise, don't do soft-connect if the device is currently connected and running. It would break normal operation. Currently the caller of pullup() (udc's sysfs soft_connect) only checks if it had initiated disconnect to prevent repeating soft-disconnect. It doesn't check for soft-connect. To be safe, let's keep the check here regardless whether the udc core is fixed. Signed-off-by: Thinh Nguyen Link: https://lore.kernel.org/r/1c1345bd66c97a9d32f77d63aaadd04b7b037143.16= 50593829.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 040f2dbd2010 ("usb: dwc3: gadget: Avoid duplicate requests t= o enable Run/Stop") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/dwc3/gadget.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index b95fc2ae8074..ea56f4fb234e 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2015,6 +2015,10 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, = int is_on) int ret; =20 is_on =3D !!is_on; + + if (dwc->pullups_connected =3D=3D is_on) + return 0; + dwc->softconnect =3D is_on; /* * Per databook, when we want to stop the gadget, if a control transfer --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AF9EC32771 for ; Mon, 26 Sep 2022 10:37:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235991AbiIZKhl (ORCPT ); Mon, 26 Sep 2022 06:37:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235928AbiIZKf3 (ORCPT ); Mon, 26 Sep 2022 06:35:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03C5A4B0EC; Mon, 26 Sep 2022 03:21:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D824F60BB1; Mon, 26 Sep 2022 10:21:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2E09C433D7; Mon, 26 Sep 2022 10:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187705; bh=/wbhLBoU0qvXpttVO+bWXQUXq4lVO5MWkMqUzD+B8Lg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TG61GHodY995W4WVNiqwSsNCtx/M6wVWr6l5+qwhr4yZeN+LDTS5Gdl25C2l6TjCP kp+NNd1GM/3lC1jy0K+z+OGQfT52/T5lxGtmtGmrH+QDv19JYd+yYv9yLTS2cDgPXS rAw2m5sAnRR/Q5jPsfSlORd+v9G5j0WEm9bQMy54= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen , Sasha Levin Subject: [PATCH 5.4 032/120] usb: dwc3: gadget: Refactor pullup() Date: Mon, 26 Sep 2022 12:11:05 +0200 Message-Id: <20220926100751.832849301@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thinh Nguyen [ Upstream commit 861c010a2ee1bc4a66d23f0da4aa22e75d8eaa24 ] Move soft-disconnect sequence out of dwc3_gadget_pullup(). No functional change here. Signed-off-by: Thinh Nguyen Link: https://lore.kernel.org/r/4c0f259b17d95acaaa931f90276683a48a32fe22.16= 50593829.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 040f2dbd2010 ("usb: dwc3: gadget: Avoid duplicate requests t= o enable Run/Stop") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/dwc3/gadget.c | 65 ++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index ea56f4fb234e..9a7656d01d06 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2008,6 +2008,40 @@ static void dwc3_gadget_disable_irq(struct dwc3 *dwc= ); static void __dwc3_gadget_stop(struct dwc3 *dwc); static int __dwc3_gadget_start(struct dwc3 *dwc); =20 +static int dwc3_gadget_soft_disconnect(struct dwc3 *dwc) +{ + u32 count; + + dwc->connected =3D false; + + /* + * In the Synopsys DesignWare Cores USB3 Databook Rev. 3.30a + * Section 4.1.8 Table 4-7, it states that for a device-initiated + * disconnect, the SW needs to ensure that it sends "a DEPENDXFER + * command for any active transfers" before clearing the RunStop + * bit. + */ + dwc3_stop_active_transfers(dwc); + __dwc3_gadget_stop(dwc); + + /* + * In the Synopsys DesignWare Cores USB3 Databook Rev. 3.30a + * Section 1.3.4, it mentions that for the DEVCTRLHLT bit, the + * "software needs to acknowledge the events that are generated + * (by writing to GEVNTCOUNTn) while it is waiting for this bit + * to be set to '1'." + */ + count =3D dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0)); + count &=3D DWC3_GEVNTCOUNT_MASK; + if (count > 0) { + dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), count); + dwc->ev_buf->lpos =3D (dwc->ev_buf->lpos + count) % + dwc->ev_buf->length; + } + + return dwc3_gadget_run_stop(dwc, false, false); +} + static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) { struct dwc3 *dwc =3D gadget_to_dwc(g); @@ -2064,33 +2098,7 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, = int is_on) spin_lock_irqsave(&dwc->lock, flags); =20 if (!is_on) { - u32 count; - - dwc->connected =3D false; - /* - * In the Synopsis DesignWare Cores USB3 Databook Rev. 3.30a - * Section 4.1.8 Table 4-7, it states that for a device-initiated - * disconnect, the SW needs to ensure that it sends "a DEPENDXFER - * command for any active transfers" before clearing the RunStop - * bit. - */ - dwc3_stop_active_transfers(dwc); - __dwc3_gadget_stop(dwc); - - /* - * In the Synopsis DesignWare Cores USB3 Databook Rev. 3.30a - * Section 1.3.4, it mentions that for the DEVCTRLHLT bit, the - * "software needs to acknowledge the events that are generated - * (by writing to GEVNTCOUNTn) while it is waiting for this bit - * to be set to '1'." - */ - count =3D dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0)); - count &=3D DWC3_GEVNTCOUNT_MASK; - if (count > 0) { - dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), count); - dwc->ev_buf->lpos =3D (dwc->ev_buf->lpos + count) % - dwc->ev_buf->length; - } + ret =3D dwc3_gadget_soft_disconnect(dwc); } else { /* * In the Synopsys DWC_usb31 1.90a programming guide section @@ -2104,9 +2112,8 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, i= nt is_on) =20 dwc3_event_buffers_setup(dwc); __dwc3_gadget_start(dwc); + ret =3D dwc3_gadget_run_stop(dwc, true, false); } - - ret =3D dwc3_gadget_run_stop(dwc, is_on, false); spin_unlock_irqrestore(&dwc->lock, flags); enable_irq(dwc->irq_gadget); =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FC91C07E9D for ; Mon, 26 Sep 2022 10:37:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236013AbiIZKhp (ORCPT ); Mon, 26 Sep 2022 06:37:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235903AbiIZKft (ORCPT ); Mon, 26 Sep 2022 06:35:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 797D052450; Mon, 26 Sep 2022 03:21:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1ED0360AD6; Mon, 26 Sep 2022 10:21:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A0CEC43142; Mon, 26 Sep 2022 10:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187708; bh=Ul4PQdwuWMICv89e1uXKyk4FfSNX02hYhfBaPxAydIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aNlIlxiUdpDNX1N7rtRzRDE5OYa0JsKuXhZbXp0NDwlVUqNdRvXbRUWlwn8HLaSAc X3b1YRq10wnRoLderqzXoJrsSLmcUT9KwtEGY1ds7RkIa1pae12usoZB9gdANA2fuG 2OfixC40p9E9++bHjsA3QH04IVm1fK7Xtn8Khnio= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen , Sasha Levin Subject: [PATCH 5.4 033/120] usb: dwc3: gadget: Dont modify GEVNTCOUNT in pullup() Date: Mon, 26 Sep 2022 12:11:06 +0200 Message-Id: <20220926100751.874427926@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thinh Nguyen [ Upstream commit 8f8034f493b5eb1ad21ff392fd30c0cf9e71f73f ] If the GEVNTCOUNT indicates events in the event buffer, the driver needs to acknowledge them before the controller can halt. Simply let the interrupt handler acknowledges the remaining event generated by the controller while polling for DSTS.DEVCTLHLT. This avoids disabling irq and taking care of race condition between the interrupt handlers and pullup(). Signed-off-by: Thinh Nguyen Link: https://lore.kernel.org/r/ea306ec93c41ccafbdb5d16404ff3b6eca299613.16= 50593829.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 040f2dbd2010 ("usb: dwc3: gadget: Avoid duplicate requests t= o enable Run/Stop") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/dwc3/gadget.c | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 9a7656d01d06..4f3548c682ec 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2010,8 +2010,9 @@ static int __dwc3_gadget_start(struct dwc3 *dwc); =20 static int dwc3_gadget_soft_disconnect(struct dwc3 *dwc) { - u32 count; + unsigned long flags; =20 + spin_lock_irqsave(&dwc->lock, flags); dwc->connected =3D false; =20 /* @@ -2023,29 +2024,21 @@ static int dwc3_gadget_soft_disconnect(struct dwc3 = *dwc) */ dwc3_stop_active_transfers(dwc); __dwc3_gadget_stop(dwc); + spin_unlock_irqrestore(&dwc->lock, flags); =20 /* - * In the Synopsys DesignWare Cores USB3 Databook Rev. 3.30a - * Section 1.3.4, it mentions that for the DEVCTRLHLT bit, the - * "software needs to acknowledge the events that are generated - * (by writing to GEVNTCOUNTn) while it is waiting for this bit - * to be set to '1'." + * Note: if the GEVNTCOUNT indicates events in the event buffer, the + * driver needs to acknowledge them before the controller can halt. + * Simply let the interrupt handler acknowledges and handle the + * remaining event generated by the controller while polling for + * DSTS.DEVCTLHLT. */ - count =3D dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0)); - count &=3D DWC3_GEVNTCOUNT_MASK; - if (count > 0) { - dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), count); - dwc->ev_buf->lpos =3D (dwc->ev_buf->lpos + count) % - dwc->ev_buf->length; - } - return dwc3_gadget_run_stop(dwc, false, false); } =20 static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) { struct dwc3 *dwc =3D gadget_to_dwc(g); - unsigned long flags; int ret; =20 is_on =3D !!is_on; @@ -2089,14 +2082,6 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, = int is_on) return 0; } =20 - /* - * Synchronize and disable any further event handling while controller - * is being enabled/disabled. - */ - disable_irq(dwc->irq_gadget); - - spin_lock_irqsave(&dwc->lock, flags); - if (!is_on) { ret =3D dwc3_gadget_soft_disconnect(dwc); } else { @@ -2106,16 +2091,12 @@ static int dwc3_gadget_pullup(struct usb_gadget *g,= int is_on) * device-initiated disconnect requires a core soft reset * (DCTL.CSftRst) before enabling the run/stop bit. */ - spin_unlock_irqrestore(&dwc->lock, flags); dwc3_core_soft_reset(dwc); - spin_lock_irqsave(&dwc->lock, flags); =20 dwc3_event_buffers_setup(dwc); __dwc3_gadget_start(dwc); ret =3D dwc3_gadget_run_stop(dwc, true, false); } - spin_unlock_irqrestore(&dwc->lock, flags); - enable_irq(dwc->irq_gadget); =20 pm_runtime_put(dwc->dev); =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3FB4C32771 for ; Mon, 26 Sep 2022 10:45:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234582AbiIZKpB (ORCPT ); Mon, 26 Sep 2022 06:45:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236407AbiIZKmh (ORCPT ); Mon, 26 Sep 2022 06:42:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76EC44D17B; Mon, 26 Sep 2022 03:24: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 76044B80930; Mon, 26 Sep 2022 10:24:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3B54C433D6; Mon, 26 Sep 2022 10:23:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187839; bh=ZSskpJgtA2NwzEZp0o6DuEFoB4QGd2uRPJqxfCClm+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zbEPrAMmF1AIYMZ+8UfYk9gt3GtI+90FIkZs/hOlQkP4eGePOpoG1IlwrmqaJHsLh 4+NngPnsQLyUJYAiDD9t0w0C/fQkEVTTWLGeDGtQ8zuf6GDFZL2n1qNeqQ5hideT9v 6VKP1AvFcNr5hCrbDjn28qsHGEsrv9BHSMK8Bm5g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Wesley Cheng , Sasha Levin Subject: [PATCH 5.4 034/120] usb: dwc3: gadget: Avoid duplicate requests to enable Run/Stop Date: Mon, 26 Sep 2022 12:11:07 +0200 Message-Id: <20220926100751.912849422@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wesley Cheng [ Upstream commit 040f2dbd2010c43f33ad27249e6dac48456f4d99 ] Relocate the pullups_connected check until after it is ensured that there are no runtime PM transitions. If another context triggered the DWC3 core's runtime resume, it may have already enabled the Run/Stop. Do not re-run the entire pullup sequence again, as it may issue a core soft reset while Run/Stop is already set. This patch depends on commit 69e131d1ac4e ("usb: dwc3: gadget: Prevent repeat pullup()") Fixes: 77adb8bdf422 ("usb: dwc3: gadget: Allow runtime suspend if UDC unbin= ded") Cc: stable Signed-off-by: Wesley Cheng Link: https://lore.kernel.org/r/20220728020647.9377-1-quic_wcheng@quicinc.c= om Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/dwc3/gadget.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 4f3548c682ec..a40935f3592b 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2043,9 +2043,6 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, i= nt is_on) =20 is_on =3D !!is_on; =20 - if (dwc->pullups_connected =3D=3D is_on) - return 0; - dwc->softconnect =3D is_on; /* * Per databook, when we want to stop the gadget, if a control transfer @@ -2082,6 +2079,11 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, = int is_on) return 0; } =20 + if (dwc->pullups_connected =3D=3D is_on) { + pm_runtime_put(dwc->dev); + return 0; + } + if (!is_on) { ret =3D dwc3_gadget_soft_disconnect(dwc); } else { --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07F42C6FA83 for ; Mon, 26 Sep 2022 10:40:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236164AbiIZKkT (ORCPT ); Mon, 26 Sep 2022 06:40:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236045AbiIZKiB (ORCPT ); Mon, 26 Sep 2022 06:38: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 840AF52E6C; Mon, 26 Sep 2022 03:22: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 F2232B80936; Mon, 26 Sep 2022 10:22:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49AC2C433D6; Mon, 26 Sep 2022 10:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187733; bh=ElTOm2klxt85X0JKP/M2Yk+rb6HfPWLLC4D5yGfyYP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vbar4Uq/iRbJ/WgDZz/T/sSI/Sbv2LnOohjCdcaZBXtCHTIpzsqvPWDSV8eGVSOYk JJ5+P4ZPC2lwTqA9u38tCi98a/iwy8KIh/B7q0BlAxdSCzOGQv2FO69lZK/fwbFvdt AFez0BarBrArSSad/JlKjs9oJFiTqND3YA1VNA2Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunfeng Yun , Sasha Levin Subject: [PATCH 5.4 035/120] usb: xhci-mtk: get the microframe boundary for ESIT Date: Mon, 26 Sep 2022 12:11:08 +0200 Message-Id: <20220926100751.960890388@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chunfeng Yun [ Upstream commit 7c986fbc16ae6b2f914a3ebf06a3a4a8d9bb0b7c ] Tune the boundary for FS/LS ESIT due to CS: For ISOC out-ep, the controller starts transfer data after the first SS; for others, the data is already transferred before the last CS. Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/49e5a269a47984f3126a70c3fb471b0c2874b8c2.16= 15170625.git.chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 548011957d1d ("usb: xhci-mtk: relax TT periodic bandwidth al= location") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/host/xhci-mtk-sch.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sc= h.c index 8950d1f10a7f..450fa22b7dc7 100644 --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -513,22 +513,35 @@ static void update_sch_tt(struct usb_device *udev, list_del(&sch_ep->tt_endpoint); } =20 +static u32 get_esit_boundary(struct mu3h_sch_ep_info *sch_ep) +{ + u32 boundary =3D sch_ep->esit; + + if (sch_ep->sch_tt) { /* LS/FS with TT */ + /* tune for CS */ + if (sch_ep->ep_type !=3D ISOC_OUT_EP) + boundary++; + else if (boundary > 1) /* normally esit >=3D 8 for FS/LS */ + boundary--; + } + + return boundary; +} + static int check_sch_bw(struct usb_device *udev, struct mu3h_sch_bw_info *sch_bw, struct mu3h_sch_ep_info *sch_ep) { u32 offset; - u32 esit; u32 min_bw; u32 min_index; u32 worst_bw; u32 bw_boundary; + u32 esit_boundary; u32 min_num_budget; u32 min_cs_count; bool tt_offset_ok =3D false; int ret; =20 - esit =3D sch_ep->esit; - /* * Search through all possible schedule microframes. * and find a microframe where its worst bandwidth is minimum. @@ -537,7 +550,8 @@ static int check_sch_bw(struct usb_device *udev, min_index =3D 0; min_cs_count =3D sch_ep->cs_count; min_num_budget =3D sch_ep->num_budget_microframes; - for (offset =3D 0; offset < esit; offset++) { + esit_boundary =3D get_esit_boundary(sch_ep); + for (offset =3D 0; offset < sch_ep->esit; offset++) { if (is_fs_or_ls(udev->speed)) { ret =3D check_sch_tt(udev, sch_ep, offset); if (ret) @@ -546,7 +560,7 @@ static int check_sch_bw(struct usb_device *udev, tt_offset_ok =3D true; } =20 - if ((offset + sch_ep->num_budget_microframes) > sch_ep->esit) + if ((offset + sch_ep->num_budget_microframes) > esit_boundary) break; =20 worst_bw =3D get_max_bw(sch_bw, sch_ep, offset); --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8B24C07E9D for ; Mon, 26 Sep 2022 10:40:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236252AbiIZKk6 (ORCPT ); Mon, 26 Sep 2022 06:40:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236356AbiIZKjG (ORCPT ); Mon, 26 Sep 2022 06:39:06 -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 D0A5553D0C; Mon, 26 Sep 2022 03:22: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 E8661B80915; Mon, 26 Sep 2022 10:22:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4892DC433D6; Mon, 26 Sep 2022 10:22:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187767; bh=uL7SlwwZZ5lf4O8RXBnrMmtiQSNrVMXo+2zGJvQVkFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QXEBYjQ87ygReiCa05PDidLT01G/lPN66jZj09HXdEXgpb4mo8McViYDUsfqfaz7u cb3TFvf49CbS4rI2NL9W/S/8s58yvGcHT+zaMyRfecjJT18gcOgRSL2TF+FLOITSPF nXN5RnlvI0R3BWNhy/hVuW0pkoIJ54yt1aFCjf/E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunfeng Yun , Sasha Levin Subject: [PATCH 5.4 036/120] usb: xhci-mtk: add only one extra CS for FS/LS INTR Date: Mon, 26 Sep 2022 12:11:09 +0200 Message-Id: <20220926100752.009518510@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chunfeng Yun [ Upstream commit 1bf661daf6b084bc4d753f55b54f35dc98709685 ] In USB2 Spec: "11.18.5 TT Response Generation In general, there will be two (or more) complete-split transactions scheduled for a periodic endpoint. However, for interrupt endpoints, the maximum size of the full-/low-speed transaction guarantees that it can never require more than two complete-split transactions. Two complete-split transactions are only required when the transaction spans a microframe boundary." Due to the maxp is 64, and less then 188 (at most in one microframe), seems never span boundary, so use only one CS for FS/LS interrupt transfer, this will save some bandwidth. Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/5b9ff09f53d23cf9e5c5437db4ffc18b798bf60c.16= 15170625.git.chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 548011957d1d ("usb: xhci-mtk: relax TT periodic bandwidth al= location") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/host/xhci-mtk-sch.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sc= h.c index 450fa22b7dc7..59ba25ca018d 100644 --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -408,13 +408,11 @@ static int check_sch_tt(struct usb_device *udev, { struct mu3h_sch_tt *tt =3D sch_ep->sch_tt; u32 extra_cs_count; - u32 fs_budget_start; u32 start_ss, last_ss; u32 start_cs, last_cs; int i; =20 start_ss =3D offset % 8; - fs_budget_start =3D (start_ss + 1) % 8; =20 if (sch_ep->ep_type =3D=3D ISOC_OUT_EP) { last_ss =3D start_ss + sch_ep->cs_count - 1; @@ -450,16 +448,14 @@ static int check_sch_tt(struct usb_device *udev, if (sch_ep->ep_type =3D=3D ISOC_IN_EP) extra_cs_count =3D (last_cs =3D=3D 7) ? 1 : 2; else /* ep_type : INTR IN / INTR OUT */ - extra_cs_count =3D (fs_budget_start =3D=3D 6) ? 1 : 2; + extra_cs_count =3D 1; =20 cs_count +=3D extra_cs_count; if (cs_count > 7) cs_count =3D 7; /* HW limit */ =20 - for (i =3D 0; i < cs_count + 2; i++) { - if (test_bit(offset + i, tt->ss_bit_map)) - return -ERANGE; - } + if (test_bit(offset, tt->ss_bit_map)) + return -ERANGE; =20 sch_ep->cs_count =3D cs_count; /* one for ss, the other for idle */ --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50935C32771 for ; Mon, 26 Sep 2022 10:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236299AbiIZKmi (ORCPT ); Mon, 26 Sep 2022 06:42:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236290AbiIZKlJ (ORCPT ); Mon, 26 Sep 2022 06:41: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 06B7654660; Mon, 26 Sep 2022 03:24: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 3AD0D60B7E; Mon, 26 Sep 2022 10:23:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DB98C433C1; Mon, 26 Sep 2022 10:23:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187801; bh=ro6m7C/bg7snchqXrcsCCConBzeIdd6JQ1ZeDqS7cxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pj/sLBPeNUuzoNbHl5oq/W8WtRtIaHnDLuixSDMRW6bkJ4xlevHKboVu3X5It5aHU 0BCe0bzOuG+iC+QfzKMA52yPY6v+EKr16y7EbbE2wZesmKH+EMlm608YjOco/DgWbi tZ4ikuANIlJxBC008k3tiuyP/NUG7bBs6cZEJUYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunfeng Yun , Sasha Levin Subject: [PATCH 5.4 037/120] usb: xhci-mtk: use @sch_tt to check whether need do TT schedule Date: Mon, 26 Sep 2022 12:11:10 +0200 Message-Id: <20220926100752.048483753@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chunfeng Yun [ Upstream commit 4a56adf4fafbc41ceffce0c3f385f59d4fc3c16a ] It's clearer to use @sch_tt to check whether need do TT schedule, no function is changed. Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/324a76782ccaf857a8f01f67aee435e8ec7d0e28.16= 15170625.git.chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 548011957d1d ("usb: xhci-mtk: relax TT periodic bandwidth al= location") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/host/xhci-mtk-sch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sc= h.c index 59ba25ca018d..b1da3cb077c9 100644 --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -548,7 +548,7 @@ static int check_sch_bw(struct usb_device *udev, min_num_budget =3D sch_ep->num_budget_microframes; esit_boundary =3D get_esit_boundary(sch_ep); for (offset =3D 0; offset < sch_ep->esit; offset++) { - if (is_fs_or_ls(udev->speed)) { + if (sch_ep->sch_tt) { ret =3D check_sch_tt(udev, sch_ep, offset); if (ret) continue; @@ -585,7 +585,7 @@ static int check_sch_bw(struct usb_device *udev, sch_ep->cs_count =3D min_cs_count; sch_ep->num_budget_microframes =3D min_num_budget; =20 - if (is_fs_or_ls(udev->speed)) { + if (sch_ep->sch_tt) { /* all offset for tt is not ok*/ if (!tt_offset_ok) return -ERANGE; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E205C32771 for ; Mon, 26 Sep 2022 10:42:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236371AbiIZKmH (ORCPT ); Mon, 26 Sep 2022 06:42:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236027AbiIZKj6 (ORCPT ); Mon, 26 Sep 2022 06:39:58 -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 42FE53E77B; Mon, 26 Sep 2022 03:23: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 0578FB80924; Mon, 26 Sep 2022 10:23:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39FCCC433C1; Mon, 26 Sep 2022 10:23:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187820; bh=/KzNBC/1o7m8B9RSy27+tliksvw2eqi39Mn6M3WBaDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zNr4jX+L5UVJf9zNzuXTdlHyTUUGBIoZ7RHb3Acba3IhtAIf7UsjCK727A/sacNSk X8/Dk4ptiq/E+1bs2cGoqsQc3/KNmzC8zIqC6beVrbZBaxqRy6FAeeos1agyTE3Uua +HaDEEzYEuxotOLHN4YMjPQuLKu7Pv+dY58DBjzQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunfeng Yun , Sasha Levin Subject: [PATCH 5.4 038/120] usb: xhci-mtk: add a function to (un)load bandwidth info Date: Mon, 26 Sep 2022 12:11:11 +0200 Message-Id: <20220926100752.083339049@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chunfeng Yun [ Upstream commit 338af695fffb12a9407c376ce0cebce896c15050 ] Extract a function to load/unload bandwidth info, and remove a dummy check of TT offset. Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/6fbc000756a4a4a7efbce651b785fee7561becb6.16= 15170625.git.chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 548011957d1d ("usb: xhci-mtk: relax TT periodic bandwidth al= location") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/host/xhci-mtk-sch.c | 37 ++++++++++++++------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sc= h.c index b1da3cb077c9..9a9685f74940 100644 --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -375,7 +375,6 @@ static void update_bus_bw(struct mu3h_sch_bw_info *sch_= bw, sch_ep->bw_budget_table[j]; } } - sch_ep->allocated =3D used; } =20 static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset) @@ -509,6 +508,19 @@ static void update_sch_tt(struct usb_device *udev, list_del(&sch_ep->tt_endpoint); } =20 +static int load_ep_bw(struct usb_device *udev, struct mu3h_sch_bw_info *sc= h_bw, + struct mu3h_sch_ep_info *sch_ep, bool loaded) +{ + if (sch_ep->sch_tt) + update_sch_tt(udev, sch_ep, loaded); + + /* update bus bandwidth info */ + update_bus_bw(sch_bw, sch_ep, loaded); + sch_ep->allocated =3D loaded; + + return 0; +} + static u32 get_esit_boundary(struct mu3h_sch_ep_info *sch_ep) { u32 boundary =3D sch_ep->esit; @@ -535,7 +547,6 @@ static int check_sch_bw(struct usb_device *udev, u32 esit_boundary; u32 min_num_budget; u32 min_cs_count; - bool tt_offset_ok =3D false; int ret; =20 /* @@ -552,8 +563,6 @@ static int check_sch_bw(struct usb_device *udev, ret =3D check_sch_tt(udev, sch_ep, offset); if (ret) continue; - else - tt_offset_ok =3D true; } =20 if ((offset + sch_ep->num_budget_microframes) > esit_boundary) @@ -585,29 +594,15 @@ static int check_sch_bw(struct usb_device *udev, sch_ep->cs_count =3D min_cs_count; sch_ep->num_budget_microframes =3D min_num_budget; =20 - if (sch_ep->sch_tt) { - /* all offset for tt is not ok*/ - if (!tt_offset_ok) - return -ERANGE; - - update_sch_tt(udev, sch_ep, 1); - } - - /* update bus bandwidth info */ - update_bus_bw(sch_bw, sch_ep, 1); - - return 0; + return load_ep_bw(udev, sch_bw, sch_ep, true); } =20 static void destroy_sch_ep(struct usb_device *udev, struct mu3h_sch_bw_info *sch_bw, struct mu3h_sch_ep_info *sch_ep) { /* only release ep bw check passed by check_sch_bw() */ - if (sch_ep->allocated) { - update_bus_bw(sch_bw, sch_ep, 0); - if (sch_ep->sch_tt) - update_sch_tt(udev, sch_ep, 0); - } + if (sch_ep->allocated) + load_ep_bw(udev, sch_bw, sch_ep, false); =20 if (sch_ep->sch_tt) drop_tt(udev); --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B09BC07E9D for ; Mon, 26 Sep 2022 10:42:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236368AbiIZKmB (ORCPT ); Mon, 26 Sep 2022 06:42:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236050AbiIZKj6 (ORCPT ); Mon, 26 Sep 2022 06:39:58 -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 120DC543E7; Mon, 26 Sep 2022 03:23: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 0B0BAB8092B; Mon, 26 Sep 2022 10:23:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64155C433C1; Mon, 26 Sep 2022 10:23:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187823; bh=RKOpVFNMZWBiILH99dSIKHVuiodIBHC1WyT1+BwZlKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FoKN56LEYiloB992S5QCYJHwDnjch+ZlQPiVYUw7J1gvENGm4gZIJq1dzd8JyVXrq pyRMCTw0vJeqXkesn+rxKhtFr9GEgE6rtHVFHWmtOZ1ABtPFNqsZN2u/q76LWJRaRV dj5vkH/wMvhP8xV6wy0QVa7z9eMpQXBe8BjMTp14= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunfeng Yun , Sasha Levin Subject: [PATCH 5.4 039/120] usb: xhci-mtk: add some schedule error number Date: Mon, 26 Sep 2022 12:11:12 +0200 Message-Id: <20220926100752.123244444@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chunfeng Yun [ Upstream commit ccda8c224c0701caac007311d06a2de9543a7590 ] This is used to provide more information about which case causes bandwidth schedule failure. Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/9771f44093053b581e9c4be4b7fb68d9fcecad08.16= 15170625.git.chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 548011957d1d ("usb: xhci-mtk: relax TT periodic bandwidth al= location") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/host/xhci-mtk-sch.c | 44 ++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sc= h.c index 9a9685f74940..a6ec75bf2def 100644 --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -25,6 +25,13 @@ */ #define TT_MICROFRAMES_MAX 9 =20 +/* schedule error type */ +#define ESCH_SS_Y6 1001 +#define ESCH_SS_OVERLAP 1002 +#define ESCH_CS_OVERFLOW 1003 +#define ESCH_BW_OVERFLOW 1004 +#define ESCH_FIXME 1005 + /* mtk scheduler bitmasks */ #define EP_BPKTS(p) ((p) & 0x7f) #define EP_BCSCOUNT(p) (((p) & 0x7) << 8) @@ -32,6 +39,24 @@ #define EP_BOFFSET(p) ((p) & 0x3fff) #define EP_BREPEAT(p) (((p) & 0x7fff) << 16) =20 +static char *sch_error_string(int err_num) +{ + switch (err_num) { + case ESCH_SS_Y6: + return "Can't schedule Start-Split in Y6"; + case ESCH_SS_OVERLAP: + return "Can't find a suitable Start-Split location"; + case ESCH_CS_OVERFLOW: + return "The last Complete-Split is greater than 7"; + case ESCH_BW_OVERFLOW: + return "Bandwidth exceeds the maximum limit"; + case ESCH_FIXME: + return "FIXME, to be resolved"; + default: + return "Unknown"; + } +} + static int is_fs_or_ls(enum usb_device_speed speed) { return speed =3D=3D USB_SPEED_FULL || speed =3D=3D USB_SPEED_LOW; @@ -395,7 +420,7 @@ static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch= _ep, int offset) for (j =3D 0; j < sch_ep->cs_count; j++) { tmp =3D tt->fs_bus_bw[base + j] + sch_ep->bw_cost_per_microframe; if (tmp > FS_PAYLOAD_MAX) - return -ERANGE; + return -ESCH_BW_OVERFLOW; } } =20 @@ -421,11 +446,11 @@ static int check_sch_tt(struct usb_device *udev, * must never schedule Start-Split in Y6 */ if (!(start_ss =3D=3D 7 || last_ss < 6)) - return -ERANGE; + return -ESCH_SS_Y6; =20 for (i =3D 0; i < sch_ep->cs_count; i++) if (test_bit(offset + i, tt->ss_bit_map)) - return -ERANGE; + return -ESCH_SS_OVERLAP; =20 } else { u32 cs_count =3D DIV_ROUND_UP(sch_ep->maxpkt, FS_PAYLOAD_MAX); @@ -435,14 +460,14 @@ static int check_sch_tt(struct usb_device *udev, * must never schedule Start-Split in Y6 */ if (start_ss =3D=3D 6) - return -ERANGE; + return -ESCH_SS_Y6; =20 /* one uframe for ss + one uframe for idle */ start_cs =3D (start_ss + 2) % 8; last_cs =3D start_cs + cs_count - 1; =20 if (last_cs > 7) - return -ERANGE; + return -ESCH_CS_OVERFLOW; =20 if (sch_ep->ep_type =3D=3D ISOC_IN_EP) extra_cs_count =3D (last_cs =3D=3D 7) ? 1 : 2; @@ -454,7 +479,7 @@ static int check_sch_tt(struct usb_device *udev, cs_count =3D 7; /* HW limit */ =20 if (test_bit(offset, tt->ss_bit_map)) - return -ERANGE; + return -ESCH_SS_OVERLAP; =20 sch_ep->cs_count =3D cs_count; /* one for ss, the other for idle */ @@ -547,7 +572,7 @@ static int check_sch_bw(struct usb_device *udev, u32 esit_boundary; u32 min_num_budget; u32 min_cs_count; - int ret; + int ret =3D 0; =20 /* * Search through all possible schedule microframes. @@ -588,7 +613,7 @@ static int check_sch_bw(struct usb_device *udev, =20 /* check bandwidth */ if (min_bw > bw_boundary) - return -ERANGE; + return ret ? ret : -ESCH_BW_OVERFLOW; =20 sch_ep->offset =3D min_index; sch_ep->cs_count =3D min_cs_count; @@ -765,7 +790,8 @@ int xhci_mtk_check_bandwidth(struct usb_hcd *hcd, struc= t usb_device *udev) =20 ret =3D check_sch_bw(udev, sch_bw, sch_ep); if (ret) { - xhci_err(xhci, "Not enough bandwidth!\n"); + xhci_err(xhci, "Not enough bandwidth! (%s)\n", + sch_error_string(-ret)); return -ENOSPC; } } --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D12A8C07E9D for ; Mon, 26 Sep 2022 10:42:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236377AbiIZKmK (ORCPT ); Mon, 26 Sep 2022 06:42:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236181AbiIZKkY (ORCPT ); Mon, 26 Sep 2022 06:40:24 -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 E6E684D274; Mon, 26 Sep 2022 03:24: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 6552260B2F; Mon, 26 Sep 2022 10:23:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75517C433C1; Mon, 26 Sep 2022 10:23:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187826; bh=tPm49+Vqk0CppNw6LPaubmfPnqHxW3jbvnUg7/yYYNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YG8tu0VScp6u8UsHkdmQBsAg8bId6YFdaUIVYCyyHYnSzxJDQA0019j3vNvYkS/15 8ygfZAftZ60ZO/nT3D1ZWgd7UJJVLh6h1zOScQXQHZd6DRr4MgbNzDtvRZceVB85kO rzBpVaGUuDMM8pt0LzUhfPQoOxvBH0VZpWhOO8uE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunfeng Yun , Sasha Levin , Ikjoon Jang Subject: [PATCH 5.4 040/120] usb: xhci-mtk: allow multiple Start-Split in a microframe Date: Mon, 26 Sep 2022 12:11:13 +0200 Message-Id: <20220926100752.164176543@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chunfeng Yun [ Upstream commit d3997fce189fc4423169c51a81ba5ca01144d886 ] This patch is used to relax bandwidth schedule by allowing multiple Start-Split in the same microframe. Reviewed-and-Tested-by: Ikjoon Jang Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/1623995165-25759-1-git-send-email-chunfeng.= yun@mediatek.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 548011957d1d ("usb: xhci-mtk: relax TT periodic bandwidth al= location") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/host/xhci-mtk-sch.c | 18 ------------------ drivers/usb/host/xhci-mtk.h | 2 -- 2 files changed, 20 deletions(-) diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sc= h.c index a6ec75bf2def..f048af9c5335 100644 --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -430,11 +430,9 @@ static int check_fs_bus_bw(struct mu3h_sch_ep_info *sc= h_ep, int offset) static int check_sch_tt(struct usb_device *udev, struct mu3h_sch_ep_info *sch_ep, u32 offset) { - struct mu3h_sch_tt *tt =3D sch_ep->sch_tt; u32 extra_cs_count; u32 start_ss, last_ss; u32 start_cs, last_cs; - int i; =20 start_ss =3D offset % 8; =20 @@ -448,10 +446,6 @@ static int check_sch_tt(struct usb_device *udev, if (!(start_ss =3D=3D 7 || last_ss < 6)) return -ESCH_SS_Y6; =20 - for (i =3D 0; i < sch_ep->cs_count; i++) - if (test_bit(offset + i, tt->ss_bit_map)) - return -ESCH_SS_OVERLAP; - } else { u32 cs_count =3D DIV_ROUND_UP(sch_ep->maxpkt, FS_PAYLOAD_MAX); =20 @@ -478,9 +472,6 @@ static int check_sch_tt(struct usb_device *udev, if (cs_count > 7) cs_count =3D 7; /* HW limit */ =20 - if (test_bit(offset, tt->ss_bit_map)) - return -ESCH_SS_OVERLAP; - sch_ep->cs_count =3D cs_count; /* one for ss, the other for idle */ sch_ep->num_budget_microframes =3D cs_count + 2; @@ -502,11 +493,9 @@ static void update_sch_tt(struct usb_device *udev, struct mu3h_sch_tt *tt =3D sch_ep->sch_tt; u32 base, num_esit; int bw_updated; - int bits; int i, j; =20 num_esit =3D XHCI_MTK_MAX_ESIT / sch_ep->esit; - bits =3D (sch_ep->ep_type =3D=3D ISOC_OUT_EP) ? sch_ep->cs_count : 1; =20 if (used) bw_updated =3D sch_ep->bw_cost_per_microframe; @@ -516,13 +505,6 @@ static void update_sch_tt(struct usb_device *udev, for (i =3D 0; i < num_esit; i++) { base =3D sch_ep->offset + i * sch_ep->esit; =20 - for (j =3D 0; j < bits; j++) { - if (used) - set_bit(base + j, tt->ss_bit_map); - else - clear_bit(base + j, tt->ss_bit_map); - } - for (j =3D 0; j < sch_ep->cs_count; j++) tt->fs_bus_bw[base + j] +=3D bw_updated; } diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h index 985e7a19f6f6..2f702342de66 100644 --- a/drivers/usb/host/xhci-mtk.h +++ b/drivers/usb/host/xhci-mtk.h @@ -20,14 +20,12 @@ #define XHCI_MTK_MAX_ESIT 64 =20 /** - * @ss_bit_map: used to avoid start split microframes overlay * @fs_bus_bw: array to keep track of bandwidth already used for FS * @ep_list: Endpoints using this TT * @usb_tt: usb TT related * @tt_port: TT port number */ struct mu3h_sch_tt { - DECLARE_BITMAP(ss_bit_map, XHCI_MTK_MAX_ESIT); u32 fs_bus_bw[XHCI_MTK_MAX_ESIT]; struct list_head ep_list; struct usb_tt *usb_tt; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B170C32771 for ; Mon, 26 Sep 2022 10:43:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234109AbiIZKnR (ORCPT ); Mon, 26 Sep 2022 06:43:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236349AbiIZKlv (ORCPT ); Mon, 26 Sep 2022 06:41:51 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C96BD10B; Mon, 26 Sep 2022 03:24: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 sin.source.kernel.org (Postfix) with ESMTPS id 75CBBCE10E3; Mon, 26 Sep 2022 10:23:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EA71C433C1; Mon, 26 Sep 2022 10:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187829; bh=NEZTy+BKfXvX5oTntyTl1H1SF2mGN6DXR21RV/cXAjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JXEoIlyr1/BktA5qFOEF1Aib5wRexQj4c4qNKtcR3v2azrvjBBGu+xwUdwFm81mV1 OEHqmsU/AnRDuR+EDI7jJMCbFpEgG7iX3LoJQ0z4EaLf1KQs+rQTzyIinYciJkV7HO moZ7vKRLmdNU2kMKzPHEV0wXs3cwPaE6t/UWqz4M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ikjoon Jang , Sasha Levin Subject: [PATCH 5.4 041/120] usb: xhci-mtk: relax TT periodic bandwidth allocation Date: Mon, 26 Sep 2022 12:11:14 +0200 Message-Id: <20220926100752.206051708@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ikjoon Jang [ Upstream commit 548011957d1d72e0b662300c8b32b81d593b796e ] Currently xhci-mtk needs software-managed bandwidth allocation for periodic endpoints, it allocates the microframe index for the first start-split packet for each endpoint. As this index allocation logic should avoid the conflicts with other full/low-speed periodic endpoints, it uses the worst case byte budgets on high-speed bus bandwidth For example, for an isochronos IN endpoint with 192 bytes budget, it will consume the whole 4 u-frames(188 * 4) while the actual full-speed bus budget should be just 192bytes. This patch changes the low/full-speed bandwidth allocation logic to use "approximate" best case budget for lower speed bandwidth management. For the same endpoint from the above example, the approximate best case budget is now reduced to (188 * 2) bytes. Without this patch, many usb audio headsets with 3 interfaces (audio input, audio output, and HID) cannot be configured on xhci-mtk. Signed-off-by: Ikjoon Jang Link: https://lore.kernel.org/r/20210805133937.1.Ia8174b875bc926c12ce427a5a= 1415dea31cc35ae@changeid Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/host/xhci-mtk-sch.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sc= h.c index f048af9c5335..4a7b200674ea 100644 --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -408,16 +408,17 @@ static int check_fs_bus_bw(struct mu3h_sch_ep_info *s= ch_ep, int offset) u32 num_esit, tmp; int base; int i, j; + u8 uframes =3D DIV_ROUND_UP(sch_ep->maxpkt, FS_PAYLOAD_MAX); =20 num_esit =3D XHCI_MTK_MAX_ESIT / sch_ep->esit; + + if (sch_ep->ep_type =3D=3D INT_IN_EP || sch_ep->ep_type =3D=3D ISOC_IN_EP) + offset++; + for (i =3D 0; i < num_esit; i++) { base =3D offset + i * sch_ep->esit; =20 - /* - * Compared with hs bus, no matter what ep type, - * the hub will always delay one uframe to send data - */ - for (j =3D 0; j < sch_ep->cs_count; j++) { + for (j =3D 0; j < uframes; j++) { tmp =3D tt->fs_bus_bw[base + j] + sch_ep->bw_cost_per_microframe; if (tmp > FS_PAYLOAD_MAX) return -ESCH_BW_OVERFLOW; @@ -494,6 +495,8 @@ static void update_sch_tt(struct usb_device *udev, u32 base, num_esit; int bw_updated; int i, j; + int offset =3D sch_ep->offset; + u8 uframes =3D DIV_ROUND_UP(sch_ep->maxpkt, FS_PAYLOAD_MAX); =20 num_esit =3D XHCI_MTK_MAX_ESIT / sch_ep->esit; =20 @@ -502,10 +505,13 @@ static void update_sch_tt(struct usb_device *udev, else bw_updated =3D -sch_ep->bw_cost_per_microframe; =20 + if (sch_ep->ep_type =3D=3D INT_IN_EP || sch_ep->ep_type =3D=3D ISOC_IN_EP) + offset++; + for (i =3D 0; i < num_esit; i++) { - base =3D sch_ep->offset + i * sch_ep->esit; + base =3D offset + i * sch_ep->esit; =20 - for (j =3D 0; j < sch_ep->cs_count; j++) + for (j =3D 0; j < uframes; j++) tt->fs_bus_bw[base + j] +=3D bw_updated; } =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCFE4C32771 for ; Mon, 26 Sep 2022 10:45:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236326AbiIZKpM (ORCPT ); Mon, 26 Sep 2022 06:45:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236201AbiIZKm5 (ORCPT ); Mon, 26 Sep 2022 06:42:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 491FB18E24; Mon, 26 Sep 2022 03:24:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4C2F8B80915; Mon, 26 Sep 2022 10:23:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FBC7C433C1; Mon, 26 Sep 2022 10:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187833; bh=vSdOEAMstmSmfi3lFpIiRMp77RLfuMXmUwhvpHUwSLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G1FJf31N8W013+wnJtBFSTrwuML3r9kwchZefiWuredUO2uFA7MVdeeUab10oBD2C lnoXwbrxrbi+6zBQY+9j5zQ4UCFIWRMBELXqMCHhPeXoVsHkVgRcjCChtZABYluKlF stp9XIKVouK+gebxC7n6b7xmiLGj6Lj2Uuf6bs74= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Andy Shevchenko , Kent Gustavsson , Marcus Folkesson , Sasha Levin Subject: [PATCH 5.4 042/120] iio:adc:mcp3911: Switch to generic firmware properties. Date: Mon, 26 Sep 2022 12:11:15 +0200 Message-Id: <20220926100752.250813953@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jonathan Cameron [ Upstream commit 4efc1c614d334883cce09c38aa3fe74d3fb0bbf0 ] This allows use of the driver with other types of firmware such as ACPI PRP0001 based probing. Also part of a general attempt to remove direct use of of_ specific accessors from IIO. Added an include for mod_devicetable.h whilst here to cover the struct of_device_id definition. Signed-off-by: Jonathan Cameron Reviewed-by: Andy Shevchenko Cc: Kent Gustavsson Reviewed-by: Marcus Folkesson Stable-dep-of: cfbd76d5c9c4 ("iio: adc: mcp3911: correct "microchip,device-= addr" property") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/mcp3911.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c index 4e2e8e819b1e..cd8b1bab9cf0 100644 --- a/drivers/iio/adc/mcp3911.c +++ b/drivers/iio/adc/mcp3911.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include #include =20 @@ -209,12 +211,13 @@ static const struct iio_info mcp3911_info =3D { .write_raw =3D mcp3911_write_raw, }; =20 -static int mcp3911_config(struct mcp3911 *adc, struct device_node *of_node) +static int mcp3911_config(struct mcp3911 *adc) { + struct device *dev =3D &adc->spi->dev; u32 configreg; int ret; =20 - of_property_read_u32(of_node, "device-addr", &adc->dev_addr); + device_property_read_u32(dev, "device-addr", &adc->dev_addr); if (adc->dev_addr > 3) { dev_err(&adc->spi->dev, "invalid device address (%i). Must be in range 0-3.\n", @@ -298,7 +301,7 @@ static int mcp3911_probe(struct spi_device *spi) } } =20 - ret =3D mcp3911_config(adc, spi->dev.of_node); + ret =3D mcp3911_config(adc); if (ret) goto clk_disable; =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAFC8C07E9D for ; Mon, 26 Sep 2022 10:42:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234426AbiIZKml (ORCPT ); Mon, 26 Sep 2022 06:42:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236289AbiIZKlJ (ORCPT ); Mon, 26 Sep 2022 06:41: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 968EF4D167; Mon, 26 Sep 2022 03:24: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 9FACE60BB1; Mon, 26 Sep 2022 10:23:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA862C433C1; Mon, 26 Sep 2022 10:23:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187836; bh=2y0DE5yi0iANBQw/LVAuri6eExxqytDWJSrFqn2o49w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fo5YHEIz+ZaP3cYGli3Ac+v/7jg4YzD3T+jvZyi3z9piT5ZomXgck+p9ifnYMgUxd me4iDwSDMKj+PxQQKMPGLVIKsr+r94e5by76G2x0Jsur0Lt++4/MUpPq4NibU2h5HV 2UQnaU8GUs0djuPRDU1tgNJgJF32l3PIUEK1JUmk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcus Folkesson , Andy Shevchenko , Stable@vger.kernel.org, Jonathan Cameron , Sasha Levin Subject: [PATCH 5.4 043/120] iio: adc: mcp3911: correct "microchip,device-addr" property Date: Mon, 26 Sep 2022 12:11:16 +0200 Message-Id: <20220926100752.301393843@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marcus Folkesson [ Upstream commit cfbd76d5c9c449739bb74288d982bccf9ff822f4 ] Go for the right property name that is documented in the bindings. Fixes: 3a89b289df5d ("iio: adc: add support for mcp3911") Signed-off-by: Marcus Folkesson Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220722130726.7627-3-marcus.folkesson@gmai= l.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/mcp3911.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c index cd8b1bab9cf0..0299f9ea9692 100644 --- a/drivers/iio/adc/mcp3911.c +++ b/drivers/iio/adc/mcp3911.c @@ -217,7 +217,14 @@ static int mcp3911_config(struct mcp3911 *adc) u32 configreg; int ret; =20 - device_property_read_u32(dev, "device-addr", &adc->dev_addr); + ret =3D device_property_read_u32(dev, "microchip,device-addr", &adc->dev_= addr); + + /* + * Fallback to "device-addr" due to historical mismatch between + * dt-bindings and implementation + */ + if (ret) + device_property_read_u32(dev, "device-addr", &adc->dev_addr); if (adc->dev_addr > 3) { dev_err(&adc->spi->dev, "invalid device address (%i). Must be in range 0-3.\n", --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6192C07E9D for ; Mon, 26 Sep 2022 10:40:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236199AbiIZKkb (ORCPT ); Mon, 26 Sep 2022 06:40:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236196AbiIZKig (ORCPT ); Mon, 26 Sep 2022 06:38:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00CF352E69; Mon, 26 Sep 2022 03:22: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 0EE0060B2F; Mon, 26 Sep 2022 10:22:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E85CC433C1; Mon, 26 Sep 2022 10:22:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187736; bh=Bk/Vfbwtqdi5kPieSRywcwawYnNgfIlk/03jO8f8Kq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UNuLm9Y3Yrbh94tHQSnGqSwsobv93evcZq+K0QitUm/0fJ22b2Mx6kMnYTNVZ3fOb ntP6Je1yaU1MfkX6mkfODHVQv+EdYqsFDWAhAt4Sm7KDKeh33eNztxNJoH/CMHBCGs wB0tgXLFdlbu18ZzZxpeLNf915xPag/B6NxXntkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+f9acff9bf08a845f225d@syzkaller.appspotmail.com, Johannes Berg , Siddh Raman Pant , Johannes Berg , Sasha Levin Subject: [PATCH 5.4 044/120] wifi: mac80211: Fix UAF in ieee80211_scan_rx() Date: Mon, 26 Sep 2022 12:11:17 +0200 Message-Id: <20220926100752.340831202@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Siddh Raman Pant [ Upstream commit 60deb9f10eec5c6a20252ed36238b55d8b614a2c ] ieee80211_scan_rx() tries to access scan_req->flags after a null check, but a UAF is observed when the scan is completed and __ieee80211_scan_completed() executes, which then calls cfg80211_scan_done() leading to the freeing of scan_req. Since scan_req is rcu_dereference()'d, prevent the racing in __ieee80211_scan_completed() by ensuring that from mac80211's POV it is no longer accessed from an RCU read critical section before we call cfg80211_scan_done(). Cc: stable@vger.kernel.org Link: https://syzkaller.appspot.com/bug?extid=3Df9acff9bf08a845f225d Reported-by: syzbot+f9acff9bf08a845f225d@syzkaller.appspotmail.com Suggested-by: Johannes Berg Signed-off-by: Siddh Raman Pant Link: https://lore.kernel.org/r/20220819200340.34826-1-code@siddh.me Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/mac80211/scan.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 344b2c22e75b..c353162e81ae 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -431,10 +431,6 @@ static void __ieee80211_scan_completed(struct ieee8021= 1_hw *hw, bool aborted) scan_req =3D rcu_dereference_protected(local->scan_req, lockdep_is_held(&local->mtx)); =20 - if (scan_req !=3D local->int_scan_req) { - local->scan_info.aborted =3D aborted; - cfg80211_scan_done(scan_req, &local->scan_info); - } RCU_INIT_POINTER(local->scan_req, NULL); =20 scan_sdata =3D rcu_dereference_protected(local->scan_sdata, @@ -444,6 +440,13 @@ static void __ieee80211_scan_completed(struct ieee8021= 1_hw *hw, bool aborted) local->scanning =3D 0; local->scan_chandef.chan =3D NULL; =20 + synchronize_rcu(); + + if (scan_req !=3D local->int_scan_req) { + local->scan_info.aborted =3D aborted; + cfg80211_scan_done(scan_req, &local->scan_info); + } + /* Set power back to normal operating levels. */ ieee80211_hw_config(local, 0); =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7962EC6FA83 for ; Mon, 26 Sep 2022 10:40:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236183AbiIZKkZ (ORCPT ); Mon, 26 Sep 2022 06:40:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236171AbiIZKic (ORCPT ); Mon, 26 Sep 2022 06:38: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 97A8F52FCA; Mon, 26 Sep 2022 03:22:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 04E90B80682; Mon, 26 Sep 2022 10:22:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39056C433D7; Mon, 26 Sep 2022 10:22:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187739; bh=+EO+0WMEX3fWugULxoV78K5efRFvXMMx8Wm17d97AM8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yzeiksPlJRO3EMKORpwZoT/VHvrt9uBoqhntsMS8LeRB8KwXKN78hkBe1Ul+wZPDq QhcvQzkuOBz5yHX39cK7or/zWCL65PDxOCKTmReGWSB40FP3vePLgjwmiG4q9Q5NfN G9/YjzBoWDiEGawF4geEwKH11N6OMSILWhHnjuVk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Codrin Ciubotariu , Richard Genoud , Sasha Levin Subject: [PATCH 5.4 045/120] tty/serial: atmel: RS485 & ISO7816: wait for TXRDY before sending data Date: Mon, 26 Sep 2022 12:11:18 +0200 Message-Id: <20220926100752.382756365@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Codrin.Ciubotariu@microchip.com [ Upstream commit 477b8383100023ea0769979cff67e9be3a720397 ] At this moment, TXEMPTY is checked before sending data on RS485 and ISO7816 modes. However, TXEMPTY is risen when FIFO (if used) or the Transmit Shift Register are empty, even though TXRDY might be up and controller is able to receive data. Since the controller sends data only when TXEMPTY is ready, on RS485, when DMA is not used, the RTS pin is driven low after each byte. With this patch, the characters will be transmitted when TXRDY is up and so, RTS pin will remain high between bytes. The performance improvement on RS485 is about 8% with a baudrate of 300. Signed-off-by: Codrin Ciubotariu Acked-by: Richard Genoud Link: https://lore.kernel.org/r/20200107111656.26308-1-codrin.ciubotariu@mi= crochip.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 692a8ebcfc24 ("tty: serial: atmel: Preserve previous USART m= ode if RS485 disabled") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/atmel_serial.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_s= erial.c index 3b2c25bd2e06..e011f3d20224 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -313,7 +313,11 @@ static int atmel_config_rs485(struct uart_port *port, =20 if (rs485conf->flags & SER_RS485_ENABLED) { dev_dbg(port->dev, "Setting UART to RS485\n"); - atmel_port->tx_done_mask =3D ATMEL_US_TXEMPTY; + if (port->rs485.flags & SER_RS485_RX_DURING_TX) + atmel_port->tx_done_mask =3D ATMEL_US_TXRDY; + else + atmel_port->tx_done_mask =3D ATMEL_US_TXEMPTY; + atmel_uart_writel(port, ATMEL_US_TTGR, rs485conf->delay_rts_after_send); mode |=3D ATMEL_US_USMODE_RS485; @@ -832,7 +836,7 @@ static void atmel_tx_chars(struct uart_port *port) struct atmel_uart_port *atmel_port =3D to_atmel_uart_port(port); =20 if (port->x_char && - (atmel_uart_readl(port, ATMEL_US_CSR) & atmel_port->tx_done_mask)) { + (atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY)) { atmel_uart_write_char(port, port->x_char); port->icount.tx++; port->x_char =3D 0; @@ -840,8 +844,7 @@ static void atmel_tx_chars(struct uart_port *port) if (uart_circ_empty(xmit) || uart_tx_stopped(port)) return; =20 - while (atmel_uart_readl(port, ATMEL_US_CSR) & - atmel_port->tx_done_mask) { + while (atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY) { atmel_uart_write_char(port, xmit->buf[xmit->tail]); xmit->tail =3D (xmit->tail + 1) & (UART_XMIT_SIZE - 1); port->icount.tx++; @@ -852,10 +855,20 @@ static void atmel_tx_chars(struct uart_port *port) if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) uart_write_wakeup(port); =20 - if (!uart_circ_empty(xmit)) + if (!uart_circ_empty(xmit)) { + /* we still have characters to transmit, so we should continue + * transmitting them when TX is ready, regardless of + * mode or duplexity + */ + atmel_port->tx_done_mask |=3D ATMEL_US_TXRDY; + /* Enable interrupts */ atmel_uart_writel(port, ATMEL_US_IER, atmel_port->tx_done_mask); + } else { + if (atmel_uart_is_half_duplex(port)) + atmel_port->tx_done_mask &=3D ~ATMEL_US_TXRDY; + } } =20 static void atmel_complete_tx_dma(void *arg) @@ -2541,8 +2554,7 @@ static int atmel_init_port(struct atmel_uart_port *at= mel_port, * Use TXEMPTY for interrupt when rs485 or ISO7816 else TXRDY or * ENDTX|TXBUFE */ - if (port->rs485.flags & SER_RS485_ENABLED || - port->iso7816.flags & SER_ISO7816_ENABLED) + if (atmel_uart_is_half_duplex(port)) atmel_port->tx_done_mask =3D ATMEL_US_TXEMPTY; else if (atmel_use_pdc_tx(port)) { port->fifosize =3D PDC_BUFFER_SIZE; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14202C07E9D for ; Mon, 26 Sep 2022 10:40:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236207AbiIZKke (ORCPT ); Mon, 26 Sep 2022 06:40:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236270AbiIZKis (ORCPT ); Mon, 26 Sep 2022 06:38:48 -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 5FB594BD0C; Mon, 26 Sep 2022 03:22: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 sin.source.kernel.org (Postfix) with ESMTPS id 909EECE10E0; Mon, 26 Sep 2022 10:22:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74AC0C433D6; Mon, 26 Sep 2022 10:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187742; bh=UOm1MAgdfotlzWdQ47qmCdfr1ChvULKwhYKIK6aiRlU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EWeVufjxfpDkb6Sjv1lV0pWsq0vZ+tHEiOLIckQvzJICmoFbxt81+1BIahR68AoK6 NLHWMYIUoDoUN0jEkBEo2qHnyYWvwdsKG4bmwfWd4ORZCE6a/0Z+24dnHyvOhskS7c qNeiqhUQUFzKZhKUs+SOso0v8vYdR/r8W4AYOR+k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Richard Genoud , Lino Sanfilippo , Sasha Levin Subject: [PATCH 5.4 046/120] serial: atmel: remove redundant assignment in rs485_config Date: Mon, 26 Sep 2022 12:11:19 +0200 Message-Id: <20220926100752.429939336@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lino Sanfilippo [ Upstream commit 60efd0513916f195dd85bfbf21653f74f9ab019c ] In uart_set_rs485_config() the serial core already assigns the passed serial_rs485 struct to the uart port. So remove the assignment from the drivers rs485_config() function to avoid redundancy. Reviewed-by: Claudiu Beznea Acked-by: Richard Genoud Signed-off-by: Lino Sanfilippo Link: https://lore.kernel.org/r/20220410104642.32195-10-LinoSanfilippo@gmx.= de Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 692a8ebcfc24 ("tty: serial: atmel: Preserve previous USART m= ode if RS485 disabled") Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/atmel_serial.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_s= erial.c index e011f3d20224..44608a06bb2c 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -309,11 +309,9 @@ static int atmel_config_rs485(struct uart_port *port, /* Resetting serial mode to RS232 (0x0) */ mode &=3D ~ATMEL_US_USMODE; =20 - port->rs485 =3D *rs485conf; - if (rs485conf->flags & SER_RS485_ENABLED) { dev_dbg(port->dev, "Setting UART to RS485\n"); - if (port->rs485.flags & SER_RS485_RX_DURING_TX) + if (rs485conf->flags & SER_RS485_RX_DURING_TX) atmel_port->tx_done_mask =3D ATMEL_US_TXRDY; else atmel_port->tx_done_mask =3D ATMEL_US_TXEMPTY; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A07D1C07E9D for ; Mon, 26 Sep 2022 10:40:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236240AbiIZKkr (ORCPT ); Mon, 26 Sep 2022 06:40:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236297AbiIZKiw (ORCPT ); Mon, 26 Sep 2022 06:38:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E893953034; Mon, 26 Sep 2022 03:22:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B3E5260AD6; Mon, 26 Sep 2022 10:22:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DFCAC433D6; Mon, 26 Sep 2022 10:22:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187746; bh=u/QO94tfwEdDsCQx8IWsPMwtpNvAXeSMZ1eabfWH5WM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eI378aZxilxDxUGOWLc4qqr8YmmSbtGG8MXY6mN6TRvsyrGC0KViotAUANAf2hFWi ktcjE5XjzPei6pz9KWFF/7L2gI7OG3Quo0VlnwZS7XPeftvuLrf79jAiCweG8wDoU9 s6ILv38rPr0BNNB6Okp7hEthvbv7vJMpUaolB4qo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sergiu Moga , Sasha Levin Subject: [PATCH 5.4 047/120] tty: serial: atmel: Preserve previous USART mode if RS485 disabled Date: Mon, 26 Sep 2022 12:11:20 +0200 Message-Id: <20220926100752.470728066@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergiu Moga [ Upstream commit 692a8ebcfc24f4a5bea0eb2967e450f584193da6 ] Whenever the atmel_rs485_config() driver method would be called, the USART mode is reset to normal mode before even checking if RS485 flag is set, thus resulting in losing the previous USART mode in the case where the checking fails. Some tools, such as `linux-serial-test`, lead to the driver calling this method when doing the setup of the serial port: after setting the port mode (Hardware Flow Control, Normal Mode, RS485 Mode, etc.), `linux-serial-test` tries to enable/disable RS485 depending on the commandline arguments that were passed. Example of how this issue could reveal itself: When doing a serial communication with Hardware Flow Control through `linux-serial-test`, the tool would lead to the driver roughly doing the following: - set the corresponding bit to 1 (ATMEL_US_USMODE_HWHS bit in the ATMEL_US_MR register) through the atmel_set_termios() to enable Hardware Flow Control - disable RS485 through the atmel_config_rs485() method Thus, when the latter is called, the mode will be reset and the previously set bit is unset, leaving USART in normal mode instead of the expected Hardware Flow Control mode. This fix ensures that this reset is only done if the checking for RS485 succeeds and that the previous mode is preserved otherwise. Fixes: e8faff7330a35 ("ARM: 6092/1: atmel_serial: support for RS485 communi= cations") Cc: stable Reviewed-by: Ilpo J=C3=A4rvinen Signed-off-by: Sergiu Moga Link: https://lore.kernel.org/r/20220824142902.502596-1-sergiu.moga@microch= ip.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/atmel_serial.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_s= erial.c index 44608a06bb2c..3bd93558b443 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -306,9 +306,6 @@ static int atmel_config_rs485(struct uart_port *port, =20 mode =3D atmel_uart_readl(port, ATMEL_US_MR); =20 - /* Resetting serial mode to RS232 (0x0) */ - mode &=3D ~ATMEL_US_USMODE; - if (rs485conf->flags & SER_RS485_ENABLED) { dev_dbg(port->dev, "Setting UART to RS485\n"); if (rs485conf->flags & SER_RS485_RX_DURING_TX) @@ -318,6 +315,7 @@ static int atmel_config_rs485(struct uart_port *port, =20 atmel_uart_writel(port, ATMEL_US_TTGR, rs485conf->delay_rts_after_send); + mode &=3D ~ATMEL_US_USMODE; mode |=3D ATMEL_US_USMODE_RS485; } else { dev_dbg(port->dev, "Setting UART to RS232\n"); --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4A31C32771 for ; Mon, 26 Sep 2022 10:41:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236272AbiIZKlB (ORCPT ); Mon, 26 Sep 2022 06:41:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236360AbiIZKjG (ORCPT ); Mon, 26 Sep 2022 06:39:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83D2D53D24; Mon, 26 Sep 2022 03:23:00 -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 B106560BB7; Mon, 26 Sep 2022 10:22:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A097CC433D6; Mon, 26 Sep 2022 10:22:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187749; bh=sQ0KOxyIJ2tE6SiJCJZSw/9TB+BEdLMmOzgVUtu/Y7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yiQkCBtlLEAapPC/K8rP7Mw16yrh3utD0j1qJTOlSuQPF9+94TghI+Y01NwYr+ec4 2hZhUbLDfLNiHXsK7n3QBZNiiNvWKeKnyNU9OlLorweBSNDd1uGlQEXtNaGWklwOTq zsRmMvLNCm9f3L6i8M3UBVmnRGI0jKzIkgyVqGfA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jean-Francois Le Fillatre , stable , Sasha Levin Subject: [PATCH 5.4 048/120] usb: add quirks for Lenovo OneLink+ Dock Date: Mon, 26 Sep 2022 12:11:21 +0200 Message-Id: <20220926100752.518599154@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jean-Francois Le Fillatre [ Upstream commit 3d5f70949f1b1168fbb17d06eb5c57e984c56c58 ] The Lenovo OneLink+ Dock contains two VL812 USB3.0 controllers: 17ef:1018 upstream 17ef:1019 downstream Those two controllers both have problems with some USB3.0 devices, particularly self-powered ones. Typical error messages include: Timeout while waiting for setup device command device not accepting address X, error -62 unable to enumerate USB device By process of elimination the controllers themselves were identified as the cause of the problem. Through trial and error the issue was solved by using USB_QUIRK_RESET_RESUME for both chips. Signed-off-by: Jean-Francois Le Fillatre Cc: stable Link: https://lore.kernel.org/r/20220824191320.17883-1-jflf_kernel@gmx.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/core/quirks.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index f8f2de7899a9..dd7947547054 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -438,6 +438,10 @@ static const struct usb_device_id usb_quirk_list[] =3D= { { USB_DEVICE(0x1532, 0x0116), .driver_info =3D USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, =20 + /* Lenovo ThinkPad OneLink+ Dock twin hub controllers (VIA Labs VL812) */ + { USB_DEVICE(0x17ef, 0x1018), .driver_info =3D USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x17ef, 0x1019), .driver_info =3D USB_QUIRK_RESET_RESUME }, + /* Lenovo USB-C to Ethernet Adapter RTL8153-04 */ { USB_DEVICE(0x17ef, 0x720c), .driver_info =3D USB_QUIRK_NO_LPM }, =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0042EC07E9D for ; Mon, 26 Sep 2022 10:40:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236221AbiIZKki (ORCPT ); Mon, 26 Sep 2022 06:40:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236277AbiIZKit (ORCPT ); Mon, 26 Sep 2022 06:38:49 -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 4AA7F52FCB; Mon, 26 Sep 2022 03:22: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 BFB8560B5E; Mon, 26 Sep 2022 10:22:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B14DDC433C1; Mon, 26 Sep 2022 10:22:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187752; bh=eSH+Q3nt7HTnLu8OPcFSesiYX6gHGCJS0s+HQXDbXT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RpJ07ykN7dLYgRL5yoU1AbXawiW1PY+YkRxpVpabkhrXXtOLn5EYr65TULUWPlILa jfVRn9v0MCb07wMvFY3u8M55L0ejBqaXUpBW0aL+Kzh8ZbJB0GICknr4mnWtXidicS tDp9Tj6aXQIuAyWK5PAAzRI3lMYT1jHuvaMYJaHg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Piyush Mehta , Sasha Levin Subject: [PATCH 5.4 049/120] usb: gadget: udc-xilinx: replace memcpy with memcpy_toio Date: Mon, 26 Sep 2022 12:11:22 +0200 Message-Id: <20220926100752.563452939@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Piyush Mehta [ Upstream commit 8cb339f1c1f04baede9d54c1e40ac96247a6393b ] For ARM processor, unaligned access to device memory is not allowed. Method memcpy does not take care of alignment. USB detection failure with the unaligned address of memory access, with below kernel crash. To fix the unaligned address the kernel panic issue, replace memcpy with memcpy_toio method. Kernel crash: Unable to handle kernel paging request at virtual address ffff80000c05008a Mem abort info: ESR =3D 0x96000061 EC =3D 0x25: DABT (current EL), IL =3D 32 bits SET =3D 0, FnV =3D 0 EA =3D 0, S1PTW =3D 0 FSC =3D 0x21: alignment fault Data abort info: ISV =3D 0, ISS =3D 0x00000061 CM =3D 0, WnR =3D 1 swapper pgtable: 4k pages, 48-bit VAs, pgdp=3D000000000143b000 [ffff80000c05008a] pgd=3D100000087ffff003, p4d=3D100000087ffff003, pud=3D100000087fffe003, pmd=3D1000000800bcc003, pte=3D00680000a0010713 Internal error: Oops: 96000061 [#1] SMP Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.15.19-xilinx-v2022.1 #1 Hardware name: ZynqMP ZCU102 Rev1.0 (DT) pstate: 200000c5 (nzCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) pc : __memcpy+0x30/0x260 lr : __xudc_ep0_queue+0xf0/0x110 sp : ffff800008003d00 x29: ffff800008003d00 x28: ffff800009474e80 x27: 00000000000000a0 x26: 0000000000000100 x25: 0000000000000012 x24: ffff000800bc8080 x23: 0000000000000001 x22: 0000000000000012 x21: ffff000800bc8080 x20: 0000000000000012 x19: ffff000800bc8080 x18: 0000000000000000 x17: ffff800876482000 x16: ffff800008004000 x15: 0000000000004000 x14: 00001f09785d0400 x13: 0103020101005567 x12: 0781400000000200 x11: 00000000c5672a10 x10: 00000000000008d0 x9 : ffff800009463cf0 x8 : ffff8000094757b0 x7 : 0201010055670781 x6 : 4000000002000112 x5 : ffff80000c05009a x4 : ffff000800a15012 x3 : ffff00080362ad80 x2 : 0000000000000012 x1 : ffff000800a15000 x0 : ffff80000c050088 Call trace: __memcpy+0x30/0x260 xudc_ep0_queue+0x3c/0x60 usb_ep_queue+0x38/0x44 composite_ep0_queue.constprop.0+0x2c/0xc0 composite_setup+0x8d0/0x185c configfs_composite_setup+0x74/0xb0 xudc_irq+0x570/0xa40 __handle_irq_event_percpu+0x58/0x170 handle_irq_event+0x60/0x120 handle_fasteoi_irq+0xc0/0x220 handle_domain_irq+0x60/0x90 gic_handle_irq+0x74/0xa0 call_on_irq_stack+0x2c/0x60 do_interrupt_handler+0x54/0x60 el1_interrupt+0x30/0x50 el1h_64_irq_handler+0x18/0x24 el1h_64_irq+0x78/0x7c arch_cpu_idle+0x18/0x2c do_idle+0xdc/0x15c cpu_startup_entry+0x28/0x60 rest_init+0xc8/0xe0 arch_call_rest_init+0x10/0x1c start_kernel+0x694/0x6d4 __primary_switched+0xa4/0xac Fixes: 1f7c51660034 ("usb: gadget: Add xilinx usb2 device support") Cc: stable@vger.kernel.org Reviewed-by: Linus Walleij Signed-off-by: Piyush Mehta Link: https://lore.kernel.org/r/20220824071253.1261096-1-piyush.mehta@amd.c= om Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/gadget/udc/udc-xilinx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/u= dc-xilinx.c index de22dd543653..111d1e6d952f 100644 --- a/drivers/usb/gadget/udc/udc-xilinx.c +++ b/drivers/usb/gadget/udc/udc-xilinx.c @@ -496,11 +496,11 @@ static int xudc_eptxrx(struct xusb_ep *ep, struct xus= b_req *req, /* Get the Buffer address and copy the transmit data.*/ eprambase =3D (u32 __force *)(udc->addr + ep->rambase); if (ep->is_in) { - memcpy(eprambase, bufferptr, bytestosend); + memcpy_toio(eprambase, bufferptr, bytestosend); udc->write_fn(udc->addr, ep->offset + XUSB_EP_BUF0COUNT_OFFSET, bufferlen); } else { - memcpy(bufferptr, eprambase, bytestosend); + memcpy_toio(bufferptr, eprambase, bytestosend); } /* * Enable the buffer for transmission. @@ -514,11 +514,11 @@ static int xudc_eptxrx(struct xusb_ep *ep, struct xus= b_req *req, eprambase =3D (u32 __force *)(udc->addr + ep->rambase + ep->ep_usb.maxpacket); if (ep->is_in) { - memcpy(eprambase, bufferptr, bytestosend); + memcpy_toio(eprambase, bufferptr, bytestosend); udc->write_fn(udc->addr, ep->offset + XUSB_EP_BUF1COUNT_OFFSET, bufferlen); } else { - memcpy(bufferptr, eprambase, bytestosend); + memcpy_toio(bufferptr, eprambase, bytestosend); } /* * Enable the buffer for transmission. @@ -1020,7 +1020,7 @@ static int __xudc_ep0_queue(struct xusb_ep *ep0, stru= ct xusb_req *req) udc->addr); length =3D req->usb_req.actual =3D min_t(u32, length, EP0_MAX_PACKET); - memcpy(corebuf, req->usb_req.buf, length); + memcpy_toio(corebuf, req->usb_req.buf, length); udc->write_fn(udc->addr, XUSB_EP_BUF0COUNT_OFFSET, length); udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET, 1); } else { @@ -1746,7 +1746,7 @@ static void xudc_handle_setup(struct xusb_udc *udc) =20 /* Load up the chapter 9 command buffer.*/ ep0rambase =3D (u32 __force *) (udc->addr + XUSB_SETUP_PKT_ADDR_OFFSET); - memcpy(&setup, ep0rambase, 8); + memcpy_toio(&setup, ep0rambase, 8); =20 udc->setup =3D setup; udc->setup.wValue =3D cpu_to_le16(setup.wValue); @@ -1833,7 +1833,7 @@ static void xudc_ep0_out(struct xusb_udc *udc) (ep0->rambase << 2)); buffer =3D req->usb_req.buf + req->usb_req.actual; req->usb_req.actual =3D req->usb_req.actual + bytes_to_rx; - memcpy(buffer, ep0rambase, bytes_to_rx); + memcpy_toio(buffer, ep0rambase, bytes_to_rx); =20 if (req->usb_req.length =3D=3D req->usb_req.actual) { /* Data transfer completed get ready for Status stage */ @@ -1909,7 +1909,7 @@ static void xudc_ep0_in(struct xusb_udc *udc) (ep0->rambase << 2)); buffer =3D req->usb_req.buf + req->usb_req.actual; req->usb_req.actual =3D req->usb_req.actual + length; - memcpy(ep0rambase, buffer, length); + memcpy_toio(ep0rambase, buffer, length); } udc->write_fn(udc->addr, XUSB_EP_BUF0COUNT_OFFSET, count); udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET, 1); --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D08BC32771 for ; Mon, 26 Sep 2022 10:41:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236279AbiIZKlF (ORCPT ); Mon, 26 Sep 2022 06:41:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236372AbiIZKjI (ORCPT ); Mon, 26 Sep 2022 06:39:08 -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 344184BD34; Mon, 26 Sep 2022 03:22: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 17544CE10EC; Mon, 26 Sep 2022 10:22:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC8E9C433C1; Mon, 26 Sep 2022 10:22:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187755; bh=xP7XOWPMnFeVu890uppPhA3VUfoPZOvUcblwscp7WOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a5YeKm1D6OEhVIUxGa9VPIKW0XuQdLxnq5QyfY+3xR61fqL/tdNqKbTEggxAcU++R q/9eRorin319mhVl3uKvWUag5x+WfRcZa9pqJaHRrWabO8TTRgA3Nqv+Ue9k/FRj2l 2ao4onxkYgzMrtjUe35S3HowhCd5m+lzqncobjak= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Chen , Pawel Laszczak , Sasha Levin Subject: [PATCH 5.4 050/120] usb: cdns3: fix issue with rearming ISO OUT endpoint Date: Mon, 26 Sep 2022 12:11:23 +0200 Message-Id: <20220926100752.602823497@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pawel Laszczak [ Upstream commit b46a6b09fa056042a302b181a1941f0056944603 ] ISO OUT endpoint is enabled during queuing first usb request in transfer ring and disabled when TRBERR is reported by controller. After TRBERR and before next transfer added to TR driver must again reenable endpoint but does not. To solve this issue during processing TRBERR event driver must set the flag EP_UPDATE_EP_TRBADDR in priv_ep->flags field. Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver") cc: Acked-by: Peter Chen Signed-off-by: Pawel Laszczak Link: https://lore.kernel.org/r/20220825062137.5766-1-pawell@cadence.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/cdns3/gadget.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c index 8bedf0504e92..d111cf81cece 100644 --- a/drivers/usb/cdns3/gadget.c +++ b/drivers/usb/cdns3/gadget.c @@ -1259,6 +1259,7 @@ static int cdns3_check_ep_interrupt_proceed(struct cd= ns3_endpoint *priv_ep) ep_cfg &=3D ~EP_CFG_ENABLE; writel(ep_cfg, &priv_dev->regs->ep_cfg); priv_ep->flags &=3D ~EP_QUIRK_ISO_OUT_EN; + priv_ep->flags |=3D EP_UPDATE_EP_TRBADDR; } cdns3_transfer_completed(priv_dev, priv_ep); } else if (!(priv_ep->flags & EP_STALLED) && --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7026C6FA83 for ; Mon, 26 Sep 2022 10:40:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236229AbiIZKkm (ORCPT ); Mon, 26 Sep 2022 06:40:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236301AbiIZKiw (ORCPT ); Mon, 26 Sep 2022 06:38:52 -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 3C79853028; Mon, 26 Sep 2022 03:22: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 E132860B60; Mon, 26 Sep 2022 10:22:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E51CAC433D6; Mon, 26 Sep 2022 10:22:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187758; bh=w9vZUF8bSrbf5AW2P6WQoeDQYs92qFXWsr7CQgk/3HM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EdcT27ZoGg8LhmyP85xJJITJenp7U3IEFcEQ+k6pDXL2Hqx8aMH5G/VySNi3bjH7l sw+DSaKhNlcQZefPEjlGzoBpalDkLJKBXDsQIXqhGp+9JueiPedeoFQh2xx/Ays/VA SeMBXCzzKqtoiKeBHw3h2vpRhXMGk3gZN+Ioctq8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum , Jean-Francois Le Fillatre , stable , Sasha Levin Subject: [PATCH 5.4 051/120] Revert "usb: add quirks for Lenovo OneLink+ Dock" Date: Mon, 26 Sep 2022 12:11:24 +0200 Message-Id: <20220926100752.653206499@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Greg Kroah-Hartman [ Upstream commit 58bfe7d8e31014d7ce246788df99c56e3cfe6c68 ] This reverts commit 3d5f70949f1b1168fbb17d06eb5c57e984c56c58. The quirk does not work properly, more work is needed to determine what should be done here. Reported-by: Oliver Neukum Cc: Jean-Francois Le Fillatre Cc: stable Fixes: 3d5f70949f1b ("usb: add quirks for Lenovo OneLink+ Dock") Link: https://lore.kernel.org/r/9a17ea86-079f-510d-e919-01bc53a6d09f@gmx.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/core/quirks.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index dd7947547054..f8f2de7899a9 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -438,10 +438,6 @@ static const struct usb_device_id usb_quirk_list[] =3D= { { USB_DEVICE(0x1532, 0x0116), .driver_info =3D USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, =20 - /* Lenovo ThinkPad OneLink+ Dock twin hub controllers (VIA Labs VL812) */ - { USB_DEVICE(0x17ef, 0x1018), .driver_info =3D USB_QUIRK_RESET_RESUME }, - { USB_DEVICE(0x17ef, 0x1019), .driver_info =3D USB_QUIRK_RESET_RESUME }, - /* Lenovo USB-C to Ethernet Adapter RTL8153-04 */ { USB_DEVICE(0x17ef, 0x720c), .driver_info =3D USB_QUIRK_NO_LPM }, =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2606C07E9D for ; Mon, 26 Sep 2022 10:41:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236187AbiIZKln (ORCPT ); Mon, 26 Sep 2022 06:41:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236568AbiIZKjj (ORCPT ); Mon, 26 Sep 2022 06:39:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE46C4D16B; Mon, 26 Sep 2022 03:23: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 17E76609D1; Mon, 26 Sep 2022 10:22:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B11BC433D7; Mon, 26 Sep 2022 10:22:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187761; bh=L65YeskGNdwEqYVmw4fkH0H3PybxiCxT/X1mglc6hCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bLZBRoQV0lX3jtxlyY2HMCDWrNRDC3D4/ozNsntsjD3PhkckZ93N44NwZe5UW9pWS 6gLIsekYEo38vscuC48Tdrp8Ila+f6f8giydS4EGHNRMuDHD2SPprWzfXiTlgq9YBP B9xly0hc9V3C9LxKls7QT1W7N8YFUtKcOJFMI2qU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Linus Walleij , Piyush Mehta , Sasha Levin Subject: [PATCH 5.4 052/120] Revert "usb: gadget: udc-xilinx: replace memcpy with memcpy_toio" Date: Mon, 26 Sep 2022 12:11:25 +0200 Message-Id: <20220926100752.690240253@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Greg Kroah-Hartman [ Upstream commit fe0a2ac7c627b064c479ad0c3b25e531d342e048 ] This reverts commit 8cb339f1c1f04baede9d54c1e40ac96247a6393b as it throws up a bunch of sparse warnings as reported by the kernel test robot. Reported-by: kernel test robot Link: https://lore.kernel.org/r/202209020044.CX2PfZzM-lkp@intel.com Fixes: 8cb339f1c1f0 ("usb: gadget: udc-xilinx: replace memcpy with memcpy_t= oio") Cc: stable@vger.kernel.org Cc: Linus Walleij Cc: Piyush Mehta Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/gadget/udc/udc-xilinx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/u= dc-xilinx.c index 111d1e6d952f..de22dd543653 100644 --- a/drivers/usb/gadget/udc/udc-xilinx.c +++ b/drivers/usb/gadget/udc/udc-xilinx.c @@ -496,11 +496,11 @@ static int xudc_eptxrx(struct xusb_ep *ep, struct xus= b_req *req, /* Get the Buffer address and copy the transmit data.*/ eprambase =3D (u32 __force *)(udc->addr + ep->rambase); if (ep->is_in) { - memcpy_toio(eprambase, bufferptr, bytestosend); + memcpy(eprambase, bufferptr, bytestosend); udc->write_fn(udc->addr, ep->offset + XUSB_EP_BUF0COUNT_OFFSET, bufferlen); } else { - memcpy_toio(bufferptr, eprambase, bytestosend); + memcpy(bufferptr, eprambase, bytestosend); } /* * Enable the buffer for transmission. @@ -514,11 +514,11 @@ static int xudc_eptxrx(struct xusb_ep *ep, struct xus= b_req *req, eprambase =3D (u32 __force *)(udc->addr + ep->rambase + ep->ep_usb.maxpacket); if (ep->is_in) { - memcpy_toio(eprambase, bufferptr, bytestosend); + memcpy(eprambase, bufferptr, bytestosend); udc->write_fn(udc->addr, ep->offset + XUSB_EP_BUF1COUNT_OFFSET, bufferlen); } else { - memcpy_toio(bufferptr, eprambase, bytestosend); + memcpy(bufferptr, eprambase, bytestosend); } /* * Enable the buffer for transmission. @@ -1020,7 +1020,7 @@ static int __xudc_ep0_queue(struct xusb_ep *ep0, stru= ct xusb_req *req) udc->addr); length =3D req->usb_req.actual =3D min_t(u32, length, EP0_MAX_PACKET); - memcpy_toio(corebuf, req->usb_req.buf, length); + memcpy(corebuf, req->usb_req.buf, length); udc->write_fn(udc->addr, XUSB_EP_BUF0COUNT_OFFSET, length); udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET, 1); } else { @@ -1746,7 +1746,7 @@ static void xudc_handle_setup(struct xusb_udc *udc) =20 /* Load up the chapter 9 command buffer.*/ ep0rambase =3D (u32 __force *) (udc->addr + XUSB_SETUP_PKT_ADDR_OFFSET); - memcpy_toio(&setup, ep0rambase, 8); + memcpy(&setup, ep0rambase, 8); =20 udc->setup =3D setup; udc->setup.wValue =3D cpu_to_le16(setup.wValue); @@ -1833,7 +1833,7 @@ static void xudc_ep0_out(struct xusb_udc *udc) (ep0->rambase << 2)); buffer =3D req->usb_req.buf + req->usb_req.actual; req->usb_req.actual =3D req->usb_req.actual + bytes_to_rx; - memcpy_toio(buffer, ep0rambase, bytes_to_rx); + memcpy(buffer, ep0rambase, bytes_to_rx); =20 if (req->usb_req.length =3D=3D req->usb_req.actual) { /* Data transfer completed get ready for Status stage */ @@ -1909,7 +1909,7 @@ static void xudc_ep0_in(struct xusb_udc *udc) (ep0->rambase << 2)); buffer =3D req->usb_req.buf + req->usb_req.actual; req->usb_req.actual =3D req->usb_req.actual + length; - memcpy_toio(ep0rambase, buffer, length); + memcpy(ep0rambase, buffer, length); } udc->write_fn(udc->addr, XUSB_EP_BUF0COUNT_OFFSET, count); udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET, 1); --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DECDC07E9D for ; Mon, 26 Sep 2022 10:41:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236308AbiIZKlZ (ORCPT ); Mon, 26 Sep 2022 06:41:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236497AbiIZKj1 (ORCPT ); Mon, 26 Sep 2022 06:39: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 28AB3543C8; Mon, 26 Sep 2022 03:23:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E492DB80920; Mon, 26 Sep 2022 10:22:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 357A2C433C1; Mon, 26 Sep 2022 10:22:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187764; bh=x21yaR2rkMpS2SZMCRYG8W6Wv1BSzes0QdbCq23VUQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kHZySPkphy7v8EJzwbE6C4fAYUQhorBcJ0CSwiQuId1FE8bELEXYbhcVUk6FvgNWz uLErhwsH9Ztfu+7Hf5q40ICz4PJYKGBPT8GNvQ9621WkGS2uvUXpF3lUXcfxPD+YGl Zc59zEnVh+LYionFfNZdoR+b6D6NEE/WjQ/AnDaY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Rothwell , Bagas Sanjaya , Alan Stern Subject: [PATCH 5.4 053/120] USB: core: Fix RST error in hub.c Date: Mon, 26 Sep 2022 12:11:26 +0200 Message-Id: <20220926100752.739857509@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alan Stern commit 766a96dc558385be735a370db867e302c8f22153 upstream. A recent commit added an invalid RST expression to a kerneldoc comment in hub.c. The fix is trivial. Fixes: 9c6d778800b9 ("USB: core: Prevent nested device-reset calls") Cc: Reported-by: Stephen Rothwell Reviewed-by: Bagas Sanjaya Signed-off-by: Alan Stern Link: https://lore.kernel.org/r/YxDDcsLtRZ7c20pq@rowland.harvard.edu Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/core/hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -5924,7 +5924,7 @@ re_enumerate_no_bos: * * Return: The same as for usb_reset_and_verify_device(). * However, if a reset is already in progress (for instance, if a - * driver doesn't have pre_ or post_reset() callbacks, and while + * driver doesn't have pre_reset() or post_reset() callbacks, and while * being unbound or re-bound during the ongoing reset its disconnect() * or probe() routine tries to perform a second, nested reset), the * routine returns -EINPROGRESS. From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60BD3C07E9D for ; Mon, 26 Sep 2022 10:41:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236303AbiIZKlR (ORCPT ); Mon, 26 Sep 2022 06:41:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236436AbiIZKjS (ORCPT ); Mon, 26 Sep 2022 06:39:18 -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 ECF2653D0E; Mon, 26 Sep 2022 03:23: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 4E5A560B2F; Mon, 26 Sep 2022 10:22:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52627C433D7; Mon, 26 Sep 2022 10:22:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187770; bh=4dbwDwZ0eBnfjVz2XPlQVhmi10ewahaSZNSGTnSir1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zuO90YR1bmBpJWWR7W3jgxj+B/uKmiOfRnJGR3i3kQQB3YwMzULOgE9Ryfsa/DmFW 2NrKba1YEuiL67sG8/N+cVMxoGF7CLdvs2pvQr5+ExLztEDFoRUz1hgePP0KuV2o2g jUs2BdyIWyHdiihsJdxgtfYggimQVxpjSHVfPT/c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Carl Yin , Johan Hovold Subject: [PATCH 5.4 054/120] USB: serial: option: add Quectel BG95 0x0203 composition Date: Mon, 26 Sep 2022 12:11:27 +0200 Message-Id: <20220926100752.771935112@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Carl Yin(=E6=AE=B7=E5=BC=A0=E6=88=90) commit f8f67eff6847f9b8d753fa029723bcc54296055a upstream. Add support for the following Quectel BG95 composition: 0x0203: Diag + GNSS + Modem + ECM usb-devices output: T: Bus=3D01 Lev=3D01 Prnt=3D01 Port=3D03 Cnt=3D01 Dev#=3D 2 Spd=3D480 Mx= Ch=3D 0 D: Ver=3D 2.00 Cls=3Def(misc ) Sub=3D02 Prot=3D01 MxPS=3D64 #Cfgs=3D 1 P: Vendor=3D2c7c ProdID=3D0203 Rev=3D 0.00 S: Manufacturer=3DQuectel, Incorporated S: Product=3DQuectel LPWA Module S: SerialNumber=3D71d3a21b C:* #Ifs=3D 5 Cfg#=3D 1 Atr=3De0 MxPwr=3D500mA A: FirstIf#=3D 3 IfCount=3D 2 Cls=3D02(comm.) Sub=3D00 Prot=3D00 I:* If#=3D 0 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3D30 Driver= =3Doption E: Ad=3D81(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D01(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 1 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3D60 Driver= =3Doption E: Ad=3D82(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D02(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 2 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption E: Ad=3D83(I) Atr=3D03(Int.) MxPS=3D 64 Ivl=3D2ms E: Ad=3D84(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D03(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 3 Alt=3D 0 #EPs=3D 1 Cls=3D02(comm.) Sub=3D06 Prot=3D00 Driver= =3Dcdc_ether E: Ad=3D85(I) Atr=3D03(Int.) MxPS=3D 64 Ivl=3D2ms I: If#=3D 4 Alt=3D 0 #EPs=3D 0 Cls=3D0a(data ) Sub=3D00 Prot=3D00 Driver= =3Dcdc_ether I:* If#=3D 4 Alt=3D 1 #EPs=3D 2 Cls=3D0a(data ) Sub=3D00 Prot=3D00 Driver= =3Dcdc_ether E: Ad=3D86(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D04(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms Signed-off-by: Carl Yin Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -1138,6 +1138,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, = 0xff, 0xff, 0xff), .driver_info =3D NUMEP2 }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, = 0xff, 0, 0) }, + { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, 0x0203, 0xff), /* BG95-M3= */ + .driver_info =3D ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info =3D RSVD(4) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, = 0xff, 0xff, 0xff), From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E68B3C07E9D for ; Mon, 26 Sep 2022 10:41:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236287AbiIZKlJ (ORCPT ); Mon, 26 Sep 2022 06:41:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236389AbiIZKjK (ORCPT ); Mon, 26 Sep 2022 06:39:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAD5753D15; Mon, 26 Sep 2022 03:23: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 17CA4B8091F; Mon, 26 Sep 2022 10:22:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5373FC433C1; Mon, 26 Sep 2022 10:22:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187773; bh=OnHJPjH4h6Nbsq01JGvqFhs1so7/TP+GxApbv3kVy+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T+vLoVTcXna9hhbiw1F+i7xr5c3BRfeqhD6WzuPB6070Ade9BhGUfTEc4olWvQDDG Tx/7ApJggyaG8dviG6ZqQQx13l+vvNMDNLx/cjSkQeM4q+OFb7vTlvgDtFV+4frv6D dNXZKdCrop9vkd2zPZ+4aX02heC069diedpFr7OU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, jerry meng , Johan Hovold Subject: [PATCH 5.4 055/120] USB: serial: option: add Quectel RM520N Date: Mon, 26 Sep 2022 12:11:28 +0200 Message-Id: <20220926100752.811157042@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: jerry meng commit d640c4cb8f2f933c0ca896541f9de7fb1ae245f4 upstream. add support for Quectel RM520N which is based on Qualcomm SDX62 chip. 0x0801: DIAG + NMEA + AT + MODEM + RMNET T: Bus=3D03 Lev=3D01 Prnt=3D01 Port=3D01 Cnt=3D02 Dev#=3D 10 Spd=3D480 Mx= Ch=3D 0 D: Ver=3D 2.10 Cls=3D00(>ifc ) Sub=3D00 Prot=3D00 MxPS=3D64 #Cfgs=3D 1 P: Vendor=3D2c7c ProdID=3D0801 Rev=3D 5.04 S: Manufacturer=3DQuectel S: Product=3DRM520N-GL S: SerialNumber=3D384af524 C:* #Ifs=3D 5 Cfg#=3D 1 Atr=3Da0 MxPwr=3D500mA I:* If#=3D 0 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3D30 Driver= =3Doption E: Ad=3D01(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D81(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 1 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D40 Driver= =3Doption E: Ad=3D83(I) Atr=3D03(Int.) MxPS=3D 10 Ivl=3D32ms E: Ad=3D82(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D02(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 2 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption E: Ad=3D85(I) Atr=3D03(Int.) MxPS=3D 10 Ivl=3D32ms E: Ad=3D84(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D03(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 3 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption E: Ad=3D87(I) Atr=3D03(Int.) MxPS=3D 10 Ivl=3D32ms E: Ad=3D86(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D04(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms I:* If#=3D 4 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Dqmi_wwan E: Ad=3D88(I) Atr=3D03(Int.) MxPS=3D 8 Ivl=3D32ms E: Ad=3D8e(I) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms E: Ad=3D0f(O) Atr=3D02(Bulk) MxPS=3D 512 Ivl=3D0ms Signed-off-by: jerry meng Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/serial/option.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -256,6 +256,7 @@ static void option_instat_callback(struc #define QUECTEL_PRODUCT_EM060K 0x030b #define QUECTEL_PRODUCT_EM12 0x0512 #define QUECTEL_PRODUCT_RM500Q 0x0800 +#define QUECTEL_PRODUCT_RM520N 0x0801 #define QUECTEL_PRODUCT_EC200S_CN 0x6002 #define QUECTEL_PRODUCT_EC200T 0x6026 #define QUECTEL_PRODUCT_RM500K 0x7001 @@ -1161,6 +1162,9 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q= , 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q= , 0xff, 0xff, 0x10), .driver_info =3D ZLP }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N= , 0xff, 0xff, 0x30) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N= , 0xff, 0, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N= , 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S= _CN, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T= , 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500K= , 0xff, 0x00, 0x00) }, From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A293C6FA83 for ; Mon, 26 Sep 2022 10:40:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236244AbiIZKkv (ORCPT ); Mon, 26 Sep 2022 06:40:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236338AbiIZKjC (ORCPT ); Mon, 26 Sep 2022 06:39: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 D98054CA2A; Mon, 26 Sep 2022 03:22: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 72A9C60C13; Mon, 26 Sep 2022 10:22:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DCA7C433D7; Mon, 26 Sep 2022 10:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187776; bh=hcZDXeQDxdVuyJ5ymRRkRVN0FZjYJSq5O2pvudqyo+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fHTuJZO5AFfxlTEDbmS+zRBGdrtmHJXRLrbORHPLdqIokESdPyrsLMu6K6s6LkLc1 RPXZnemByD4fYKKICjyjmp2KORePNUWL60wkWalp1Rsd8aD0S9ohn+IqMaJAQ1M3+E ZVwLwksIljc0LMeBHKxbPGEK3wI28QEE1D2Bv6II= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mohan Kumar , Takashi Iwai Subject: [PATCH 5.4 056/120] ALSA: hda/tegra: set depop delay for tegra Date: Mon, 26 Sep 2022 12:11:29 +0200 Message-Id: <20220926100752.849014990@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mohan Kumar commit 3c4d8c24fb6c44f426e447b04800b0ed61a7b5ae upstream. Reduce the suspend time by setting depop delay to 10ms for tegra. Signed-off-by: Mohan Kumar Cc: Link: https://lore.kernel.org/r/20220913053641.23299-1-mkumard@nvidia.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_hdmi.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -3703,6 +3703,7 @@ static int patch_tegra_hdmi(struct hda_c if (err) return err; =20 + codec->depop_delay =3D 10; codec->patch_ops.build_pcms =3D tegra_hdmi_build_pcms; spec =3D codec->spec; spec->chmap.ops.chmap_cea_alloc_validate_get_type =3D From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69554C6FA83 for ; Mon, 26 Sep 2022 10:42:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234398AbiIZKme (ORCPT ); Mon, 26 Sep 2022 06:42:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236281AbiIZKlI (ORCPT ); Mon, 26 Sep 2022 06:41:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B119D214; Mon, 26 Sep 2022 03:24:00 -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 4F12660AD6; Mon, 26 Sep 2022 10:23:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E6D9C433D7; Mon, 26 Sep 2022 10:22:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187779; bh=KGqJ0VQSvpJUltYutgQQm7E+eUEUVgDu+klqCsdNfa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xeqP/UQsXyJjjJAdrbN4+GWu6kUn5wpNRp+hF7NY7EdtrMEPhXr/pMbuBeI2/oCN6 2vbyYLyZ7ShkZM9FO8Am21wowE+f9xEuSSGgl7PvxIJYM6TLMw060xWlcT7xLS5YqY 1BLmiBV1LC579OQ8gd0YcXZEszbwyQMs8332wVpk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Vehmanen , Takashi Iwai Subject: [PATCH 5.4 057/120] ALSA: hda: add Intel 5 Series / 3400 PCI DID Date: Mon, 26 Sep 2022 12:11:30 +0200 Message-Id: <20220926100752.900612834@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kai Vehmanen commit 4d40ceef4745536289012670103c59264e0fb3ec upstream. Handle 0x3b57 variant with same AZX_DCAPS_INTEL_PCH_NOPM capabilities as 0x3b56. In practise this allow use of HDMI/DP display audio via i915. BugLink: https://gitlab.freedesktop.org/drm/intel/-/issues/2751 Signed-off-by: Kai Vehmanen Cc: Link: https://lore.kernel.org/r/20220912183716.2126312-1-kai.vehmanen@linux= .intel.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/hda_intel.c | 2 ++ 1 file changed, 2 insertions(+) --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2528,6 +2528,8 @@ static const struct pci_device_id azx_id /* 5 Series/3400 */ { PCI_DEVICE(0x8086, 0x3b56), .driver_data =3D AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, + { PCI_DEVICE(0x8086, 0x3b57), + .driver_data =3D AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, /* Poulsbo */ { PCI_DEVICE(0x8086, 0x811b), .driver_data =3D AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE }, From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CA39C07E9D for ; Mon, 26 Sep 2022 10:41:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236190AbiIZKlq (ORCPT ); Mon, 26 Sep 2022 06:41:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236608AbiIZKjq (ORCPT ); Mon, 26 Sep 2022 06:39:46 -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 E50E3543C7; Mon, 26 Sep 2022 03:23:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0BBD6B80682; Mon, 26 Sep 2022 10:23:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 555E5C433D7; Mon, 26 Sep 2022 10:23:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187782; bh=rGqqQmKZ+hBQnAZKtXxSq6w/2dvaCU5FzgOVx500toY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P1AYfWtvZYKPuurYDTvAGmTr36hyYLkV5rW/TTbHaU26iPteyCGuMM4DV/0ZUotKk hSJYNVGGDqWqKUUl2VWmRgTgrDpfTUBf6fE6BewTfveObfnhdJ7EgdmMHtIKOfc7V5 ijwcmc0yr7R2iLuF7wmpTPBCd271iMGx9Tly3pGA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, huangwenhui , Takashi Iwai Subject: [PATCH 5.4 058/120] ALSA: hda/realtek: Add quirk for Huawei WRT-WX9 Date: Mon, 26 Sep 2022 12:11:31 +0200 Message-Id: <20220926100752.937031071@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: huangwenhui commit cbcdf8c4d35cd74aee8581eb2f0453e0ecab7b05 upstream. Fixes headphone and headset microphone detection on Huawei WRT-WX9. Signed-off-by: huangwenhui Cc: Link: https://lore.kernel.org/r/20220913054622.15979-1-huangwenhuia@unionte= ch.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8425,6 +8425,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH= _WX9_PINS), + SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO= _PRESENCE), SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20), SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI), SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101), From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E0E9C32771 for ; Mon, 26 Sep 2022 10:41:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236306AbiIZKlU (ORCPT ); Mon, 26 Sep 2022 06:41:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236467AbiIZKjX (ORCPT ); Mon, 26 Sep 2022 06:39:23 -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 3C8D253D3B; Mon, 26 Sep 2022 03:23: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 sin.source.kernel.org (Postfix) with ESMTPS id 9126ACE10E0; Mon, 26 Sep 2022 10:23:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8061DC433C1; Mon, 26 Sep 2022 10:23:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187786; bh=qY2fz8lgznewsjTnbsc1p+30NBeMG3/B2zvlnqTCHTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OLY9aqJ1fdKjweu9pwfzak+C/IJoG4GqlQsC2GNdxfu9xtMC5yhtKKCNHq8i87oPp XqfyhkcwoPogRVTX4rwR+G1P0Sh+WLX55ePyH8L2c+Som53fWk/jy7gcmkvM2dtmae SZCe2gdp8BqfiwHk/M18pCE6Dpx/yQYp/DE5iW/A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.4 059/120] ALSA: hda/realtek: Re-arrange quirk table entries Date: Mon, 26 Sep 2022 12:11:32 +0200 Message-Id: <20220926100752.984771278@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai commit b16c8f229a58eaddfc58aab447253464abd3c85e upstream. A few entries have been mistakenly inserted in wrong positions without considering the SSID ordering. Place them at right positions. Fixes: b7557267c233 ("ALSA: hda/realtek: Add quirk for ASUS GA402") Fixes: 94db9cc8f8fa ("ALSA: hda/realtek: Add quirk for ASUS GU603") Fixes: 739d0959fbed ("ALSA: hda: Add quirk for ASUS Flow x13") Cc: Link: https://lore.kernel.org/r/20220915154724.31634-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8229,10 +8229,11 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_Z= ENBOOK), SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_Z= ENBOOK_UX31A), + SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK), + SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS), SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), - SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK), SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX50= 2_PINS), SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_M= IC), SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_M= IC), @@ -8248,13 +8249,12 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRE= SENCE), SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOO= ST), SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS= _GA401), SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA50= 2), SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU50= 2_PINS), SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA40= 1), SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA40= 1), - SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS= _GA401), - SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2= ), SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11757C32771 for ; Mon, 26 Sep 2022 10:42:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236387AbiIZKmR (ORCPT ); Mon, 26 Sep 2022 06:42:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236222AbiIZKkj (ORCPT ); Mon, 26 Sep 2022 06:40:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 160CA4D176; Mon, 26 Sep 2022 03:24:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A928060C07; Mon, 26 Sep 2022 10:23:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA7EBC433C1; Mon, 26 Sep 2022 10:23:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187789; bh=tOpRTScNTYqFlhBKjkopRbmmvncO6LPRlcICQCyskfg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fh7MtMb7Cf4u321UuyqiX01fUh695r6YBPLx59hafd/k8SgaaTy/CMS/biBji3kl4 B+Mkfz3eUFugcdwMaguFQ37Tc/4Xe1jtopCjrfBSBwGMHIWCRP7C/emHjElYDCUYHh rDlEjZ+WEf9qB09vFsbnCTN6/6xeDx6x0YrUIZww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Luke D. Jones" , Takashi Iwai Subject: [PATCH 5.4 060/120] ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack Date: Mon, 26 Sep 2022 12:11:33 +0200 Message-Id: <20220926100753.026777601@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luke D. Jones commit c611e659044168e7abcbae8ba1ea833521498fbb upstream. Fixes up the pincfg for ASUS ROG Strix G513 headphone and mic combo jack [ Fixed the position in the quirk table by tiwai ] Signed-off-by: Luke D. Jones Cc: Link: https://lore.kernel.org/r/20220915080921.35563-2-luke@ljones.dev Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6484,6 +6484,7 @@ enum { ALC294_FIXUP_ASUS_GU502_HP, ALC294_FIXUP_ASUS_GU502_PINS, ALC294_FIXUP_ASUS_GU502_VERBS, + ALC294_FIXUP_ASUS_G513_PINS, ALC285_FIXUP_HP_GPIO_LED, ALC285_FIXUP_HP_MUTE_LED, ALC236_FIXUP_HP_GPIO_LED, @@ -7761,6 +7762,15 @@ static const struct hda_fixup alc269_fix .type =3D HDA_FIXUP_FUNC, .v.func =3D alc294_fixup_gu502_hp, }, + [ALC294_FIXUP_ASUS_G513_PINS] =3D { + .type =3D HDA_FIXUP_PINS, + .v.pins =3D (const struct hda_pintbl[]) { + { 0x19, 0x03a11050 }, /* front HP mic */ + { 0x1a, 0x03a11c30 }, /* rear external mic */ + { 0x21, 0x03211420 }, /* front HP out */ + { } + }, + }, [ALC294_FIXUP_ASUS_COEF_1B] =3D { .type =3D HDA_FIXUP_VERBS, .v.verbs =3D (const struct hda_verb[]) { @@ -8253,6 +8263,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA50= 2), SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU50= 2_PINS), + SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G5= 13_PINS), SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA40= 1), SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA40= 1), SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2= ), From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F538C32771 for ; Mon, 26 Sep 2022 10:41:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236172AbiIZKlN (ORCPT ); Mon, 26 Sep 2022 06:41:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236417AbiIZKjQ (ORCPT ); Mon, 26 Sep 2022 06:39:16 -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 1B96A4D148; Mon, 26 Sep 2022 03:23: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 E7D6360BAF; Mon, 26 Sep 2022 10:23:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7424C433C1; Mon, 26 Sep 2022 10:23:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187792; bh=X04OHgw+DxFh+oL/0lcLqlkZcBZ0P4XflcwcsMPbMzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FD6cGMiMdymPe18QksTx3ACSwSQNmQVM3Uk44I+X/nmLA1yborAOZuSjlMGBeKZz6 muEznz9MEfXGl4m7+ARMME6+HJI8KlEiZWXBdMetRg/7uhDUbzJVBY7MyHdP3lEWo4 T2VUgvHETCYeq1nWUWZJr26RxuCD+JbkoJAM8+Ro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Luke D. Jones" , Takashi Iwai Subject: [PATCH 5.4 061/120] ALSA: hda/realtek: Add pincfg for ASUS G533Z HP jack Date: Mon, 26 Sep 2022 12:11:34 +0200 Message-Id: <20220926100753.184087346@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luke D. Jones commit bc2c23549ccd7105eb6ff0d4f0ac519285628673 upstream. Fixes up the pincfg for ASUS ROG Strix G15 (G533Z) headphone combo jack [ Fixed the position in the quirk table by tiwai ] Signed-off-by: Luke D. Jones Cc: Link: https://lore.kernel.org/r/20220915080921.35563-3-luke@ljones.dev Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6485,6 +6485,7 @@ enum { ALC294_FIXUP_ASUS_GU502_PINS, ALC294_FIXUP_ASUS_GU502_VERBS, ALC294_FIXUP_ASUS_G513_PINS, + ALC285_FIXUP_ASUS_G533Z_PINS, ALC285_FIXUP_HP_GPIO_LED, ALC285_FIXUP_HP_MUTE_LED, ALC236_FIXUP_HP_GPIO_LED, @@ -7771,6 +7772,15 @@ static const struct hda_fixup alc269_fix { } }, }, + [ALC285_FIXUP_ASUS_G533Z_PINS] =3D { + .type =3D HDA_FIXUP_PINS, + .v.pins =3D (const struct hda_pintbl[]) { + { 0x14, 0x90170120 }, + { } + }, + .chained =3D true, + .chain_id =3D ALC294_FIXUP_ASUS_G513_PINS, + }, [ALC294_FIXUP_ASUS_COEF_1B] =3D { .type =3D HDA_FIXUP_VERBS, .v.verbs =3D (const struct hda_verb[]) { @@ -8258,6 +8268,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRE= SENCE), SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOO= ST), + SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G53= 3Z_PINS), SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS= _GA401), SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E564C07E9D for ; Mon, 26 Sep 2022 10:42:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236382AbiIZKmN (ORCPT ); Mon, 26 Sep 2022 06:42:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236211AbiIZKkh (ORCPT ); Mon, 26 Sep 2022 06:40:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A439E543DE; Mon, 26 Sep 2022 03:24: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 EC92760A5C; Mon, 26 Sep 2022 10:23:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDC0EC433C1; Mon, 26 Sep 2022 10:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187795; bh=b6qvDLbU9WXzBEoN8ULEK7TzDkyXP7uu1A+Izne3E/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c66mOm+OprdHFsebIFeLJ9Ap7gTaN1+FxjEEt5KFXMM/au6DIhHTH3KEtTRD5rkeO TTUkuYqnXRGaK4/CsDNbS1F9kzCDbdtTFJg12aDjNRUtFSHjNCL0TBTL1OZxUoZBDK Ikr+A9jz6UaLJWJNb6l3nXCV37FlFvFKiIhymVx8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Luke D. Jones" , Takashi Iwai Subject: [PATCH 5.4 062/120] ALSA: hda/realtek: Add quirk for ASUS GA503R laptop Date: Mon, 26 Sep 2022 12:11:35 +0200 Message-Id: <20220926100753.231330587@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luke D. Jones commit ba1f818053b0668a1ce2fe86b840e81b592cc560 upstream. The ASUS G15 2022 (GA503R) series laptop has the same node-to-DAC pairs as early models and the G14, this includes bass speakers which are by default mapped incorrectly to the 0x06 node. Add a quirk to use the same DAC pairs as the G14. Signed-off-by: Luke D. Jones Cc: Link: https://lore.kernel.org/r/20220915080921.35563-4-luke@ljones.dev Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8276,6 +8276,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU50= 2_PINS), SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G5= 13_PINS), SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA40= 1), + SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS= _GA401), SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA40= 1), SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2= ), SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8F08C32771 for ; Mon, 26 Sep 2022 10:41:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236327AbiIZKlk (ORCPT ); Mon, 26 Sep 2022 06:41:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236557AbiIZKjh (ORCPT ); Mon, 26 Sep 2022 06:39:37 -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 4E6E748E9F; Mon, 26 Sep 2022 03:23:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C2521B8091F; Mon, 26 Sep 2022 10:23:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D72BC433B5; Mon, 26 Sep 2022 10:23:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187798; bh=LBv4uS3cJFD6yDQq1Yv4yEh6RIfrs4dFU20K7SPW2qM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pl+JBXNERIhml0CjF4W/iyTC56Q6mIfgXHhtEOw+nl/SH/zWIJTGfnxTZhgDbOb4d 6JIRLdg4WBELF3ydoI3J7AxqCP9c3wW3AFZTAoe/mKcTjY10kZnT7P89a/PGEc18PP 5w3mbyqdSerxiBktG4JjEx+jyj2J7k0Yk0VTB5v4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Callum Osmotherly , Takashi Iwai Subject: [PATCH 5.4 063/120] ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5530 laptop Date: Mon, 26 Sep 2022 12:11:36 +0200 Message-Id: <20220926100753.264823201@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Callum Osmotherly commit 1885ff13d4c42910b37a0e3f7c2f182520f4eed1 upstream. Just as with the 5570 (and the other Dell laptops), this enables the two subwoofer speakers on the Dell Precision 5530 together with the main ones, significantly increasing the audio quality. I've tested this myself on a 5530 and can confirm it's working as expected. Signed-off-by: Callum Osmotherly Cc: Link: https://lore.kernel.org/r/YyMjQO3mhyXlMbCf@piranha Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8138,6 +8138,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HE= ADSET_MIC), SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HE= ADSET_MIC), SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_L= INEOUT_VERB), + SND_PCI_QUIRK(0x1028, 0x087d, "Dell Precision 5530", ALC289_FIXUP_DUAL_SP= K), SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO= _MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_P= RESENCE), SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5741C32771 for ; Mon, 26 Sep 2022 10:44:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233563AbiIZKoy (ORCPT ); Mon, 26 Sep 2022 06:44:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236284AbiIZKmc (ORCPT ); Mon, 26 Sep 2022 06:42:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 496274D4E1; Mon, 26 Sep 2022 03:24:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EBD6AB80926; Mon, 26 Sep 2022 10:23:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59D28C43149; Mon, 26 Sep 2022 10:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187804; bh=hHUaDJrxc6E0aVhxiuBcXlPxNUtmBzy1sqbl3JBWaKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kiXMl7ihjiKplaf9jiCV38tym7DSwdAdbbZecDsIeGvfi7XDGFw69/dHlgDs4mNUp eSC3PzYNN+alTJsI0bVk3VSWnZ6QmXivPudtriS6FO5FES9e6VLDmidqC7SVCloT8N QIFp8FQIjzpo7KinGtzQ4vQD5C0DW5Pv0IZJnPZc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Ilias Apalodimas , Peter Jones Subject: [PATCH 5.4 064/120] efi: libstub: check Shim mode using MokSBStateRT Date: Mon, 26 Sep 2022 12:11:37 +0200 Message-Id: <20220926100753.312509950@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel commit 5f56a74cc0a6d9b9f8ba89cea29cd7c4774cb2b1 upstream. We currently check the MokSBState variable to decide whether we should treat UEFI secure boot as being disabled, even if the firmware thinks otherwise. This is used by shim to indicate that it is not checking signatures on boot images. In the kernel, we use this to relax lockdown policies. However, in cases where shim is not even being used, we don't want this variable to interfere with lockdown, given that the variable may be non-volatile and therefore persist across a reboot. This means setting it once will persistently disable lockdown checks on a given system. So switch to the mirrored version of this variable, called MokSBStateRT, which is supposed to be volatile, and this is something we can check. Cc: # v4.19+ Signed-off-by: Ard Biesheuvel Reviewed-by: Ilias Apalodimas Reviewed-by: Peter Jones Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/firmware/efi/libstub/secureboot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/firmware/efi/libstub/secureboot.c +++ b/drivers/firmware/efi/libstub/secureboot.c @@ -19,7 +19,7 @@ static const efi_char16_t efi_SetupMode_ =20 /* SHIM variables */ static const efi_guid_t shim_guid =3D EFI_SHIM_LOCK_GUID; -static const efi_char16_t shim_MokSBState_name[] =3D L"MokSBState"; +static const efi_char16_t shim_MokSBState_name[] =3D L"MokSBStateRT"; =20 #define get_efi_var(name, vendor, ...) \ efi_call_runtime(get_variable, \ @@ -58,8 +58,8 @@ enum efi_secureboot_mode efi_get_secureb =20 /* * See if a user has put the shim into insecure mode. If so, and if the - * variable doesn't have the runtime attribute set, we might as well - * honor that. + * variable doesn't have the non-volatile attribute set, we might as + * well honor that. */ size =3D sizeof(moksbstate); status =3D get_efi_var(shim_MokSBState_name, &shim_guid, @@ -68,7 +68,7 @@ enum efi_secureboot_mode efi_get_secureb /* If it fails, we don't care why. Default to secure */ if (status !=3D EFI_SUCCESS) goto secure_boot_enabled; - if (!(attr & EFI_VARIABLE_RUNTIME_ACCESS) && moksbstate =3D=3D 1) + if (!(attr & EFI_VARIABLE_NON_VOLATILE) && moksbstate =3D=3D 1) return efi_secureboot_mode_disabled; =20 secure_boot_enabled: From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 227E4C32771 for ; Mon, 26 Sep 2022 10:41:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236015AbiIZKla (ORCPT ); Mon, 26 Sep 2022 06:41:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236501AbiIZKj2 (ORCPT ); Mon, 26 Sep 2022 06:39:28 -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 D9F6B4D15C; Mon, 26 Sep 2022 03:23: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 8CDA460B2F; Mon, 26 Sep 2022 10:23:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5048BC433D6; Mon, 26 Sep 2022 10:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187808; bh=pZBlqy+MLlyTpWtUdAz5D06w7QXEQEmHyBZwybIOafc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qZ8tDRJz4S7aS/4rHF0oU36emiXiNbTkTs0RKFotmbl7AU3YoicAXdbZJcKJkqkqQ YQ2tcfHvLyxHjrYWj0vWLwdaBPOc8meR65njxbMb//89gCpNkQk5NX2MXl4F7MI2uO VqIPdIP9LJOJubYWds4Im47tzkc4g6ErwRm0ut/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, syzbot+81684812ea68216e08c5@syzkaller.appspotmail.com, Muchun Song , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Chao Yu , David Rientjes , Vlastimil Babka Subject: [PATCH 5.4 065/120] mm/slub: fix to return errno if kmalloc() fails Date: Mon, 26 Sep 2022 12:11:38 +0200 Message-Id: <20220926100753.362508743@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chao Yu commit 7e9c323c52b379d261a72dc7bd38120a761a93cd upstream. In create_unique_id(), kmalloc(, GFP_KERNEL) can fail due to out-of-memory, if it fails, return errno correctly rather than triggering panic via BUG_ON(); kernel BUG at mm/slub.c:5893! Internal error: Oops - BUG: 0 [#1] PREEMPT SMP Call trace: sysfs_slab_add+0x258/0x260 mm/slub.c:5973 __kmem_cache_create+0x60/0x118 mm/slub.c:4899 create_cache mm/slab_common.c:229 [inline] kmem_cache_create_usercopy+0x19c/0x31c mm/slab_common.c:335 kmem_cache_create+0x1c/0x28 mm/slab_common.c:390 f2fs_kmem_cache_create fs/f2fs/f2fs.h:2766 [inline] f2fs_init_xattr_caches+0x78/0xb4 fs/f2fs/xattr.c:808 f2fs_fill_super+0x1050/0x1e0c fs/f2fs/super.c:4149 mount_bdev+0x1b8/0x210 fs/super.c:1400 f2fs_mount+0x44/0x58 fs/f2fs/super.c:4512 legacy_get_tree+0x30/0x74 fs/fs_context.c:610 vfs_get_tree+0x40/0x140 fs/super.c:1530 do_new_mount+0x1dc/0x4e4 fs/namespace.c:3040 path_mount+0x358/0x914 fs/namespace.c:3370 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount fs/namespace.c:3568 [inline] __arm64_sys_mount+0x2f8/0x408 fs/namespace.c:3568 Cc: Fixes: 81819f0fc8285 ("SLUB core") Reported-by: syzbot+81684812ea68216e08c5@syzkaller.appspotmail.com Reviewed-by: Muchun Song Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Chao Yu Acked-by: David Rientjes Signed-off-by: Vlastimil Babka Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- mm/slub.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/mm/slub.c +++ b/mm/slub.c @@ -5743,7 +5743,8 @@ static char *create_unique_id(struct kme char *name =3D kmalloc(ID_STR_LENGTH, GFP_KERNEL); char *p =3D name; =20 - BUG_ON(!name); + if (!name) + return ERR_PTR(-ENOMEM); =20 *p++ =3D ':'; /* @@ -5825,6 +5826,8 @@ static int sysfs_slab_add(struct kmem_ca * for the symlinks. */ name =3D create_unique_id(s); + if (IS_ERR(name)) + return PTR_ERR(name); } =20 s->kobj.kset =3D kset; From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1EE9C07E9D for ; Mon, 26 Sep 2022 10:41:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236345AbiIZKlu (ORCPT ); Mon, 26 Sep 2022 06:41:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236617AbiIZKjq (ORCPT ); Mon, 26 Sep 2022 06:39:46 -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 6614753D3D; Mon, 26 Sep 2022 03:23: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 BA62A60BAF; Mon, 26 Sep 2022 10:23:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD89CC433C1; Mon, 26 Sep 2022 10:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187811; bh=eUck7UUqhWIihyDGGH5y1+ziQsswGYPBDFAwlecVRRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SqGr+boaHl0bFTBfQxghYcLGIX9wmDFjcMVpDQq3MTJ2G64IDZ3Ddd1cajEWc6mci XRdMRmJ5aN11lJ/pv1/lblblJ5wOgETGBnbxH/SVt45xGQg2RZE6vcgZmZqumR0tBW vl3cOGwJ+0y7cZoj6WfxMnPAzt/ZterW1Vj9t+PI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Douglas Anderson , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.4 066/120] arm64: dts: rockchip: Pull up wlan wake# on Gru-Bob Date: Mon, 26 Sep 2022 12:11:39 +0200 Message-Id: <20220926100753.400977347@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris [ Upstream commit e5467359a725de90b6b8d0dd865500f6373828ca ] The Gru-Bob board does not have a pull-up resistor on its WLAN_HOST_WAKE# pin, but Kevin does. The production/vendor kernel specified the pin configuration correctly as a pull-up, but this didn't get ported correctly to upstream. This means Bob's WLAN_HOST_WAKE# pin is floating, causing inconsistent wakeup behavior. Note that bt_host_wake_l has a similar dynamic, but apparently the upstream choice was to redundantly configure both internal and external pull-up on Kevin (see the "Kevin has an external pull up" comment in rk3399-gru.dtsi). This doesn't cause any functional problem, although it's perhaps wasteful. Fixes: 8559bbeeb849 ("arm64: dts: rockchip: add Google Bob") Signed-off-by: Brian Norris Reviewed-by: Douglas Anderson Link: https://lore.kernel.org/r/20220822164453.1.I75c57b48b0873766ec993bdfb= 7bc1e63da5a1637@changeid Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts | 5 +++++ arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi | 1 + 2 files changed, 6 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts b/arch/arm64/b= oot/dts/rockchip/rk3399-gru-bob.dts index a9f4d6d7d2b7..586351340da6 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts @@ -77,3 +77,8 @@ h1_int_od_l: h1-int-od-l { }; }; }; + +&wlan_host_wake_l { + /* Kevin has an external pull up, but Bob does not. */ + rockchip,pins =3D <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>; +}; diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi b/arch= /arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi index 7cd6d470c1cb..53185404d3c8 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi @@ -397,6 +397,7 @@ wifi_perst_l: wifi-perst-l { }; =20 wlan_host_wake_l: wlan-host-wake-l { + /* Kevin has an external pull up, but Bob does not */ rockchip,pins =3D <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; }; }; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76B54C6FA83 for ; Mon, 26 Sep 2022 10:41:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236356AbiIZKly (ORCPT ); Mon, 26 Sep 2022 06:41:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236626AbiIZKjs (ORCPT ); Mon, 26 Sep 2022 06:39: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 999A16351; Mon, 26 Sep 2022 03:23:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CB63F60B5E; Mon, 26 Sep 2022 10:23:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEF41C433C1; Mon, 26 Sep 2022 10:23:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187814; bh=IOsAm3lIFxWYA7MBy0NKgThbBpwCwNAPrcuyr9Vmt7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s12E//BtVe7vAjKmG3VrmCs2qtb+KQ4YPXrwcicegfqSqgIRY0JhJA+32Kk6Sssq/ ipxSSBoT28JFOzQnIZdWyxE7BhkYifSOMInKB1IsRPHCk+deAhp/2xko/bOiirNCll bx8LnkmMxuFH/I14F5W1w+Aye5oy1qqeALP/ZdQ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , zain wang , Brian Norris , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.4 067/120] arm64: dts: rockchip: Set RK3399-Gru PCLK_EDP to 24 MHz Date: Mon, 26 Sep 2022 12:11:40 +0200 Message-Id: <20220926100753.431131212@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: zain wang [ Upstream commit 8123437cf46ea5a0f6ca5cb3c528d8b6db97b9c2 ] We've found the AUX channel to be less reliable with PCLK_EDP at a higher rate (typically 25 MHz). This is especially important on systems with PSR-enabled panels (like Gru-Kevin), since we make heavy, constant use of AUX. According to Rockchip, using any rate other than 24 MHz can cause "problems between syncing the PHY an PCLK", which leads to all sorts of unreliabilities around register operations. Fixes: d67a38c5a623 ("arm64: dts: rockchip: move core edp from rk3399-kevin= to shared chromebook") Reviewed-by: Douglas Anderson Signed-off-by: zain wang Signed-off-by: Brian Norris Link: https://lore.kernel.org/r/20220830131212.v2.1.I98d30623f13b785ca77094= d0c0fd4339550553b6@changeid Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi b/arch= /arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi index 53185404d3c8..7416db3d27a7 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi @@ -237,6 +237,14 @@ &cdn_dp { &edp { status =3D "okay"; =20 + /* + * eDP PHY/clk don't sync reliably at anything other than 24 MHz. Only + * set this here, because rk3399-gru.dtsi ensures we can generate this + * off GPLL=3D600MHz, whereas some other RK3399 boards may not. + */ + assigned-clocks =3D <&cru PCLK_EDP>; + assigned-clock-rates =3D <24000000>; + ports { edp_out: port@1 { reg =3D <1>; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21DBAC6FA86 for ; Mon, 26 Sep 2022 10:41:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236362AbiIZKl5 (ORCPT ); Mon, 26 Sep 2022 06:41:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235893AbiIZKjy (ORCPT ); Mon, 26 Sep 2022 06:39:54 -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 CCA884D15D; Mon, 26 Sep 2022 03:23: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 B5A1BB80835; Mon, 26 Sep 2022 10:23:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE072C433D6; Mon, 26 Sep 2022 10:23:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187817; bh=mNPj2K9Tjb0i7RWUu5ToPPmzi3eN3KxqFd3F+KVTu9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EDhkSlbOiTYeYsf9ZyemRWPxUPWeUPYMf+HGosRNLuBpqCKZGaUtFf8G4Olzg70PM LcGNrSz77QR1lXoKczkdkT7XGcPSfcGRh+CqyxnmwkqcEB+mji+zcE60u+uskBS2H0 wjS550FHkV6duCD9cUnXd94fHJPCDESb+H6xRM2Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.4 068/120] arm64: dts: rockchip: Remove enable-active-low from rk3399-puma Date: Mon, 26 Sep 2022 12:11:41 +0200 Message-Id: <20220926100753.477996485@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabio Estevam [ Upstream commit a994b34b9abb9c08ee09e835b4027ff2147f9d94 ] The 'enable-active-low' property is not a valid one. Only 'enable-active-high' is valid, and when this property is absent the gpio regulator will act as active low by default. Remove the invalid 'enable-active-low' property. Fixes: 2c66fc34e945 ("arm64: dts: rockchip: add RK3399-Q7 (Puma) SoM") Signed-off-by: Fabio Estevam Link: https://lore.kernel.org/r/20220827175140.1696699-1-festevam@denx.de Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi b/arch/arm64/boo= t/dts/rockchip/rk3399-puma.dtsi index 390b86ec6538..365fa9a3c5bf 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi @@ -102,7 +102,6 @@ vcc3v3_sys: vcc3v3-sys { vcc5v0_host: vcc5v0-host-regulator { compatible =3D "regulator-fixed"; gpio =3D <&gpio4 RK_PA3 GPIO_ACTIVE_LOW>; - enable-active-low; pinctrl-names =3D "default"; pinctrl-0 =3D <&vcc5v0_host_en>; regulator-name =3D "vcc5v0_host"; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3337C32771 for ; Mon, 26 Sep 2022 10:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233897AbiIZKrg (ORCPT ); Mon, 26 Sep 2022 06:47:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236839AbiIZKos (ORCPT ); Mon, 26 Sep 2022 06:44: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 9A0B5564D8; Mon, 26 Sep 2022 03:25: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 235EA60B9A; Mon, 26 Sep 2022 10:25:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 356A2C43140; Mon, 26 Sep 2022 10:25:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187943; bh=wYMWX1RdKzeoF4adCEB63kIZCJOyfUXgVp3rUBJ24FE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hCYqNtnDOLuGH69uCMy8cMALO7FJApT4iWcZx2p8OaFAcEK+B7jwA7WLl1mS3ROR/ NzRggAjoKRfRX1YlhghHzR8BohQ0Pi0lTCmP7x09uL5MWd6tQ5Ke6K38mjuEkBjxhX d4rNhKfMKRgmrq0qK6FfLXFcPZvy2eSchCbzFTQA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Igor Ryzhov , Florian Westphal , Sasha Levin Subject: [PATCH 5.4 069/120] netfilter: nf_conntrack_sip: fix ct_sip_walk_headers Date: Mon, 26 Sep 2022 12:11:42 +0200 Message-Id: <20220926100753.514780869@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Igor Ryzhov [ Upstream commit 39aebedeaaa95757f5c1f2ddb5f43fdddbf478ca ] ct_sip_next_header and ct_sip_get_header return an absolute value of matchoff, not a shift from current dataoff. So dataoff should be assigned matchoff, not incremented by it. This issue can be seen in the scenario when there are multiple Contact headers and the first one is using a hostname and other headers use IP addresses. In this case, ct_sip_walk_headers will work as follows: The first ct_sip_get_header call to will find the first Contact header but will return -1 as the header uses a hostname. But matchoff will be changed to the offset of this header. After that, dataoff should be set to matchoff, so that the next ct_sip_get_header call find the next Contact header. But instead of assigning dataoff to matchoff, it is incremented by it, which is not correct, as matchoff is an absolute value of the offset. So on the next call to the ct_sip_get_header, dataoff will be incorrect, and the next Contact header may not be found at all. Fixes: 05e3ced297fe ("[NETFILTER]: nf_conntrack_sip: introduce SIP-URI pars= ing helper") Signed-off-by: Igor Ryzhov Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/netfilter/nf_conntrack_sip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_= sip.c index b83dc9bf0a5d..78fd9122b70c 100644 --- a/net/netfilter/nf_conntrack_sip.c +++ b/net/netfilter/nf_conntrack_sip.c @@ -477,7 +477,7 @@ static int ct_sip_walk_headers(const struct nf_conn *ct= , const char *dptr, return ret; if (ret =3D=3D 0) break; - dataoff +=3D *matchoff; + dataoff =3D *matchoff; } *in_header =3D 0; } @@ -489,7 +489,7 @@ static int ct_sip_walk_headers(const struct nf_conn *ct= , const char *dptr, break; if (ret =3D=3D 0) return ret; - dataoff +=3D *matchoff; + dataoff =3D *matchoff; } =20 if (in_header) --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EDCDC32771 for ; Mon, 26 Sep 2022 10:45:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236170AbiIZKpG (ORCPT ); Mon, 26 Sep 2022 06:45:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234090AbiIZKmw (ORCPT ); Mon, 26 Sep 2022 06:42:52 -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 4D69D54655; Mon, 26 Sep 2022 03:24: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 sin.source.kernel.org (Postfix) with ESMTPS id 23E2ACE10E0; Mon, 26 Sep 2022 10:24:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AECE7C433D6; Mon, 26 Sep 2022 10:24:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187842; bh=Sx/ZtVz5BhS6emHclKu+X9velFI4oMJK6XW2r9uSD8k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c8HPBeHgmfRGdlrz5eYy/dFXj121WhJHQplF0qioKd9bTnvdXNfrcTeGZK9dZe41J oEMqPMfc9u8/ajdqrLp2sxHTR/xS259QctGj8nVy/YXhpv9O3Kc5tXejOfXi7mejnx 5HxCZaVkVhOlJeqjQblm3vN8b+AImNWU7+hgfF98= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Leadbeater , Florian Westphal , Sasha Levin Subject: [PATCH 5.4 070/120] netfilter: nf_conntrack_irc: Tighten matching on DCC message Date: Mon, 26 Sep 2022 12:11:43 +0200 Message-Id: <20220926100753.557377568@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Leadbeater [ Upstream commit e8d5dfd1d8747b56077d02664a8838c71ced948e ] CTCP messages should only be at the start of an IRC message, not anywhere within it. While the helper only decodes packes in the ORIGINAL direction, its possible to make a client send a CTCP message back by empedding one into a PING request. As-is, thats enough to make the helper believe that it saw a CTCP message. Fixes: 869f37d8e48f ("[NETFILTER]: nf_conntrack/nf_nat: add IRC helper port= ") Signed-off-by: David Leadbeater Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/netfilter/nf_conntrack_irc.c | 34 ++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/net/netfilter/nf_conntrack_irc.c b/net/netfilter/nf_conntrack_= irc.c index 26245419ef4a..65b5b05fe38d 100644 --- a/net/netfilter/nf_conntrack_irc.c +++ b/net/netfilter/nf_conntrack_irc.c @@ -148,15 +148,37 @@ static int help(struct sk_buff *skb, unsigned int pro= toff, data =3D ib_ptr; data_limit =3D ib_ptr + skb->len - dataoff; =20 - /* strlen("\1DCC SENT t AAAAAAAA P\1\n")=3D24 - * 5+MINMATCHLEN+strlen("t AAAAAAAA P\1\n")=3D14 */ - while (data < data_limit - (19 + MINMATCHLEN)) { - if (memcmp(data, "\1DCC ", 5)) { + /* Skip any whitespace */ + while (data < data_limit - 10) { + if (*data =3D=3D ' ' || *data =3D=3D '\r' || *data =3D=3D '\n') + data++; + else + break; + } + + /* strlen("PRIVMSG x ")=3D10 */ + if (data < data_limit - 10) { + if (strncasecmp("PRIVMSG ", data, 8)) + goto out; + data +=3D 8; + } + + /* strlen(" :\1DCC SENT t AAAAAAAA P\1\n")=3D26 + * 7+MINMATCHLEN+strlen("t AAAAAAAA P\1\n")=3D26 + */ + while (data < data_limit - (21 + MINMATCHLEN)) { + /* Find first " :", the start of message */ + if (memcmp(data, " :", 2)) { data++; continue; } + data +=3D 2; + + /* then check that place only for the DCC command */ + if (memcmp(data, "\1DCC ", 5)) + goto out; data +=3D 5; - /* we have at least (19+MINMATCHLEN)-5 bytes valid data left */ + /* we have at least (21+MINMATCHLEN)-(2+5) bytes valid data left */ =20 iph =3D ip_hdr(skb); pr_debug("DCC found in master %pI4:%u %pI4:%u\n", @@ -172,7 +194,7 @@ static int help(struct sk_buff *skb, unsigned int proto= ff, pr_debug("DCC %s detected\n", dccprotos[i]); =20 /* we have at least - * (19+MINMATCHLEN)-5-dccprotos[i].matchlen bytes valid + * (21+MINMATCHLEN)-7-dccprotos[i].matchlen bytes valid * data left (=3D=3D 14/13 bytes) */ if (parse_dcc(data, data_limit, &dcc_ip, &dcc_port, &addr_beg_p, &addr_end_p)) { --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4C95C32771 for ; Mon, 26 Sep 2022 10:45:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236440AbiIZKpc (ORCPT ); Mon, 26 Sep 2022 06:45:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234357AbiIZKn3 (ORCPT ); Mon, 26 Sep 2022 06:43:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C210D8E; Mon, 26 Sep 2022 03:24: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 22764B80835; Mon, 26 Sep 2022 10:24:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 684AEC433D6; Mon, 26 Sep 2022 10:24:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187875; bh=ER3mexkbJMYny8HTxGhK3/B5gxon5l23I0zwMGyFQzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fwjkmjRD2hSTqqy1W7vy2F4i61L3hIpCl9AmHaoKo0oxJQvQZG4+F0j3dP6XFQAGg jnafUrhL7QtBbT03h8FyoXwuvnRHHotoIBa2O+v1NmaDW8qsrF8jX9mc//oAdzHSWL TBmwy/hARCGg9zKdmSQWBx/jZPovX5cWEFfc387I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso , Florian Westphal , Sasha Levin Subject: [PATCH 5.4 071/120] netfilter: nfnetlink_osf: fix possible bogus match in nf_osf_find() Date: Mon, 26 Sep 2022 12:11:44 +0200 Message-Id: <20220926100753.585915713@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pablo Neira Ayuso [ Upstream commit 559c36c5a8d730c49ef805a72b213d3bba155cc8 ] nf_osf_find() incorrectly returns true on mismatch, this leads to copying uninitialized memory area in nft_osf which can be used to leak stale kernel stack data to userspace. Fixes: 22c7652cdaa8 ("netfilter: nft_osf: Add version option support") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/netfilter/nfnetlink_osf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/netfilter/nfnetlink_osf.c b/net/netfilter/nfnetlink_osf.c index 79fbf37291f3..51e3953b414c 100644 --- a/net/netfilter/nfnetlink_osf.c +++ b/net/netfilter/nfnetlink_osf.c @@ -269,6 +269,7 @@ bool nf_osf_find(const struct sk_buff *skb, struct nf_osf_hdr_ctx ctx; const struct tcphdr *tcp; struct tcphdr _tcph; + bool found =3D false; =20 memset(&ctx, 0, sizeof(ctx)); =20 @@ -283,10 +284,11 @@ bool nf_osf_find(const struct sk_buff *skb, =20 data->genre =3D f->genre; data->version =3D f->version; + found =3D true; break; } =20 - return true; + return found; } EXPORT_SYMBOL_GPL(nf_osf_find); =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF726C32771 for ; Mon, 26 Sep 2022 10:46:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236524AbiIZKqd (ORCPT ); Mon, 26 Sep 2022 06:46:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236552AbiIZKoB (ORCPT ); Mon, 26 Sep 2022 06:44: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 C1E8A32DA4; Mon, 26 Sep 2022 03:25: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 E81C6B80920; Mon, 26 Sep 2022 10:25:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E9F7C433D7; Mon, 26 Sep 2022 10:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187909; bh=/WlxciwnRNUCW5MjxiZJbw8YecLX/8f6sOAW4c0RYOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FYr4XsXebiKTEra9k7bKHVKG+hGGVEQXJ8nkuahIB4nM9VSMq1V73PCX7WVGgIaUE 5exx8XadPZzk/uxuFULo08MsrP43nxjEsQFZpl3hPi8vBe4lyYHgKnCV/KdKMvuASn SB5Lcb35YBqz2QuOrkJvuuXyP2poX3jjTLpaHVpY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brett Creeley , Norbert Zulinski , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.4 072/120] iavf: Fix cached head and tail value for iavf_get_tx_pending Date: Mon, 26 Sep 2022 12:11:45 +0200 Message-Id: <20220926100753.624095049@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brett Creeley [ Upstream commit 809f23c0423a43266e47a7dc67e95b5cb4d1cbfc ] The underlying hardware may or may not allow reading of the head or tail registers and it really makes no difference if we use the software cached values. So, always used the software cached values. Fixes: 9c6c12595b73 ("i40e: Detection and recovery of TX queue hung logic m= oved to service_task from tx_timeout") Signed-off-by: Brett Creeley Co-developed-by: Norbert Zulinski Signed-off-by: Norbert Zulinski Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethe= rnet/intel/iavf/iavf_txrx.c index c6905d1b6182..ce2f6d1ca79f 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c +++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c @@ -114,8 +114,11 @@ u32 iavf_get_tx_pending(struct iavf_ring *ring, bool i= n_sw) { u32 head, tail; =20 + /* underlying hardware might not allow access and/or always return + * 0 for the head/tail registers so just use the cached values + */ head =3D ring->next_to_clean; - tail =3D readl(ring->tail); + tail =3D ring->next_to_use; =20 if (head !=3D tail) return (head < tail) ? --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0DF6C07E9D for ; Mon, 26 Sep 2022 10:47:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236588AbiIZKrB (ORCPT ); Mon, 26 Sep 2022 06:47:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236691AbiIZKo0 (ORCPT ); Mon, 26 Sep 2022 06:44:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 842374DB25; Mon, 26 Sep 2022 03:25: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 ams.source.kernel.org (Postfix) with ESMTPS id 0AA86B80920; Mon, 26 Sep 2022 10:25:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42D68C433C1; Mon, 26 Sep 2022 10:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187924; bh=aeSD6Yc3XFkZs9sGQ7ngJnxWev9+a35ax/I+fVl36jY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RMwr7Lkwqcg3oy6RvN9n1IuI+Cyd8y0/+kLuAgsgBUBDUt1AdmiNFIUK7RcVXCYAg 51sF2xWomxPyGWdrnlrcKqtPtIEWx+1GYqwmMGr2tNYkFj8p4wljgVldPNAWOPwOD5 8g219mwO30SZJSXPWHbgCNT0Vg/FELSonhoPLfUo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lu Wei , Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 073/120] ipvlan: Fix out-of-bound bugs caused by unset skb->mac_header Date: Mon, 26 Sep 2022 12:11:46 +0200 Message-Id: <20220926100753.672548152@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lu Wei [ Upstream commit 81225b2ea161af48e093f58e8dfee6d705b16af4 ] If an AF_PACKET socket is used to send packets through ipvlan and the default xmit function of the AF_PACKET socket is changed from dev_queue_xmit() to packet_direct_xmit() via setsockopt() with the option name of PACKET_QDISC_BYPASS, the skb->mac_header may not be reset and remains as the initial value of 65535, this may trigger slab-out-of-bounds bugs as following: =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 UG: KASAN: slab-out-of-bounds in ipvlan_xmit_mode_l2+0xdb/0x330 [ipvlan] PU: 2 PID: 1768 Comm: raw_send Kdump: loaded Not tainted 6.0.0-rc4+ #6 ardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc33 all Trace: print_address_description.constprop.0+0x1d/0x160 print_report.cold+0x4f/0x112 kasan_report+0xa3/0x130 ipvlan_xmit_mode_l2+0xdb/0x330 [ipvlan] ipvlan_start_xmit+0x29/0xa0 [ipvlan] __dev_direct_xmit+0x2e2/0x380 packet_direct_xmit+0x22/0x60 packet_snd+0x7c9/0xc40 sock_sendmsg+0x9a/0xa0 __sys_sendto+0x18a/0x230 __x64_sys_sendto+0x74/0x90 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd The root cause is: 1. packet_snd() only reset skb->mac_header when sock->type is SOCK_RAW and skb->protocol is not specified as in packet_parse_headers() 2. packet_direct_xmit() doesn't reset skb->mac_header as dev_queue_xmit() In this case, skb->mac_header is 65535 when ipvlan_xmit_mode_l2() is called. So when ipvlan_xmit_mode_l2() gets mac header with eth_hdr() which use "skb->head + skb->mac_header", out-of-bound access occurs. This patch replaces eth_hdr() with skb_eth_hdr() in ipvlan_xmit_mode_l2() and reset mac header in multicast to solve this out-of-bound bug. Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.") Signed-off-by: Lu Wei Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ipvlan/ipvlan_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_c= ore.c index 8801d093135c..a33149ee0ddc 100644 --- a/drivers/net/ipvlan/ipvlan_core.c +++ b/drivers/net/ipvlan/ipvlan_core.c @@ -496,7 +496,6 @@ static int ipvlan_process_v6_outbound(struct sk_buff *s= kb) =20 static int ipvlan_process_outbound(struct sk_buff *skb) { - struct ethhdr *ethh =3D eth_hdr(skb); int ret =3D NET_XMIT_DROP; =20 /* The ipvlan is a pseudo-L2 device, so the packets that we receive @@ -506,6 +505,8 @@ static int ipvlan_process_outbound(struct sk_buff *skb) if (skb_mac_header_was_set(skb)) { /* In this mode we dont care about * multicast and broadcast traffic */ + struct ethhdr *ethh =3D eth_hdr(skb); + if (is_multicast_ether_addr(ethh->h_dest)) { pr_debug_ratelimited( "Dropped {multi|broad}cast of type=3D[%x]\n", @@ -590,7 +591,7 @@ static int ipvlan_xmit_mode_l3(struct sk_buff *skb, str= uct net_device *dev) static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev) { const struct ipvl_dev *ipvlan =3D netdev_priv(dev); - struct ethhdr *eth =3D eth_hdr(skb); + struct ethhdr *eth =3D skb_eth_hdr(skb); struct ipvl_addr *addr; void *lyr3h; int addr_type; @@ -620,6 +621,7 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, str= uct net_device *dev) return dev_forward_skb(ipvlan->phy_dev, skb); =20 } else if (is_multicast_ether_addr(eth->h_dest)) { + skb_reset_mac_header(skb); ipvlan_skb_crossing_ns(skb, NULL); ipvlan_multicast_enqueue(ipvlan->port, skb, true); return NET_XMIT_SUCCESS; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2B52C32771 for ; Mon, 26 Sep 2022 10:47:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236599AbiIZKrF (ORCPT ); Mon, 26 Sep 2022 06:47:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236738AbiIZKod (ORCPT ); Mon, 26 Sep 2022 06:44:33 -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 0499A4D829; Mon, 26 Sep 2022 03:25:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3EAF8B80924; Mon, 26 Sep 2022 10:25:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D752C433D6; Mon, 26 Sep 2022 10:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187927; bh=s79junYM+monALAZy0o8fLLE37ZoO9S4i26Pjqp1b5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vcJC1FTyZhpHfqsB+PAiLyEQktkchSIDUAZeqMEIKNoDagGKED0Rbne0pqwYk9ovd dhl/CY4/WtACvEqGKPG28QFnWrI7oRMRbFcRGjyHk4N4yEbqH374+X+miKmbN9cBnI fPO+GkfApsWhwJf994VDad1yHkqBtBxHmgJJCaNM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Poirier , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 074/120] net: team: Unsync device addresses on ndo_stop Date: Mon, 26 Sep 2022 12:11:47 +0200 Message-Id: <20220926100753.720692306@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Poirier [ Upstream commit bd60234222b2fd5573526da7bcd422801f271f5f ] Netdev drivers are expected to call dev_{uc,mc}_sync() in their ndo_set_rx_mode method and dev_{uc,mc}_unsync() in their ndo_stop method. This is mentioned in the kerneldoc for those dev_* functions. The team driver calls dev_{uc,mc}_unsync() during ndo_uninit instead of ndo_stop. This is ineffective because address lists (dev->{uc,mc}) have already been emptied in unregister_netdevice_many() before ndo_uninit is called. This mistake can result in addresses being leftover on former team ports after a team device has been deleted; see test_LAG_cleanup() in the last patch in this series. Add unsync calls at their expected location, team_close(). v3: * When adding or deleting a port, only sync/unsync addresses if the team device is up. In other cases, it is taken care of at the right time by ndo_open/ndo_set_rx_mode/ndo_stop. Fixes: 3d249d4ca7d0 ("net: introduce ethernet teaming device") Signed-off-by: Benjamin Poirier Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/team/team.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 0eb894b7c0bd..da74ec778b6e 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -1270,10 +1270,12 @@ static int team_port_add(struct team *team, struct = net_device *port_dev, } } =20 - netif_addr_lock_bh(dev); - dev_uc_sync_multiple(port_dev, dev); - dev_mc_sync_multiple(port_dev, dev); - netif_addr_unlock_bh(dev); + if (dev->flags & IFF_UP) { + netif_addr_lock_bh(dev); + dev_uc_sync_multiple(port_dev, dev); + dev_mc_sync_multiple(port_dev, dev); + netif_addr_unlock_bh(dev); + } =20 port->index =3D -1; list_add_tail_rcu(&port->list, &team->port_list); @@ -1344,8 +1346,10 @@ static int team_port_del(struct team *team, struct n= et_device *port_dev) netdev_rx_handler_unregister(port_dev); team_port_disable_netpoll(port); vlan_vids_del_by_dev(port_dev, dev); - dev_uc_unsync(port_dev, dev); - dev_mc_unsync(port_dev, dev); + if (dev->flags & IFF_UP) { + dev_uc_unsync(port_dev, dev); + dev_mc_unsync(port_dev, dev); + } dev_close(port_dev); team_port_leave(team, port); =20 @@ -1694,6 +1698,14 @@ static int team_open(struct net_device *dev) =20 static int team_close(struct net_device *dev) { + struct team *team =3D netdev_priv(dev); + struct team_port *port; + + list_for_each_entry(port, &team->port_list, list) { + dev_uc_unsync(port->dev, dev); + dev_mc_unsync(port->dev, dev); + } + return 0; } =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AA77C07E9D for ; Mon, 26 Sep 2022 10:47:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234316AbiIZKrX (ORCPT ); Mon, 26 Sep 2022 06:47:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236803AbiIZKon (ORCPT ); Mon, 26 Sep 2022 06:44: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 1D8094F19B; Mon, 26 Sep 2022 03:25: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 7C443B80926; Mon, 26 Sep 2022 10:25:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FDB4C433D6; Mon, 26 Sep 2022 10:25:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187931; bh=FGL8GAtxfMw4n0JvjxgP9LDX324kIAJjB3fsedpwHWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MpgQpCA5PWFARMpmE/NbWALNj45k4wT2XVqGcLVVLxwHD1upcj4y3VyqN94B6Fhiw ZuIfMvYkcAzvLxF7EFC0I19rJlLnM7TrqjziJBb5iktuHv65Do/oTpQFQ86O9Fikep NSI2Jnv1J5f3yT4r0PaLEtKdpKeXSPqrj8Uqnzr4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , kernel test robot , Thomas Bogendoerfer , John Crispin , linux-mips@vger.kernel.org, Sasha Levin Subject: [PATCH 5.4 075/120] MIPS: lantiq: export clk_get_io() for lantiq_wdt.ko Date: Mon, 26 Sep 2022 12:11:48 +0200 Message-Id: <20220926100753.759758477@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Randy Dunlap [ Upstream commit 502550123bee6a2ffa438409b5b9aad4d6db3a8c ] The lantiq WDT driver uses clk_get_io(), which is not exported, so export it to fix a build error: ERROR: modpost: "clk_get_io" [drivers/watchdog/lantiq_wdt.ko] undefined! Fixes: 287e3f3f4e68 ("MIPS: lantiq: implement support for clkdev api") Signed-off-by: Randy Dunlap Reported-by: kernel test robot Cc: Thomas Bogendoerfer Cc: John Crispin Cc: linux-mips@vger.kernel.org Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/mips/lantiq/clk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c index 7a623684d9b5..2d5a0bcb0cec 100644 --- a/arch/mips/lantiq/clk.c +++ b/arch/mips/lantiq/clk.c @@ -50,6 +50,7 @@ struct clk *clk_get_io(void) { return &cpu_clk_generic[2]; } +EXPORT_SYMBOL_GPL(clk_get_io); =20 struct clk *clk_get_ppe(void) { --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7790EC07E9D for ; Mon, 26 Sep 2022 10:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236605AbiIZKrk (ORCPT ); Mon, 26 Sep 2022 06:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236846AbiIZKow (ORCPT ); Mon, 26 Sep 2022 06:44:52 -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 1FFAF558DA; Mon, 26 Sep 2022 03:25: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 8838BB802C5; Mon, 26 Sep 2022 10:25:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA5A6C4347C; Mon, 26 Sep 2022 10:25:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187934; bh=kEcA/9wTN6peHSuhYVAET0L6NbfiIGmPkAVhetaQM1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OuA2+btOmDCc1/A6ftTXnYhPPm4KNrpCXJLPv4F4mJetJle5ke2ic3Q9nCD44f4WE Oea7z/tkMcq77UkmQN3gdUD/pePcEMVU46sM8wXMxSI5CH6C2k0MyQzpGL1nvQ2riT aHzfGVG1nEQ9XbR67R9qQlY42BAz0MzBoeK377v0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Keguang Zhang , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.4 076/120] MIPS: Loongson32: Fix PHY-mode being left unspecified Date: Mon, 26 Sep 2022 12:11:49 +0200 Message-Id: <20220926100753.789656004@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit e9f3f8f488005f6da3cfb66070706770ecaef747 ] commit 0060c8783330 ("net: stmmac: implement support for passive mode converters via dt") has changed the plat->interface field semantics from containing the PHY-mode to specifying the MAC-PCS interface mode. Due to that the loongson32 platform code will leave the phylink interface uninitialized with the PHY-mode intended by the means of the actual platform setup. The commit-author most likely has just missed the arch-specific code to fix. Let's mend the Loongson32 platform code then by assigning the PHY-mode to the phy_interface field of the STMMAC platform data. Fixes: 0060c8783330 ("net: stmmac: implement support for passive mode conve= rters via dt") Signed-off-by: Serge Semin Signed-off-by: Keguang Zhang Tested-by: Keguang Zhang Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/mips/loongson32/common/platform.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/mips/loongson32/common/platform.c b/arch/mips/loongson32/= common/platform.c index 794c96c2a4cd..311dc1580bbd 100644 --- a/arch/mips/loongson32/common/platform.c +++ b/arch/mips/loongson32/common/platform.c @@ -98,7 +98,7 @@ int ls1x_eth_mux_init(struct platform_device *pdev, void = *priv) if (plat_dat->bus_id) { __raw_writel(__raw_readl(LS1X_MUX_CTRL0) | GMAC1_USE_UART1 | GMAC1_USE_UART0, LS1X_MUX_CTRL0); - switch (plat_dat->interface) { + switch (plat_dat->phy_interface) { case PHY_INTERFACE_MODE_RGMII: val &=3D ~(GMAC1_USE_TXCLK | GMAC1_USE_PWM23); break; @@ -107,12 +107,12 @@ int ls1x_eth_mux_init(struct platform_device *pdev, v= oid *priv) break; default: pr_err("unsupported mii mode %d\n", - plat_dat->interface); + plat_dat->phy_interface); return -ENOTSUPP; } val &=3D ~GMAC1_SHUT; } else { - switch (plat_dat->interface) { + switch (plat_dat->phy_interface) { case PHY_INTERFACE_MODE_RGMII: val &=3D ~(GMAC0_USE_TXCLK | GMAC0_USE_PWM01); break; @@ -121,7 +121,7 @@ int ls1x_eth_mux_init(struct platform_device *pdev, voi= d *priv) break; default: pr_err("unsupported mii mode %d\n", - plat_dat->interface); + plat_dat->phy_interface); return -ENOTSUPP; } val &=3D ~GMAC0_SHUT; @@ -131,7 +131,7 @@ int ls1x_eth_mux_init(struct platform_device *pdev, voi= d *priv) plat_dat =3D dev_get_platdata(&pdev->dev); =20 val &=3D ~PHY_INTF_SELI; - if (plat_dat->interface =3D=3D PHY_INTERFACE_MODE_RMII) + if (plat_dat->phy_interface =3D=3D PHY_INTERFACE_MODE_RMII) val |=3D 0x4 << PHY_INTF_SELI_SHIFT; __raw_writel(val, LS1X_MUX_CTRL1); =20 @@ -146,9 +146,9 @@ static struct plat_stmmacenet_data ls1x_eth0_pdata =3D { .bus_id =3D 0, .phy_addr =3D -1, #if defined(CONFIG_LOONGSON1_LS1B) - .interface =3D PHY_INTERFACE_MODE_MII, + .phy_interface =3D PHY_INTERFACE_MODE_MII, #elif defined(CONFIG_LOONGSON1_LS1C) - .interface =3D PHY_INTERFACE_MODE_RMII, + .phy_interface =3D PHY_INTERFACE_MODE_RMII, #endif .mdio_bus_data =3D &ls1x_mdio_bus_data, .dma_cfg =3D &ls1x_eth_dma_cfg, @@ -186,7 +186,7 @@ struct platform_device ls1x_eth0_pdev =3D { static struct plat_stmmacenet_data ls1x_eth1_pdata =3D { .bus_id =3D 1, .phy_addr =3D -1, - .interface =3D PHY_INTERFACE_MODE_MII, + .phy_interface =3D PHY_INTERFACE_MODE_MII, .mdio_bus_data =3D &ls1x_mdio_bus_data, .dma_cfg =3D &ls1x_eth_dma_cfg, .has_gmac =3D 1, --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19AF3C32771 for ; Mon, 26 Sep 2022 10:47:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234521AbiIZKrb (ORCPT ); Mon, 26 Sep 2022 06:47:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236833AbiIZKos (ORCPT ); Mon, 26 Sep 2022 06:44:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7D47558F9; Mon, 26 Sep 2022 03:25: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 ams.source.kernel.org (Postfix) with ESMTPS id D1CB7B80915; Mon, 26 Sep 2022 10:25:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 131A0C433D6; Mon, 26 Sep 2022 10:25:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187937; bh=aAQbYV2r0ajUCh58EF7HlTWZ2CUqjeWSv3pYUJSLij4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c/n8pjz/0PLhNiciYa/rI9hxOSGIkUW825TDXmMEKcJywFB1ldSGDPxJwGgq7X6VP FrWSByy0aI5V4kIEsew3mZlGUUcMMKQsEUtARvTTISO4I14U4FuzrpBVWMJsCkIE4R +86QHZBnrcs3orLPx1x/xh1AgOYrbnh3I3tgMdxI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Norbert Zulinski , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.4 077/120] iavf: Fix bad page state Date: Mon, 26 Sep 2022 12:11:50 +0200 Message-Id: <20220926100753.834362589@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Norbert Zulinski [ Upstream commit 66039eb9015eee4f7ff0c99b83c65c7ecb3c8190 ] Fix bad page state, free inappropriate page in handling dummy descriptor. iavf_build_skb now has to check not only if rx_buffer is NULL but also if size is zero, same thing in iavf_clean_rx_irq. Without this patch driver would free page that will be used by napi_build_skb. Fixes: a9f49e006030 ("iavf: Fix handling of dummy receive descriptors") Signed-off-by: Norbert Zulinski Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethe= rnet/intel/iavf/iavf_txrx.c index ce2f6d1ca79f..1f7b842c6763 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c +++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c @@ -1374,7 +1374,7 @@ static struct sk_buff *iavf_build_skb(struct iavf_rin= g *rx_ring, #endif struct sk_buff *skb; =20 - if (!rx_buffer) + if (!rx_buffer || !size) return NULL; /* prefetch first cache line of first page */ va =3D page_address(rx_buffer->page) + rx_buffer->page_offset; @@ -1534,7 +1534,7 @@ static int iavf_clean_rx_irq(struct iavf_ring *rx_rin= g, int budget) /* exit if we failed to retrieve a buffer */ if (!skb) { rx_ring->rx_stats.alloc_buff_failed++; - if (rx_buffer) + if (rx_buffer && size) rx_buffer->pagecnt_bias++; break; } --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D32E2C32771 for ; Mon, 26 Sep 2022 10:47:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234017AbiIZKr1 (ORCPT ); Mon, 26 Sep 2022 06:47:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236834AbiIZKos (ORCPT ); Mon, 26 Sep 2022 06:44:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE65E558F1; Mon, 26 Sep 2022 03:25: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 ams.source.kernel.org (Postfix) with ESMTPS id E1799B8055F; Mon, 26 Sep 2022 10:25:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24855C433C1; Mon, 26 Sep 2022 10:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187940; bh=/SjqnhXjwiyA/BeXgMhvlzWUvKoCyx+wh/zKjpb4Whw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SJ7+txg2yWYcz1uesyjsuoUXFYJicDMm/29IDncG/Mc+My0E6pRtjjkGIDmwU2vf2 p2FPpZrrMCKzhklPbhmEGD/BuWHRuVMz+uEf3N6eRpdFEdY+GioEdqK6FZMIzsIuHK +FFIGO2xafq1uTtowRUcpxSQQEkkUMHyZOEE0Vgk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Jaron , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.4 078/120] iavf: Fix set max MTU size with port VLAN and jumbo frames Date: Mon, 26 Sep 2022 12:11:51 +0200 Message-Id: <20220926100753.873784598@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Jaron [ Upstream commit 399c98c4dc50b7eb7e9f24da7ffdda6f025676ef ] After setting port VLAN and MTU to 9000 on VF with ice driver there was an iavf error "PF returned error -5 (IAVF_ERR_PARAM) to our request 6". During queue configuration, VF's max packet size was set to IAVF_MAX_RXBUFFER but on ice max frame size was smaller by VLAN_HLEN due to making some space for port VLAN as VF is not aware whether it's in a port VLAN. This mismatch in sizes caused ice to reject queue configuration with ERR_PARAM error. Proper max_mtu is sent from ice PF to VF with GET_VF_RESOURCES msg but VF does not look at this. In iavf change max_frame from IAVF_MAX_RXBUFFER to max_mtu received from pf with GET_VF_RESOURCES msg to make vf's max_frame_size dependent from pf. Add check if received max_mtu is not in eligible range then set it to IAVF_MAX_RXBUFFER. Fixes: dab86afdbbd1 ("i40e/i40evf: Change the way we limit the maximum fram= e size for Rx") Signed-off-by: Michal Jaron Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/intel/iavf/iavf_virtchnl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/= ethernet/intel/iavf/iavf_virtchnl.c index 4d471a6f2946..7a17694b6a0b 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c @@ -241,11 +241,14 @@ int iavf_get_vf_config(struct iavf_adapter *adapter) void iavf_configure_queues(struct iavf_adapter *adapter) { struct virtchnl_vsi_queue_config_info *vqci; - struct virtchnl_queue_pair_info *vqpi; + int i, max_frame =3D adapter->vf_res->max_mtu; int pairs =3D adapter->num_active_queues; - int i, max_frame =3D IAVF_MAX_RXBUFFER; + struct virtchnl_queue_pair_info *vqpi; size_t len; =20 + if (max_frame > IAVF_MAX_RXBUFFER || !max_frame) + max_frame =3D IAVF_MAX_RXBUFFER; + if (adapter->current_op !=3D VIRTCHNL_OP_UNKNOWN) { /* bail because we already have a command pending */ dev_err(&adapter->pdev->dev, "Cannot configure queues, command %d pendin= g\n", --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5381DC32771 for ; Mon, 26 Sep 2022 10:42:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236395AbiIZKma (ORCPT ); Mon, 26 Sep 2022 06:42:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236255AbiIZKk7 (ORCPT ); Mon, 26 Sep 2022 06:40: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 39D6A4D4CD; Mon, 26 Sep 2022 03:24: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 BA69960B5E; Mon, 26 Sep 2022 10:24:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACCA4C433C1; Mon, 26 Sep 2022 10:24:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187845; bh=wnuHQaDecdsgn7LCuASgdHmwxkjgrjE5924QvXbP/6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mrNj3gSXIuOkmPhcYQVML6hQJF4MqkVmxLkL2nsRIl63GRcKyk1XxfqAaeJ1vreU+ 8ZRpDj/EuyRjp24LdKl0RQXPyWH6jGOOymEekAJbpiRQfTR0vyenAcSjPXWjLFrA+g 64JxUvKUrY7KkRoIm8R1D++gk6fi6t8fNg5MVZzo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Jaron , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.4 079/120] i40e: Fix VF set max MTU size Date: Mon, 26 Sep 2022 12:11:52 +0200 Message-Id: <20220926100753.917494339@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Jaron [ Upstream commit 372539def2824c43b6afe2403045b140f65c5acc ] Max MTU sent to VF is set to 0 during memory allocation. It cause that max MTU on VF is changed to IAVF_MAX_RXBUFFER and does not depend on data from HW. Set max_mtu field in virtchnl_vf_resource struct to inform VF in GET_VF_RESOURCES msg what size should be max frame. Fixes: dab86afdbbd1 ("i40e/i40evf: Change the way we limit the maximum fram= e size for Rx") Signed-off-by: Michal Jaron Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/n= et/ethernet/intel/i40e/i40e_virtchnl_pf.c index 4080fdacca4c..16f5baafbbd5 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -1873,6 +1873,25 @@ static void i40e_del_qch(struct i40e_vf *vf) } } =20 +/** + * i40e_vc_get_max_frame_size + * @vf: pointer to the VF + * + * Max frame size is determined based on the current port's max frame size= and + * whether a port VLAN is configured on this VF. The VF is not aware wheth= er + * it's in a port VLAN so the PF needs to account for this in max frame si= ze + * checks and sending the max frame size to the VF. + **/ +static u16 i40e_vc_get_max_frame_size(struct i40e_vf *vf) +{ + u16 max_frame_size =3D vf->pf->hw.phy.link_info.max_frame_size; + + if (vf->port_vlan_id) + max_frame_size -=3D VLAN_HLEN; + + return max_frame_size; +} + /** * i40e_vc_get_vf_resources_msg * @vf: pointer to the VF info @@ -1973,6 +1992,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_v= f *vf, u8 *msg) vfres->max_vectors =3D pf->hw.func_caps.num_msix_vectors_vf; vfres->rss_key_size =3D I40E_HKEY_ARRAY_SIZE; vfres->rss_lut_size =3D I40E_VF_HLUT_ARRAY_SIZE; + vfres->max_mtu =3D i40e_vc_get_max_frame_size(vf); =20 if (vf->lan_vsi_idx) { vfres->vsi_res[0].vsi_id =3D vf->lan_vsi_id; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96FA2C07E9D for ; Mon, 26 Sep 2022 10:43:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234561AbiIZKm6 (ORCPT ); Mon, 26 Sep 2022 06:42:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235970AbiIZKl2 (ORCPT ); Mon, 26 Sep 2022 06:41:28 -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 C7C485464E; Mon, 26 Sep 2022 03:24: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 21A2560BAF; Mon, 26 Sep 2022 10:24:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15263C433D6; Mon, 26 Sep 2022 10:24:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187848; bh=sOPw6XbT2N0LCEbXbITt8VhfEwSDqQKQhgoZUozTRw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HKSdvJAiMxGMKbXy1z2TIrb7iqp4Ns75aWeWUr3KpftxcoLtxzPXpEsdKSYv3S52f k/iKGVereOtbxbsdIpRTpxWpAz35vlw3LJZNiS9WV6Q3d+HVgD4j3hVlcW6ZVTrqer cOtal0S5t3ftHyo8CEGBpTMKRQ8874cL8taipbLs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Jaron , Andrii Staikov , Bharathi Sreenivas , Tony Nguyen , Sasha Levin Subject: [PATCH 5.4 080/120] i40e: Fix set max_tx_rate when it is lower than 1 Mbps Date: Mon, 26 Sep 2022 12:11:53 +0200 Message-Id: <20220926100753.960804264@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Jaron [ Upstream commit 198eb7e1b81d8ba676d0f4f120c092032ae69a8e ] While converting max_tx_rate from bytes to Mbps, this value was set to 0, if the original value was lower than 125000 bytes (1 Mbps). This would cause no transmission rate limiting to occur. This happened due to lack of check of max_tx_rate against the 1 Mbps value for max_tx_rate and the following division by 125000. Fix this issue by adding a helper i40e_bw_bytes_to_mbits() which sets max_tx_rate to minimum usable value of 50 Mbps, if its value is less than 1 Mbps, otherwise do the required conversion by dividing by 125000. Fixes: 5ecae4120a6b ("i40e: Refactor VF BW rate limiting") Signed-off-by: Michal Jaron Signed-off-by: Andrii Staikov Tested-by: Bharathi Sreenivas Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/intel/i40e/i40e_main.c | 32 +++++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethe= rnet/intel/i40e/i40e_main.c index 2d01eaeb703a..15f177185d71 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -5638,6 +5638,26 @@ static int i40e_get_link_speed(struct i40e_vsi *vsi) } } =20 +/** + * i40e_bw_bytes_to_mbits - Convert max_tx_rate from bytes to mbits + * @vsi: Pointer to vsi structure + * @max_tx_rate: max TX rate in bytes to be converted into Mbits + * + * Helper function to convert units before send to set BW limit + **/ +static u64 i40e_bw_bytes_to_mbits(struct i40e_vsi *vsi, u64 max_tx_rate) +{ + if (max_tx_rate < I40E_BW_MBPS_DIVISOR) { + dev_warn(&vsi->back->pdev->dev, + "Setting max tx rate to minimum usable value of 50Mbps.\n"); + max_tx_rate =3D I40E_BW_CREDIT_DIVISOR; + } else { + do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR); + } + + return max_tx_rate; +} + /** * i40e_set_bw_limit - setup BW limit for Tx traffic based on max_tx_rate * @vsi: VSI to be configured @@ -5660,10 +5680,10 @@ int i40e_set_bw_limit(struct i40e_vsi *vsi, u16 sei= d, u64 max_tx_rate) max_tx_rate, seid); return -EINVAL; } - if (max_tx_rate && max_tx_rate < 50) { + if (max_tx_rate && max_tx_rate < I40E_BW_CREDIT_DIVISOR) { dev_warn(&pf->pdev->dev, "Setting max tx rate to minimum usable value of 50Mbps.\n"); - max_tx_rate =3D 50; + max_tx_rate =3D I40E_BW_CREDIT_DIVISOR; } =20 /* Tx rate credits are in values of 50Mbps, 0 is disabled */ @@ -7591,9 +7611,9 @@ static int i40e_setup_tc(struct net_device *netdev, v= oid *type_data) =20 if (pf->flags & I40E_FLAG_TC_MQPRIO) { if (vsi->mqprio_qopt.max_rate[0]) { - u64 max_tx_rate =3D vsi->mqprio_qopt.max_rate[0]; + u64 max_tx_rate =3D i40e_bw_bytes_to_mbits(vsi, + vsi->mqprio_qopt.max_rate[0]); =20 - do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR); ret =3D i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate); if (!ret) { u64 credits =3D max_tx_rate; @@ -10247,10 +10267,10 @@ static void i40e_rebuild(struct i40e_pf *pf, bool= reinit, bool lock_acquired) } =20 if (vsi->mqprio_qopt.max_rate[0]) { - u64 max_tx_rate =3D vsi->mqprio_qopt.max_rate[0]; + u64 max_tx_rate =3D i40e_bw_bytes_to_mbits(vsi, + vsi->mqprio_qopt.max_rate[0]); u64 credits =3D 0; =20 - do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR); ret =3D i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate); if (ret) goto end_unlock; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F03FC07E9D for ; Mon, 26 Sep 2022 10:43:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234672AbiIZKnJ (ORCPT ); Mon, 26 Sep 2022 06:43:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236352AbiIZKlw (ORCPT ); Mon, 26 Sep 2022 06:41:52 -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 5063954676; Mon, 26 Sep 2022 03:24: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 CEC46B80682; Mon, 26 Sep 2022 10:24:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12033C433D6; Mon, 26 Sep 2022 10:24:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187851; bh=BCpkiBVWoBhmhCQEKe8gIQ+IbaR0Bi7tHjVyIt0/lOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WMU4xMWmRM90qHZa5X1HqgQcFvWnVVWobsSMNbGLWSOp25NG5oVRcQuDQFapOVEGC BzsECCrl0XsUTUY56C/Ek9XIKbRi51PzIGVHysVcW3dkMmpvZG+n9rUS33ZvssIXgd ftNzDhREILj2Z8TKdX9ba2bhYnHhjE9zR8isqyCo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Liang He , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 081/120] of: mdio: Add of_node_put() when breaking out of for_each_xx Date: Mon, 26 Sep 2022 12:11:54 +0200 Message-Id: <20220926100754.000489671@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 1c48709e6d9d353acaaac1d8e33474756b121d78 ] In of_mdiobus_register(), we should call of_node_put() for 'child' escaped out of for_each_available_child_of_node(). Fixes: 66bdede495c7 ("of_mdio: Fix broken PHY IRQ in case of probe deferral= ") Co-developed-by: Miaoqian Lin Signed-off-by: Miaoqian Lin Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220913125659.3331969-1-windhl@126.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/of/of_mdio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 26ddb4cc675a..7a3de2b5de0c 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -281,6 +281,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct de= vice_node *np) return 0; =20 unregister: + of_node_put(child); mdiobus_unregister(mdio); return rc; } --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1B2DC32771 for ; Mon, 26 Sep 2022 10:43:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233993AbiIZKnV (ORCPT ); Mon, 26 Sep 2022 06:43:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236389AbiIZKmZ (ORCPT ); Mon, 26 Sep 2022 06:42:25 -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 C3AA654C8C; Mon, 26 Sep 2022 03:24: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 sin.source.kernel.org (Postfix) with ESMTPS id 39BB5CE10EC; Mon, 26 Sep 2022 10:24:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20EC4C433D6; Mon, 26 Sep 2022 10:24:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187854; bh=cFpZPh8BcsEBB286zNWTT/jV0sq4ra5xGMtyfOdaR2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JebGy2RTCy1bWpAh/nnsbTaN3Xaq3gLqp3ioAsK6SHkXEpc7QvGHZqN2u8QZucS5g Dj5HxbbXplIeWiA4IFJFNLQXKeWvRLuW0q4PptRatjp+H/bxXgtWvYzPfSw0JCufz6 S0j4k2CoAo3Fj+IxCHOpWGXADmJp6/7R4i5wAVfY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Vinicius Costa Gomes , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 082/120] net/sched: taprio: avoid disabling offload when it was never enabled Date: Mon, 26 Sep 2022 12:11:55 +0200 Message-Id: <20220926100754.044822678@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit db46e3a88a09c5cf7e505664d01da7238cd56c92 ] In an incredibly strange API design decision, qdisc->destroy() gets called even if qdisc->init() never succeeded, not exclusively since commit 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation"), but apparently also earlier (in the case of qdisc_create_dflt()). The taprio qdisc does not fully acknowledge this when it attempts full offload, because it starts off with q->flags =3D TAPRIO_FLAGS_INVALID in taprio_init(), then it replaces q->flags with TCA_TAPRIO_ATTR_FLAGS parsed from netlink (in taprio_change(), tail called from taprio_init()). But in taprio_destroy(), we call taprio_disable_offload(), and this determines what to do based on FULL_OFFLOAD_IS_ENABLED(q->flags). But looking at the implementation of FULL_OFFLOAD_IS_ENABLED() (a bitwise check of bit 1 in q->flags), it is invalid to call this macro on q->flags when it contains TAPRIO_FLAGS_INVALID, because that is set to U32_MAX, and therefore FULL_OFFLOAD_IS_ENABLED() will return true on an invalid set of flags. As a result, it is possible to crash the kernel if user space forces an error between setting q->flags =3D TAPRIO_FLAGS_INVALID, and the calling of taprio_enable_offload(). This is because drivers do not expect the offload to be disabled when it was never enabled. The error that we force here is to attach taprio as a non-root qdisc, but instead as child of an mqprio root qdisc: $ tc qdisc add dev swp0 root handle 1: \ mqprio num_tc 8 map 0 1 2 3 4 5 6 7 \ queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 hw 0 $ tc qdisc replace dev swp0 parent 1:1 \ taprio num_tc 8 map 0 1 2 3 4 5 6 7 \ queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 base-time 0 \ sched-entry S 0x7f 990000 sched-entry S 0x80 100000 \ flags 0x0 clockid CLOCK_TAI Unable to handle kernel paging request at virtual address fffffffffffffff8 [fffffffffffffff8] pgd=3D0000000000000000, p4d=3D0000000000000000 Internal error: Oops: 96000004 [#1] PREEMPT SMP Call trace: taprio_dump+0x27c/0x310 vsc9959_port_setup_tc+0x1f4/0x460 felix_port_setup_tc+0x24/0x3c dsa_slave_setup_tc+0x54/0x27c taprio_disable_offload.isra.0+0x58/0xe0 taprio_destroy+0x80/0x104 qdisc_create+0x240/0x470 tc_modify_qdisc+0x1fc/0x6b0 rtnetlink_rcv_msg+0x12c/0x390 netlink_rcv_skb+0x5c/0x130 rtnetlink_rcv+0x1c/0x2c Fix this by keeping track of the operations we made, and undo the offload only if we actually did it. I've added "bool offloaded" inside a 4 byte hole between "int clockid" and "atomic64_t picos_per_byte". Now the first cache line looks like below: $ pahole -C taprio_sched net/sched/sch_taprio.o struct taprio_sched { struct Qdisc * * qdiscs; /* 0 8 */ struct Qdisc * root; /* 8 8 */ u32 flags; /* 16 4 */ enum tk_offsets tk_offset; /* 20 4 */ int clockid; /* 24 4 */ bool offloaded; /* 28 1 */ /* XXX 3 bytes hole, try to pack */ atomic64_t picos_per_byte; /* 32 0 */ /* XXX 8 bytes hole, try to pack */ spinlock_t current_entry_lock; /* 40 0 */ /* XXX 8 bytes hole, try to pack */ struct sched_entry * current_entry; /* 48 8 */ struct sched_gate_list * oper_sched; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ Fixes: 9c66d1564676 ("taprio: Add support for hardware offloading") Signed-off-by: Vladimir Oltean Reviewed-by: Vinicius Costa Gomes Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/sched/sch_taprio.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 4c26f7fb32b3..842ccdcc0db2 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -65,6 +65,7 @@ struct taprio_sched { u32 flags; enum tk_offsets tk_offset; int clockid; + bool offloaded; atomic64_t picos_per_byte; /* Using picoseconds because for 10Gbps+ * speeds it's sub-nanoseconds per byte */ @@ -1268,6 +1269,8 @@ static int taprio_enable_offload(struct net_device *d= ev, goto done; } =20 + q->offloaded =3D true; + done: taprio_offload_free(offload); =20 @@ -1282,12 +1285,9 @@ static int taprio_disable_offload(struct net_device = *dev, struct tc_taprio_qopt_offload *offload; int err; =20 - if (!FULL_OFFLOAD_IS_ENABLED(q->flags)) + if (!q->offloaded) return 0; =20 - if (!ops->ndo_setup_tc) - return -EOPNOTSUPP; - offload =3D taprio_offload_alloc(0); if (!offload) { NL_SET_ERR_MSG(extack, @@ -1303,6 +1303,8 @@ static int taprio_disable_offload(struct net_device *= dev, goto out; } =20 + q->offloaded =3D false; + out: taprio_offload_free(offload); =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 345C2C07E9D for ; Mon, 26 Sep 2022 10:44:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236271AbiIZKnc (ORCPT ); Mon, 26 Sep 2022 06:43:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236267AbiIZKmb (ORCPT ); Mon, 26 Sep 2022 06:42:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4B5DE90; Mon, 26 Sep 2022 03:24: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 F37CA609D1; Mon, 26 Sep 2022 10:24:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1066FC433C1; Mon, 26 Sep 2022 10:24:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187857; bh=d2DtQtDp4JJPnrVB+mtoUIdTvXbw37ugwgs7rrKXT/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LF9/m3n6QtPtK9m3nGe9HLw9C08nSx6hTmlaL0E5LTLSlTot+Z696uARV5SORNG98 iCr24ory/9HDn/zSvOuznee1pLntXiLotwE45O2TB80pPwY8aZr4/fodYrUf567U/s icjRuAjejXQqe/Nwj2lEF/ycnSmyvmipTn/ocr8o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Vinicius Costa Gomes , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 083/120] net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child qdiscs Date: Mon, 26 Sep 2022 12:11:56 +0200 Message-Id: <20220926100754.089287316@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 1461d212ab277d8bba1a753d33e9afe03d81f9d4 ] taprio can only operate as root qdisc, and to that end, there exists the following check in taprio_init(), just as in mqprio: if (sch->parent !=3D TC_H_ROOT) return -EOPNOTSUPP; And indeed, when we try to attach taprio to an mqprio child, it fails as expected: $ tc qdisc add dev swp0 root handle 1: mqprio num_tc 8 \ map 0 1 2 3 4 5 6 7 \ queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 hw 0 $ tc qdisc replace dev swp0 parent 1:2 taprio num_tc 8 \ map 0 1 2 3 4 5 6 7 \ queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \ base-time 0 sched-entry S 0x7f 990000 sched-entry S 0x80 100000 \ flags 0x0 clockid CLOCK_TAI Error: sch_taprio: Can only be attached as root qdisc. (extack message added by me) But when we try to attach a taprio child to a taprio root qdisc, surprisingly it doesn't fail: $ tc qdisc replace dev swp0 root handle 1: taprio num_tc 8 \ map 0 1 2 3 4 5 6 7 queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \ base-time 0 sched-entry S 0x7f 990000 sched-entry S 0x80 100000 \ flags 0x0 clockid CLOCK_TAI $ tc qdisc replace dev swp0 parent 1:2 taprio num_tc 8 \ map 0 1 2 3 4 5 6 7 \ queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \ base-time 0 sched-entry S 0x7f 990000 sched-entry S 0x80 100000 \ flags 0x0 clockid CLOCK_TAI This is because tc_modify_qdisc() behaves differently when mqprio is root, vs when taprio is root. In the mqprio case, it finds the parent qdisc through p =3D qdisc_lookup(dev, TC_H_MAJ(clid)), and then the child qdisc through q =3D qdisc_leaf(p, clid). This leaf qdisc q has handle 0, so it is ignored according to the comment right below ("It may be default qdisc, ignore it"). As a result, tc_modify_qdisc() goes through the qdisc_create() code path, and this gives taprio_init() a chance to check for sch_parent !=3D TC_H_ROOT and error out. Whereas in the taprio case, the returned q =3D qdisc_leaf(p, clid) is different. It is not the default qdisc created for each netdev queue (both taprio and mqprio call qdisc_create_dflt() and keep them in a private q->qdiscs[], or priv->qdiscs[], respectively). Instead, taprio makes qdisc_leaf() return the _root_ qdisc, aka itself. When taprio does that, tc_modify_qdisc() goes through the qdisc_change() code path, because the qdisc layer never finds out about the child qdisc of the root. And through the ->change() ops, taprio has no reason to check whether its parent is root or not, just through ->init(), which is not called. The problem is the taprio_leaf() implementation. Even though code wise, it does the exact same thing as mqprio_leaf() which it is copied from, it works with different input data. This is because mqprio does not attach itself (the root) to each device TX queue, but one of the default qdiscs from its private array. In fact, since commit 13511704f8d7 ("net: taprio offload: enforce qdisc to netdev queue mapping"), taprio does this too, but just for the full offload case. So if we tried to attach a taprio child to a fully offloaded taprio root qdisc, it would properly fail too; just not to a software root taprio. To fix the problem, stop looking at the Qdisc that's attached to the TX queue, and instead, always return the default qdiscs that we've allocated (and to which we privately enqueue and dequeue, in software scheduling mode). Since Qdisc_class_ops :: leaf is only called from tc_modify_qdisc(), the risk of unforeseen side effects introduced by this change is minimal. Fixes: 5a781ccbd19e ("tc: Add support for configuring the taprio scheduler") Signed-off-by: Vladimir Oltean Reviewed-by: Vinicius Costa Gomes Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/sched/sch_taprio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 842ccdcc0db2..506ebae1f72c 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -1906,12 +1906,14 @@ static int taprio_dump(struct Qdisc *sch, struct sk= _buff *skb) =20 static struct Qdisc *taprio_leaf(struct Qdisc *sch, unsigned long cl) { - struct netdev_queue *dev_queue =3D taprio_queue_get(sch, cl); + struct taprio_sched *q =3D qdisc_priv(sch); + struct net_device *dev =3D qdisc_dev(sch); + unsigned int ntx =3D cl - 1; =20 - if (!dev_queue) + if (ntx >=3D dev->num_tx_queues) return NULL; =20 - return dev_queue->qdisc_sleeping; + return q->qdiscs[ntx]; } =20 static unsigned long taprio_find(struct Qdisc *sch, u32 classid) --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA0A0C32771 for ; Mon, 26 Sep 2022 10:45:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236409AbiIZKpV (ORCPT ); Mon, 26 Sep 2022 06:45:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234269AbiIZKnJ (ORCPT ); Mon, 26 Sep 2022 06:43:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 439C554CA5; Mon, 26 Sep 2022 03:24: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 B7AA2B80924; Mon, 26 Sep 2022 10:24:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 127FBC433D6; Mon, 26 Sep 2022 10:24:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187860; bh=bXef8Yi4ySuplraDxkHpjW2Xg2NLEtw3Qen7N27uESY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yxrrS0c1ghxK1ZSktM5sj4DBmD1NYu0KCk9PcYyTHGb7l8sfafUgnsocA90FG3+eV UvNvzmsR363WEBKM+5BwXUxw9B12NuQOOYXXTxqK9GSHUT3gKwPV+lqF/7jgscKFmg 5cplkYqfY/pZp5TNDY236XFQjjg+ylQWwj21WjKg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Sasha Levin , syzbot+a24c5252f3e3ab733464@syzkaller.appspotmail.com Subject: [PATCH 5.4 084/120] netfilter: ebtables: fix memory leak when blob is malformed Date: Mon, 26 Sep 2022 12:11:57 +0200 Message-Id: <20220926100754.128211337@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit 62ce44c4fff947eebdf10bb582267e686e6835c9 ] The bug fix was incomplete, it "replaced" crash with a memory leak. The old code had an assignment to "ret" embedded into the conditional, restore this. Fixes: 7997eff82828 ("netfilter: ebtables: reject blobs that don't provide = all entry points") Reported-and-tested-by: syzbot+a24c5252f3e3ab733464@syzkaller.appspotmail.c= om Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/bridge/netfilter/ebtables.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtable= s.c index ddb988c339c1..f6853fc0fcc0 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c @@ -999,8 +999,10 @@ static int do_replace_finish(struct net *net, struct e= bt_replace *repl, goto free_iterate; } =20 - if (repl->valid_hooks !=3D t->valid_hooks) + if (repl->valid_hooks !=3D t->valid_hooks) { + ret =3D -EINVAL; goto free_unlock; + } =20 if (repl->num_counters && repl->num_counters !=3D t->private->nentries) { ret =3D -EINVAL; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59FFDC07E9D for ; Mon, 26 Sep 2022 10:45:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236420AbiIZKpY (ORCPT ); Mon, 26 Sep 2022 06:45:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236328AbiIZKnJ (ORCPT ); Mon, 26 Sep 2022 06:43:09 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93EB94D80F; Mon, 26 Sep 2022 03:24: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 sin.source.kernel.org (Postfix) with ESMTPS id C22FCCE10E3; Mon, 26 Sep 2022 10:24:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A59FC433C1; Mon, 26 Sep 2022 10:24:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187863; bh=XuPKIjgcGPsv9qh2PIZC14M+a1tA6bAZKLV8cvEU0AE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s6XWOibz/JWBIInTdY5ZMXvwvukTDApiFvBg7sDXKFnJbbWofwBJc7eG7xdprVBBb V/gi+kSRkH/U+MaHGIrRJKfn5sGgS/k6yVv2KZNw7IjB73pMy3zU2uiMkKNu9Ivyxh jkfTF2mFS0GKv7ZYvYLtPRGGBsjw3vJbMpqMpUY4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.4 085/120] can: gs_usb: gs_can_open(): fix race dev->can.state condition Date: Mon, 26 Sep 2022 12:11:58 +0200 Message-Id: <20220926100754.159565514@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marc Kleine-Budde [ Upstream commit 5440428b3da65408dba0241985acb7a05258b85e ] The dev->can.state is set to CAN_STATE_ERROR_ACTIVE, after the device has been started. On busy networks the CAN controller might receive CAN frame between and go into an error state before the dev->can.state is assigned. Assign dev->can.state before starting the controller to close the race window. Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices= ") Link: https://lore.kernel.org/all/20220920195216.232481-1-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/can/usb/gs_usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c index bf4ab30186af..abd2a57b18cb 100644 --- a/drivers/net/can/usb/gs_usb.c +++ b/drivers/net/can/usb/gs_usb.c @@ -678,6 +678,7 @@ static int gs_can_open(struct net_device *netdev) flags |=3D GS_CAN_MODE_TRIPLE_SAMPLE; =20 /* finally start device */ + dev->can.state =3D CAN_STATE_ERROR_ACTIVE; dm->mode =3D cpu_to_le32(GS_CAN_MODE_START); dm->flags =3D cpu_to_le32(flags); rc =3D usb_control_msg(interface_to_usbdev(dev->iface), @@ -694,13 +695,12 @@ static int gs_can_open(struct net_device *netdev) if (rc < 0) { netdev_err(netdev, "Couldn't start device (err=3D%d)\n", rc); kfree(dm); + dev->can.state =3D CAN_STATE_STOPPED; return rc; } =20 kfree(dm); =20 - dev->can.state =3D CAN_STATE_ERROR_ACTIVE; - parent->active_channels++; if (!(dev->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) netif_start_queue(netdev); --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 305A0C6FA90 for ; Mon, 26 Sep 2022 10:45:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236389AbiIZKpR (ORCPT ); Mon, 26 Sep 2022 06:45:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236318AbiIZKm7 (ORCPT ); Mon, 26 Sep 2022 06:42:59 -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 A459013DEA; Mon, 26 Sep 2022 03:24:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D88FFB80682; Mon, 26 Sep 2022 10:24:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D61EC433D6; Mon, 26 Sep 2022 10:24:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187866; bh=0lhGkSCOA6U77y1Wa49mYe2WnX42qJWBP6yLtkatyMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMm8wEF7kHdKtfd7RrQ4NgpT5LIHlEcOToNgjzkYQzZ/ym/aezCyELxSjcZ0XU4d/ P4NzbOf0lHsjZ45bvIhZ5/i7f2JRYq06ynrs/eRFt4gB1WefpFf9cax40NDl/azEkT ozHB+R6KjLiqFkKYnmzBu0cmimN/6EP1WQMToWsE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Yan , Lieven Hey , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.4 086/120] perf jit: Include program header in ELF files Date: Mon, 26 Sep 2022 12:11:59 +0200 Message-Id: <20220926100754.188681896@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lieven Hey [ Upstream commit babd04386b1df8c364cdaa39ac0e54349502e1e5 ] The missing header makes it hard for programs like elfutils to open these files. Fixes: 2d86612aacb7805f ("perf symbol: Correct address for bss symbols") Reviewed-by: Leo Yan Signed-off-by: Lieven Hey Tested-by: Leo Yan Cc: Leo Yan Link: https://lore.kernel.org/r/20220915092910.711036-1-lieven.hey@kdab.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/perf/util/genelf.c | 14 ++++++++++++++ tools/perf/util/genelf.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/tools/perf/util/genelf.c b/tools/perf/util/genelf.c index 17b74aba8b9a..69744fd5db39 100644 --- a/tools/perf/util/genelf.c +++ b/tools/perf/util/genelf.c @@ -256,6 +256,7 @@ jit_write_elf(int fd, uint64_t load_addr, const char *s= ym, Elf_Data *d; Elf_Scn *scn; Elf_Ehdr *ehdr; + Elf_Phdr *phdr; Elf_Shdr *shdr; uint64_t eh_frame_base_offset; char *strsym =3D NULL; @@ -290,6 +291,19 @@ jit_write_elf(int fd, uint64_t load_addr, const char *= sym, ehdr->e_version =3D EV_CURRENT; ehdr->e_shstrndx=3D unwinding ? 4 : 2; /* shdr index for section name */ =20 + /* + * setup program header + */ + phdr =3D elf_newphdr(e, 1); + phdr[0].p_type =3D PT_LOAD; + phdr[0].p_offset =3D 0; + phdr[0].p_vaddr =3D 0; + phdr[0].p_paddr =3D 0; + phdr[0].p_filesz =3D csize; + phdr[0].p_memsz =3D csize; + phdr[0].p_flags =3D PF_X | PF_R; + phdr[0].p_align =3D 8; + /* * setup text section */ diff --git a/tools/perf/util/genelf.h b/tools/perf/util/genelf.h index d4137559be05..ac638945b4cb 100644 --- a/tools/perf/util/genelf.h +++ b/tools/perf/util/genelf.h @@ -50,8 +50,10 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void = *debug, int nr_debug_ent =20 #if GEN_ELF_CLASS =3D=3D ELFCLASS64 #define elf_newehdr elf64_newehdr +#define elf_newphdr elf64_newphdr #define elf_getshdr elf64_getshdr #define Elf_Ehdr Elf64_Ehdr +#define Elf_Phdr Elf64_Phdr #define Elf_Shdr Elf64_Shdr #define Elf_Sym Elf64_Sym #define ELF_ST_TYPE(a) ELF64_ST_TYPE(a) @@ -59,8 +61,10 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void = *debug, int nr_debug_ent #define ELF_ST_VIS(a) ELF64_ST_VISIBILITY(a) #else #define elf_newehdr elf32_newehdr +#define elf_newphdr elf32_newphdr #define elf_getshdr elf32_getshdr #define Elf_Ehdr Elf32_Ehdr +#define Elf_Phdr Elf32_Phdr #define Elf_Shdr Elf32_Shdr #define Elf_Sym Elf32_Sym #define ELF_ST_TYPE(a) ELF32_ST_TYPE(a) --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D1C7C32771 for ; Mon, 26 Sep 2022 10:45:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236346AbiIZKpr (ORCPT ); Mon, 26 Sep 2022 06:45:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233804AbiIZKna (ORCPT ); Mon, 26 Sep 2022 06:43:30 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 744E61CB; Mon, 26 Sep 2022 03:24: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 sin.source.kernel.org (Postfix) with ESMTPS id 57B72CE10E7; Mon, 26 Sep 2022 10:24:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4545EC433D6; Mon, 26 Sep 2022 10:24:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187869; bh=zadlpnKD6sjdhTaeTlpUHuA+J3MSs8/PSaLg59JCzQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XUkbKAWWp7L8GzZZV08rr5xAiJaRc7vlfXqnlmDxx53edJD9rksSsTKgA8iQNSEYJ hta/I7yljzIvHb21hVXzfc5eZHVymJqUknJ+DWJT4VdGo9YHcC371+UCzPAaJBNlom 4ALfEznMyClDfsXwn7ieXtjgndWGPKHjcff1ESBs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Dao , Adrian Hunter , Namhyung Kim , Ian Rogers , Jiri Olsa , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.4 087/120] perf kcore_copy: Do not check /proc/modules is unchanged Date: Mon, 26 Sep 2022 12:12:00 +0200 Message-Id: <20220926100754.217398729@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adrian Hunter [ Upstream commit 5b427df27b94aec1312cace48a746782a0925c53 ] /proc/kallsyms and /proc/modules are compared before and after the copy in order to ensure no changes during the copy. However /proc/modules also might change due to reference counts changing even though that does not make any difference. Any modules loaded or unloaded should be visible in changes to kallsyms, so it is not necessary to check /proc/modules also anyway. Remove the comparison checking that /proc/modules is unchanged. Fixes: fc1b691d7651d949 ("perf buildid-cache: Add ability to add kcore to t= he cache") Reported-by: Daniel Dao Signed-off-by: Adrian Hunter Tested-by: Daniel Dao Acked-by: Namhyung Kim Cc: Ian Rogers Cc: Jiri Olsa Link: https://lore.kernel.org/r/20220914122429.8770-1-adrian.hunter@intel.c= om Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/perf/util/symbol-elf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index a04a7dfb8ec0..f15258fbe9db 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -1912,8 +1912,8 @@ static int kcore_copy__compare_file(const char *from_= dir, const char *to_dir, * unusual. One significant peculiarity is that the mapping (start -> pgo= ff) * is not the same for the kernel map and the modules map. That happens b= ecause * the data is copied adjacently whereas the original kcore has gaps. Fin= ally, - * kallsyms and modules files are compared with their copies to check that - * modules have not been loaded or unloaded while the copies were taking p= lace. + * kallsyms file is compared with its copy to check that modules have not = been + * loaded or unloaded while the copies were taking place. * * Return: %0 on success, %-1 on failure. */ @@ -1976,9 +1976,6 @@ int kcore_copy(const char *from_dir, const char *to_d= ir) goto out_extract_close; } =20 - if (kcore_copy__compare_file(from_dir, to_dir, "modules")) - goto out_extract_close; - if (kcore_copy__compare_file(from_dir, to_dir, "kallsyms")) goto out_extract_close; =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11254C07E9D for ; Mon, 26 Sep 2022 10:45:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236441AbiIZKpl (ORCPT ); Mon, 26 Sep 2022 06:45:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234419AbiIZKnb (ORCPT ); Mon, 26 Sep 2022 06:43:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FEA41108; Mon, 26 Sep 2022 03:24: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 12854B80926; Mon, 26 Sep 2022 10:24:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56AF7C433D6; Mon, 26 Sep 2022 10:24:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187872; bh=+482eHK9KpYB34u8MBklS4BG1HDGc5smUSJunOxLLrs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s/UY64MWt96QwRVMud+F59eKMYgDfMBf07oXCDZvLkKALnQHlnWeS61DGa76CJ2Hs ylznxOVpvNjr8IS7Fo7z27fzls98qKmQmL1eFJOGC7VtxRHd0fy4No/uyq3fd5AmjN stDxMnUZqzp2jhkpngxf62WwaxakD2tQ23UxDB1A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Anderson , Andrew Lunn , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 088/120] net: sunhme: Fix packet reception for len < RX_COPY_THRESHOLD Date: Mon, 26 Sep 2022 12:12:01 +0200 Message-Id: <20220926100754.250068308@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Anderson [ Upstream commit 878e2405710aacfeeb19364c300f38b7a9abfe8f ] There is a separate receive path for small packets (under 256 bytes). Instead of allocating a new dma-capable skb to be used for the next packet, this path allocates a skb and copies the data into it (reusing the existing sbk for the next packet). There are two bytes of junk data at the beginning of every packet. I believe these are inserted in order to allow aligned DMA and IP headers. We skip over them using skb_reserve. Before copying over the data, we must use a barrier to ensure we see the whole packet. The current code only synchronizes len bytes, starting from the beginning of the packet, including the junk bytes. However, this leaves off the final two bytes in the packet. Synchronize the whole packet. To reproduce this problem, ping a HME with a payload size between 17 and 214 $ ping -s 17 which will complain rather loudly about the data mismatch. Small packets (below 60 bytes on the wire) do not have this issue. I suspect this is related to the padding added to increase the minimum packet size. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Sean Anderson Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20220920235018.1675956-1-seanga2@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/sun/sunhme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/s= unhme.c index 3133f903279c..dbbbb6ea9f2b 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c @@ -2064,9 +2064,9 @@ static void happy_meal_rx(struct happy_meal *hp, stru= ct net_device *dev) =20 skb_reserve(copy_skb, 2); skb_put(copy_skb, len); - dma_sync_single_for_cpu(hp->dma_dev, dma_addr, len, DMA_FROM_DEVICE); + dma_sync_single_for_cpu(hp->dma_dev, dma_addr, len + 2, DMA_FROM_DEVICE= ); skb_copy_from_linear_data(skb, copy_skb->data, len); - dma_sync_single_for_device(hp->dma_dev, dma_addr, len, DMA_FROM_DEVICE); + dma_sync_single_for_device(hp->dma_dev, dma_addr, len + 2, DMA_FROM_DEV= ICE); /* Reuse original ring buffer. */ hme_write_rxd(hp, this, (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)), --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34757C07E9D for ; Mon, 26 Sep 2022 10:45:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236456AbiIZKpu (ORCPT ); Mon, 26 Sep 2022 06:45:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233950AbiIZKnc (ORCPT ); Mon, 26 Sep 2022 06:43:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E76B76147; Mon, 26 Sep 2022 03:24: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 84F5560AD6; Mon, 26 Sep 2022 10:24:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A49AC433C1; Mon, 26 Sep 2022 10:24:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187879; bh=nttKwMzohucLBQGLis9sz97vkQJSg2wWKzcekjrxcRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V2i7una7QQjTqb++OACNgln1LuEPTr1gaMb8gPBYviDBrKWec2cixyr+GBNk7hKBc 7LKZi/6q6od2vzHA4PvRtkilGWpvCfhSDnQqcLKVZIbRJqkSJJguxlyFSGNPp8shjl PY9TLet/VxAaLkKd53ah6BEh1CZbEyM2yCMDJmdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Vlad Buslov , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 089/120] net: sched: fix possible refcount leak in tc_new_tfilter() Date: Mon, 26 Sep 2022 12:12:02 +0200 Message-Id: <20220926100754.288285594@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hangyu Hua [ Upstream commit c2e1cfefcac35e0eea229e148c8284088ce437b5 ] tfilter_put need to be called to put the refount got by tp->ops->get to avoid possible refcount leak when chain->tmplt_ops !=3D NULL and chain->tmplt_ops !=3D tp->ops. Fixes: 7d5509fa0d3d ("net: sched: extend proto ops with 'put' callback") Signed-off-by: Hangyu Hua Reviewed-by: Vlad Buslov Link: https://lore.kernel.org/r/20220921092734.31700-1-hbh25y@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/sched/cls_api.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 919c7fa5f02d..48a8c7daa635 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -2098,6 +2098,7 @@ static int tc_new_tfilter(struct sk_buff *skb, struct= nlmsghdr *n, } =20 if (chain->tmplt_ops && chain->tmplt_ops !=3D tp->ops) { + tfilter_put(tp, fh); NL_SET_ERR_MSG(extack, "Chain template is set to a different filter kind= "); err =3D -EINVAL; goto errout; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABA8EC07E9D for ; Mon, 26 Sep 2022 10:45:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236468AbiIZKpy (ORCPT ); Mon, 26 Sep 2022 06:45:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236347AbiIZKnf (ORCPT ); Mon, 26 Sep 2022 06:43:35 -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 17C15BA1; Mon, 26 Sep 2022 03:24: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 A931160AD6; Mon, 26 Sep 2022 10:24:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A516FC433D6; Mon, 26 Sep 2022 10:24:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187882; bh=xQH6vrgmE4h0MQ3Uyqp+HHzLr8FL1uDj8AtkNc+cma4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w5LB/bTDHEyBLGvITetHLObJlaSxgs4M5EFF6BqPqMVOTBkw95KEj1xbpQmNZV5ba HgUzDixjlDYjD4lOjohcyRDVJtL78Ew0MvKgJjalh4rVxnuTDVIQmtlVjR7bz7lp6O Us1+eetFigqwSr32vF5lw1S9kl9H4WiApzdzAgiA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , stable , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.4 090/120] serial: Create uart_xmit_advance() Date: Mon, 26 Sep 2022 12:12:03 +0200 Message-Id: <20220926100754.317408095@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen commit e77cab77f2cb3a1ca2ba8df4af45bb35617ac16d upstream. A very common pattern in the drivers is to advance xmit tail index and do bookkeeping of Tx'ed characters. Create uart_xmit_advance() to handle it. Reviewed-by: Andy Shevchenko Cc: stable Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/20220901143934.8850-2-ilpo.jarvinen@linux.i= ntel.com Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/serial_core.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -297,6 +297,23 @@ struct uart_state { /* number of characters left in xmit buffer before we ask for more */ #define WAKEUP_CHARS 256 =20 +/** + * uart_xmit_advance - Advance xmit buffer and account Tx'ed chars + * @up: uart_port structure describing the port + * @chars: number of characters sent + * + * This function advances the tail of circular xmit buffer by the number of + * @chars transmitted and handles accounting of transmitted bytes (into + * @up's icount.tx). + */ +static inline void uart_xmit_advance(struct uart_port *up, unsigned int ch= ars) +{ + struct circ_buf *xmit =3D &up->state->xmit; + + xmit->tail =3D (xmit->tail + chars) & (UART_XMIT_SIZE - 1); + up->icount.tx +=3D chars; +} + struct module; struct tty_driver; =20 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EBE3C32771 for ; Mon, 26 Sep 2022 10:46:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236472AbiIZKp6 (ORCPT ); Mon, 26 Sep 2022 06:45:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236411AbiIZKnh (ORCPT ); Mon, 26 Sep 2022 06:43:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB05511C13; Mon, 26 Sep 2022 03:24: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 67AACB80682; Mon, 26 Sep 2022 10:24:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6851C433D7; Mon, 26 Sep 2022 10:24:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187885; bh=rMQyFM4XEKYxbNi+Pl2ZddmOL/oLdGY390SQioJnnPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dZhev1lSOWlxa2TOH+d4Cli3qW3mY1HF3Usm6j55XNxpCcfPb8hIOdR7Yba330HaO Vv8RdV9vCc1mM2TjS3cdDgS9XhQrhxfjIsGfUF/qzsvRW/+9EdmkntZft33S9YcsJB xHBsxz2yIvgAupuXGzlXyOd/DqaRIlnVVOFRCbAo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.4 091/120] serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting Date: Mon, 26 Sep 2022 12:12:04 +0200 Message-Id: <20220926100754.346443606@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen commit 754f68044c7dd6c52534ba3e0f664830285c4b15 upstream. DMA complete & stop paths did not correctly account Tx'ed characters into icount.tx. Using uart_xmit_advance() fixes the problem. Fixes: e9ea096dd225 ("serial: tegra: add serial driver") Cc: # serial: Create uart_xmit_advance() Reviewed-by: Andy Shevchenko Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/20220901143934.8850-3-ilpo.jarvinen@linux.i= ntel.com Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/serial-tegra.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/tty/serial/serial-tegra.c +++ b/drivers/tty/serial/serial-tegra.c @@ -519,7 +519,7 @@ static void tegra_uart_tx_dma_complete(v count =3D tup->tx_bytes_requested - state.residue; async_tx_ack(tup->tx_dma_desc); spin_lock_irqsave(&tup->uport.lock, flags); - xmit->tail =3D (xmit->tail + count) & (UART_XMIT_SIZE - 1); + uart_xmit_advance(&tup->uport, count); tup->tx_in_progress =3D 0; if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) uart_write_wakeup(&tup->uport); @@ -606,7 +606,6 @@ static unsigned int tegra_uart_tx_empty( static void tegra_uart_stop_tx(struct uart_port *u) { struct tegra_uart_port *tup =3D to_tegra_uport(u); - struct circ_buf *xmit =3D &tup->uport.state->xmit; struct dma_tx_state state; unsigned int count; =20 @@ -617,7 +616,7 @@ static void tegra_uart_stop_tx(struct ua dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state); count =3D tup->tx_bytes_requested - state.residue; async_tx_ack(tup->tx_dma_desc); - xmit->tail =3D (xmit->tail + count) & (UART_XMIT_SIZE - 1); + uart_xmit_advance(&tup->uport, count); tup->tx_in_progress =3D 0; } =20 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13473C32771 for ; Mon, 26 Sep 2022 10:46:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236478AbiIZKqB (ORCPT ); Mon, 26 Sep 2022 06:46:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236422AbiIZKni (ORCPT ); Mon, 26 Sep 2022 06:43:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA340311; Mon, 26 Sep 2022 03:24: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 8F192B80920; Mon, 26 Sep 2022 10:24:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C838AC433C1; Mon, 26 Sep 2022 10:24:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187888; bh=xLv6Yp4tyzE+V2Ro4LgR0kyqrrBkxn5bGkLAx5w9QAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B0ne3X05JKpddJX5dI/9puus8VdSkopFYD2ypNzmoc1BOBdSo6Tv9IUA6dfbTDK7m ZKZfpUhPZmbErkKO6UXhSrQDfusT6vaZb3+nRcKsq4+sbpql1IWcAE5iSiN5MpPJFZ jYx3b9JE9WzG/PbsB7p56QArd4Ud6EP8gxFLiKHM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.4 092/120] serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting Date: Mon, 26 Sep 2022 12:12:05 +0200 Message-Id: <20220926100754.380471788@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen commit 1d10cd4da593bc0196a239dcc54dac24b6b0a74e upstream. Tx'ing does not correctly account Tx'ed characters into icount.tx. Using uart_xmit_advance() fixes the problem. Fixes: 2d908b38d409 ("serial: Add Tegra Combined UART driver") Cc: # serial: Create uart_xmit_advance() Reviewed-by: Andy Shevchenko Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/20220901143934.8850-4-ilpo.jarvinen@linux.i= ntel.com Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/tegra-tcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/serial/tegra-tcu.c +++ b/drivers/tty/serial/tegra-tcu.c @@ -101,7 +101,7 @@ static void tegra_tcu_uart_start_tx(stru break; =20 tegra_tcu_write(tcu, &xmit->buf[xmit->tail], count); - xmit->tail =3D (xmit->tail + count) & (UART_XMIT_SIZE - 1); + uart_xmit_advance(port, count); } =20 uart_write_wakeup(port); From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78E4AC07E9D for ; Mon, 26 Sep 2022 10:46:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236431AbiIZKqF (ORCPT ); Mon, 26 Sep 2022 06:46:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236430AbiIZKnj (ORCPT ); Mon, 26 Sep 2022 06:43:39 -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 37A352BD5; Mon, 26 Sep 2022 03:24: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 A3039B80915; Mon, 26 Sep 2022 10:24:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9D1BC433D7; Mon, 26 Sep 2022 10:24:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187891; bh=75DfJ5Yqg1z2SFT3L+O7MKMIFpGoOqNpgcehWq6lixc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Igq5s0cJWSGyQhG6+VbiLP8gEg23HibceXHGArQfuqjjB3g4CWRexjNVzsDoa/iTb oPpay4c9YoQOs9pYHTXnHTOU9a3xycQSMrrg3dsh0zvlth3rhNM1AK4Pm5IWOfDRvA 0HQ1zriZIci5+XNCCh/Df7rxSrZirAmwVoUYZTfE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Haberland , Jan Hoeppner , Jens Axboe Subject: [PATCH 5.4 093/120] s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup Date: Mon, 26 Sep 2022 12:12:06 +0200 Message-Id: <20220926100754.409706688@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stefan Haberland commit db7ba07108a48c0f95b74fabbfd5d63e924f992d upstream. Fix Oops in dasd_alias_get_start_dev() function caused by the pavgroup pointer being NULL. The pavgroup pointer is checked on the entrance of the function but without the lcu->lock being held. Therefore there is a race window between dasd_alias_get_start_dev() and _lcu_update() which sets pavgroup to NULL with the lcu->lock held. Fix by checking the pavgroup pointer with lcu->lock held. Cc: # 2.6.25+ Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device dri= ver, part 1") Signed-off-by: Stefan Haberland Reviewed-by: Jan Hoeppner Link: https://lore.kernel.org/r/20220919154931.4123002-2-sth@linux.ibm.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/s390/block/dasd_alias.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/s390/block/dasd_alias.c +++ b/drivers/s390/block/dasd_alias.c @@ -675,12 +675,12 @@ int dasd_alias_remove_device(struct dasd struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *base_devi= ce) { struct dasd_eckd_private *alias_priv, *private =3D base_device->private; - struct alias_pav_group *group =3D private->pavgroup; struct alias_lcu *lcu =3D private->lcu; struct dasd_device *alias_device; + struct alias_pav_group *group; unsigned long flags; =20 - if (!group || !lcu) + if (!lcu) return NULL; if (lcu->pav =3D=3D NO_PAV || lcu->flags & (NEED_UAC_UPDATE | UPDATE_PENDING)) @@ -697,6 +697,11 @@ struct dasd_device *dasd_alias_get_start } =20 spin_lock_irqsave(&lcu->lock, flags); + group =3D private->pavgroup; + if (!group) { + spin_unlock_irqrestore(&lcu->lock, flags); + return NULL; + } alias_device =3D group->next; if (!alias_device) { if (list_empty(&group->aliaslist)) { From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D03EC07E9D for ; Mon, 26 Sep 2022 10:46:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236491AbiIZKqL (ORCPT ); Mon, 26 Sep 2022 06:46:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236445AbiIZKnn (ORCPT ); Mon, 26 Sep 2022 06:43: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 5A463B4B; Mon, 26 Sep 2022 03:24: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 0F037B80682; Mon, 26 Sep 2022 10:24:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4295DC433C1; Mon, 26 Sep 2022 10:24:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187894; bh=14LOge9ZT3P4ZiqBhc7nTzeEF/5VcYCWhsD0HB6YN1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M/va6fZu7wJDI5oZMEJFc9H1dlnuyK3nLFxwrghBaoYKVPGbkQXgeeIjNt/AlAMOe vPV/3xY5mMuVLPdtnONnXizrZGr/cAzjGy6P6o4p6Hffhiy1VPrdcdfqVoe89M4Wy4 VAYMZUwhMk6NrSBaADxmkyk/101LDtfh3RJoV4lw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stan Lu , Chunfeng Yun Subject: [PATCH 5.4 094/120] usb: xhci-mtk: fix issue of out-of-bounds array access Date: Mon, 26 Sep 2022 12:12:07 +0200 Message-Id: <20220926100754.444731153@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chunfeng Yun commit de5107f473190538a65aac7edea85209cd5c1a8f upstream. Bus bandwidth array access is based on esit, increase one will cause out-of-bounds issue; for example, when esit is XHCI_MTK_MAX_ESIT, will overstep boundary. Fixes: 7c986fbc16ae ("usb: xhci-mtk: get the microframe boundary for ESIT") Cc: Reported-by: Stan Lu Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/1629189389-18779-5-git-send-email-chunfeng.= yun@mediatek.com Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/host/xhci-mtk-sch.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -539,10 +539,12 @@ static u32 get_esit_boundary(struct mu3h u32 boundary =3D sch_ep->esit; =20 if (sch_ep->sch_tt) { /* LS/FS with TT */ - /* tune for CS */ - if (sch_ep->ep_type !=3D ISOC_OUT_EP) - boundary++; - else if (boundary > 1) /* normally esit >=3D 8 for FS/LS */ + /* + * tune for CS, normally esit >=3D 8 for FS/LS, + * not add one for other types to avoid access array + * out of boundary + */ + if (sch_ep->ep_type =3D=3D ISOC_OUT_EP && boundary > 1) boundary--; } From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 354E4C32771 for ; Mon, 26 Sep 2022 10:46:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236496AbiIZKqO (ORCPT ); Mon, 26 Sep 2022 06:46:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236452AbiIZKno (ORCPT ); Mon, 26 Sep 2022 06:43:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E07864F5; Mon, 26 Sep 2022 03:25:00 -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 DF8D5B80835; Mon, 26 Sep 2022 10:24:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C434C433D6; Mon, 26 Sep 2022 10:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187897; bh=rs/DNJTbTikkhyrwk9dFbjZrJq4u7VEgRZl2QMhDaeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=axUqUECPPHuCzTRpeP5bsWu63ujz3rDrlOrBoAhZIIkknmtyP38HkbRAjmKHL/eLq URyIGLEXAW1Pkgl7q1pM4WZKVAKPhaZSiDPFAakftEWoeR9opeExKkMxktswXeiZAf lZ/lpXTTbV4LLroQC8jrmwOFKv30vIJ30xs8mU4I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Metzmacher , "Paulo Alcantara (SUSE)" , Ronnie Sahlberg , Steve French , Sasha Levin Subject: [PATCH 5.4 095/120] cifs: always initialize struct msghdr smb_msg completely Date: Mon, 26 Sep 2022 12:12:08 +0200 Message-Id: <20220926100754.477823470@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stefan Metzmacher [ Upstream commit bedc8f76b3539ac4f952114b316bcc2251e808ce ] So far we were just lucky because the uninitialized members of struct msghdr are not used by default on a SOCK_STREAM tcp socket. But as new things like msg_ubuf and sg_from_iter where added recently, we should play on the safe side and avoid potention problems in future. Signed-off-by: Stefan Metzmacher Cc: stable@vger.kernel.org Reviewed-by: Paulo Alcantara (SUSE) Reviewed-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/cifs/connect.c | 7 ++----- fs/cifs/transport.c | 6 +----- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 86bdebd2ece6..f8127edb8973 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -791,9 +791,6 @@ cifs_readv_from_socket(struct TCP_Server_Info *server, = struct msghdr *smb_msg) int length =3D 0; int total_read; =20 - smb_msg->msg_control =3D NULL; - smb_msg->msg_controllen =3D 0; - for (total_read =3D 0; msg_data_left(smb_msg); total_read +=3D length) { try_to_freeze(); =20 @@ -844,7 +841,7 @@ int cifs_read_from_socket(struct TCP_Server_Info *server, char *buf, unsigned int to_read) { - struct msghdr smb_msg; + struct msghdr smb_msg =3D {}; struct kvec iov =3D {.iov_base =3D buf, .iov_len =3D to_read}; iov_iter_kvec(&smb_msg.msg_iter, READ, &iov, 1, to_read); =20 @@ -855,7 +852,7 @@ int cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *pa= ge, unsigned int page_offset, unsigned int to_read) { - struct msghdr smb_msg; + struct msghdr smb_msg =3D {}; struct bio_vec bv =3D { .bv_page =3D page, .bv_len =3D to_read, .bv_offset =3D page_offset}; iov_iter_bvec(&smb_msg.msg_iter, READ, &bv, 1, to_read); diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 079a4f6162ed..b98ae69edb8f 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -209,10 +209,6 @@ smb_send_kvec(struct TCP_Server_Info *server, struct m= sghdr *smb_msg, =20 *sent =3D 0; =20 - smb_msg->msg_name =3D NULL; - smb_msg->msg_namelen =3D 0; - smb_msg->msg_control =3D NULL; - smb_msg->msg_controllen =3D 0; if (server->noblocksnd) smb_msg->msg_flags =3D MSG_DONTWAIT + MSG_NOSIGNAL; else @@ -324,7 +320,7 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num= _rqst, sigset_t mask, oldmask; size_t total_len =3D 0, sent, size; struct socket *ssocket =3D server->ssocket; - struct msghdr smb_msg; + struct msghdr smb_msg =3D {}; int val =3D 1; __be32 rfc1002_marker; =20 --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F8DFC07E9D for ; Mon, 26 Sep 2022 10:46:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236487AbiIZKqU (ORCPT ); Mon, 26 Sep 2022 06:46:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236466AbiIZKnq (ORCPT ); Mon, 26 Sep 2022 06:43:46 -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 BED2A1DF11; Mon, 26 Sep 2022 03:25: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 4003D60B5E; Mon, 26 Sep 2022 10:25:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C575C433D6; Mon, 26 Sep 2022 10:25:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187900; bh=/YrSBpEiADO76hZpqaELx1LTekFkdTUQYgH7dEgZLkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wu8nDb3ksr+lNGtLj6ci/2hDlaUGR506igXi2sPe0x6BGSSILIAUhaF1HkjZtQwBc ZcN6YC4rDFg38xf8FhRDxZUVU/AqCFUuQq10WE73r9FYRAEJx463UgtsU3tBJo0g2Q z8tnMZHfTMPZCGYWTx44FfR4uQgi4vopOHyqx5+I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , Vitaly Kuznetsov , Wei Liu , Sasha Levin Subject: [PATCH 5.4 096/120] Drivers: hv: Never allocate anything besides framebuffer from framebuffer memory region Date: Mon, 26 Sep 2022 12:12:09 +0200 Message-Id: <20220926100754.511642452@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vitaly Kuznetsov [ Upstream commit f0880e2cb7e1f8039a048fdd01ce45ab77247221 ] Passed through PCI device sometimes misbehave on Gen1 VMs when Hyper-V DRM driver is also loaded. Looking at IOMEM assignment, we can see e.g. $ cat /proc/iomem ... f8000000-fffbffff : PCI Bus 0000:00 f8000000-fbffffff : 0000:00:08.0 f8000000-f8001fff : bb8c4f33-2ba2-4808-9f7f-02f3b4da22fe ... fe0000000-fffffffff : PCI Bus 0000:00 fe0000000-fe07fffff : bb8c4f33-2ba2-4808-9f7f-02f3b4da22fe fe0000000-fe07fffff : 2ba2:00:02.0 fe0000000-fe07fffff : mlx4_core the interesting part is the 'f8000000' region as it is actually the VM's framebuffer: $ lspci -v ... 0000:00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtu= al VGA (prog-if 00 [VGA controller]) Flags: bus master, fast devsel, latency 0, IRQ 11 Memory at f8000000 (32-bit, non-prefetchable) [size=3D64M] ... hv_vmbus: registering driver hyperv_drm hyperv_drm 5620e0c7-8062-4dce-aeb7-520c7ef76171: [drm] Synthvid Version ma= jor 3, minor 5 hyperv_drm 0000:00:08.0: vgaarb: deactivate vga console hyperv_drm 0000:00:08.0: BAR 0: can't reserve [mem 0xf8000000-0xfbffffff] hyperv_drm 5620e0c7-8062-4dce-aeb7-520c7ef76171: [drm] Cannot request fram= ebuffer, boot fb still active? Note: "Cannot request framebuffer" is not a fatal error in hyperv_setup_gen1() as the code assumes there's some other framebuffer device there but we actually have some other PCI device (mlx4 in this case) config space there! The problem appears to be that vmbus_allocate_mmio() can use dedicated framebuffer region to serve any MMIO request from any device. The semantics one might assume of a parameter named "fb_overlap_ok" aren't implemented because !fb_overlap_ok essentially has no effect. The existing semantics are really "prefer_fb_overlap". This patch implements the expected and needed semantics, which is to not allocate from the frame buffer space when !fb_overlap_ok. Note, Gen2 VMs are usually unaffected by the issue because framebuffer region is already taken by EFI fb (in case kernel supports it) but Gen1 VMs may have this region unclaimed by the time Hyper-V PCI pass-through driver tries allocating MMIO space if Hyper-V DRM/FB drivers load after it. Devices can be brought up in any sequence so let's resolve the issue by always ignoring 'fb_mmio' region for non-FB requests, even if the region is unclaimed. Reviewed-by: Michael Kelley Signed-off-by: Vitaly Kuznetsov Link: https://lore.kernel.org/r/20220827130345.1320254-4-vkuznets@redhat.com Signed-off-by: Wei Liu Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hv/vmbus_drv.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 56918274c48c..d4c5efc6e157 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -2075,7 +2075,7 @@ int vmbus_allocate_mmio(struct resource **new, struct= hv_device *device_obj, bool fb_overlap_ok) { struct resource *iter, *shadow; - resource_size_t range_min, range_max, start; + resource_size_t range_min, range_max, start, end; const char *dev_n =3D dev_name(&device_obj->device); int retval; =20 @@ -2110,6 +2110,14 @@ int vmbus_allocate_mmio(struct resource **new, struc= t hv_device *device_obj, range_max =3D iter->end; start =3D (range_min + align - 1) & ~(align - 1); for (; start + size - 1 <=3D range_max; start +=3D align) { + end =3D start + size - 1; + + /* Skip the whole fb_mmio region if not fb_overlap_ok */ + if (!fb_overlap_ok && fb_mmio && + (((start >=3D fb_mmio->start) && (start <=3D fb_mmio->end)) || + ((end >=3D fb_mmio->start) && (end <=3D fb_mmio->end)))) + continue; + shadow =3D __request_region(iter, start, size, NULL, IORESOURCE_BUSY); if (!shadow) --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09540C07E9D for ; Mon, 26 Sep 2022 10:46:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236511AbiIZKqZ (ORCPT ); Mon, 26 Sep 2022 06:46:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236497AbiIZKny (ORCPT ); Mon, 26 Sep 2022 06:43:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6EAD303DE; Mon, 26 Sep 2022 03:25: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 ams.source.kernel.org (Postfix) with ESMTPS id ED0DFB80682; Mon, 26 Sep 2022 10:25:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 450A7C433D6; Mon, 26 Sep 2022 10:25:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187903; bh=QGczFgAHvbSQI3rwphu6DQAbiEnCcEoB8hmQoCSCrjw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qdGWieqzRJ44Q35OXgZDDknfU2PiAsQCSVYg7sfaYNnKy92VUiI76lXvSXx3/Y3Lw GjwxwDKWtUVTFB1vlZ+eK3SgXtCL+Dlon7X4LGBVFyohETT/LvR1pML29HEM7s5mU1 ryy7CDDz+oqB7CV9soeWdetaqO6buvbQxYDOR5C4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Linus Walleij , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.4 097/120] gpio: ixp4xx: Make irqchip immutable Date: Mon, 26 Sep 2022 12:12:10 +0200 Message-Id: <20220926100754.551266309@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit 94e9bc73d85aa6ecfe249e985ff57abe0ab35f34 ] This turns the IXP4xx GPIO irqchip into an immutable irqchip, a bit different from the standard template due to being hierarchical. Tested on the IXP4xx which uses drivers/ata/pata_ixp4xx_cf.c for a rootfs on compact flash with IRQs from this GPIO block to the CF ATA controller. Cc: Marc Zyngier Signed-off-by: Linus Walleij Acked-by: Marc Zyngier Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpio/gpio-ixp4xx.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-ixp4xx.c b/drivers/gpio/gpio-ixp4xx.c index b3b050604e0b..6bd047e2ca46 100644 --- a/drivers/gpio/gpio-ixp4xx.c +++ b/drivers/gpio/gpio-ixp4xx.c @@ -67,6 +67,14 @@ static void ixp4xx_gpio_irq_ack(struct irq_data *d) __raw_writel(BIT(d->hwirq), g->base + IXP4XX_REG_GPIS); } =20 +static void ixp4xx_gpio_mask_irq(struct irq_data *d) +{ + struct gpio_chip *gc =3D irq_data_get_irq_chip_data(d); + + irq_chip_mask_parent(d); + gpiochip_disable_irq(gc, d->hwirq); +} + static void ixp4xx_gpio_irq_unmask(struct irq_data *d) { struct gpio_chip *gc =3D irq_data_get_irq_chip_data(d); @@ -76,6 +84,7 @@ static void ixp4xx_gpio_irq_unmask(struct irq_data *d) if (!(g->irq_edge & BIT(d->hwirq))) ixp4xx_gpio_irq_ack(d); =20 + gpiochip_enable_irq(gc, d->hwirq); irq_chip_unmask_parent(d); } =20 @@ -153,12 +162,14 @@ static int ixp4xx_gpio_irq_set_type(struct irq_data *= d, unsigned int type) return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH); } =20 -static struct irq_chip ixp4xx_gpio_irqchip =3D { +static const struct irq_chip ixp4xx_gpio_irqchip =3D { .name =3D "IXP4GPIO", .irq_ack =3D ixp4xx_gpio_irq_ack, - .irq_mask =3D irq_chip_mask_parent, + .irq_mask =3D ixp4xx_gpio_mask_irq, .irq_unmask =3D ixp4xx_gpio_irq_unmask, .irq_set_type =3D ixp4xx_gpio_irq_set_type, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; =20 static int ixp4xx_gpio_child_to_parent_hwirq(struct gpio_chip *gc, @@ -282,7 +293,7 @@ static int ixp4xx_gpio_probe(struct platform_device *pd= ev) g->gc.owner =3D THIS_MODULE; =20 girq =3D &g->gc.irq; - girq->chip =3D &ixp4xx_gpio_irqchip; + gpio_irq_chip_set_chip(girq, &ixp4xx_gpio_irqchip); girq->fwnode =3D g->fwnode; girq->parent_domain =3D parent; girq->child_to_parent_hwirq =3D ixp4xx_gpio_child_to_parent_hwirq; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8267BC32771 for ; Mon, 26 Sep 2022 10:46:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236517AbiIZKqa (ORCPT ); Mon, 26 Sep 2022 06:46:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236513AbiIZKn4 (ORCPT ); Mon, 26 Sep 2022 06:43:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABE6F3ECDB; Mon, 26 Sep 2022 03:25: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 0A1A5B80915; Mon, 26 Sep 2022 10:25:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DB0DC433D6; Mon, 26 Sep 2022 10:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187906; bh=v5EDMi5xv8Yp5djZlevGniTsGU8hyj95KCeXj7CWXZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O6Ke3Eu8BH2f523MjStvXBRsQxI+DFIJffvzpUUp62oa3BY+AlNFs/jXYrE+8xQie Y/lqLZ5FzJaimkuobA2dXgLcZ9yjVQKkkTax9NdlZP5cW85b5/shFbE21v/qyp+CYA 1y5wn0BqhaMVhoJ8GG7M3r8M0CEJHXRVGAEFzwQs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hamza Mahfooz , Alex Deucher , Sasha Levin Subject: [PATCH 5.4 098/120] drm/amdgpu: use dirty framebuffer helper Date: Mon, 26 Sep 2022 12:12:11 +0200 Message-Id: <20220926100754.597972273@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hamza Mahfooz [ Upstream commit 66f99628eb24409cb8feb5061f78283c8b65f820 ] Currently, we aren't handling DRM_IOCTL_MODE_DIRTYFB. So, use drm_atomic_helper_dirtyfb() as the dirty callback in the amdgpu_fb_funcs struct. Signed-off-by: Hamza Mahfooz Acked-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/= amd/amdgpu/amdgpu_display.c index b588e0e409e7..d8687868407d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -495,6 +496,7 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *= amdgpu_connector, static const struct drm_framebuffer_funcs amdgpu_fb_funcs =3D { .destroy =3D drm_gem_fb_destroy, .create_handle =3D drm_gem_fb_create_handle, + .dirty =3D drm_atomic_helper_dirtyfb, }; =20 uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B43BBC07E9D for ; Mon, 26 Sep 2022 10:46:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236536AbiIZKqi (ORCPT ); Mon, 26 Sep 2022 06:46:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236563AbiIZKoD (ORCPT ); Mon, 26 Sep 2022 06:44:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F83C4198F; Mon, 26 Sep 2022 03:25: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 517E8609D1; Mon, 26 Sep 2022 10:25:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4732AC433C1; Mon, 26 Sep 2022 10:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187912; bh=7QRXjBtBQvWq/NN8AqiQeXCPBs/BFJQC/y6ZQ+q0Yeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UElAPAt5iMKk+yuIMA03KVDmvYgvqmADpXyrSqxzRHS/MbREiXPe7bQ7Qor5I7C4H QNBozPFgUbtMc1H+cmyHVX9j+LZEFf3Q/uihM0zGwO8s86GnDViLOyBIcNaamf8mbf UeXyE5+yE5jfGpMVW0+vcQEL2z6Hl2UxFS4u0ACM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wheeler , Krunoslav Kovac , Aric Cyr , Pavle Kotarac , Yao Wang1 , Alex Deucher , Sasha Levin Subject: [PATCH 5.4 099/120] drm/amd/display: Limit user regamma to a valid value Date: Mon, 26 Sep 2022 12:12:12 +0200 Message-Id: <20220926100754.634104960@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yao Wang1 [ Upstream commit 3601d620f22e37740cf73f8278eabf9f2aa19eb7 ] [Why] For HDR mode, we get total 512 tf_point and after switching to SDR mode we actually get 400 tf_point and the rest of points(401~512) still use dirty value from HDR mode. We should limit the rest of the points to max value. [How] Limit the value when coordinates_x.x > 1, just like what we do in translate_from_linear_space for other re-gamma build paths. Tested-by: Daniel Wheeler Reviewed-by: Krunoslav Kovac Reviewed-by: Aric Cyr Acked-by: Pavle Kotarac Signed-off-by: Yao Wang1 Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/driv= ers/gpu/drm/amd/display/modules/color/color_gamma.c index e042d8ce05b4..22d105635e33 100644 --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c @@ -1486,6 +1486,7 @@ static void interpolate_user_regamma(uint32_t hw_poin= ts_num, struct fixed31_32 lut2; struct fixed31_32 delta_lut; struct fixed31_32 delta_index; + const struct fixed31_32 one =3D dc_fixpt_from_int(1); =20 i =3D 0; /* fixed_pt library has problems handling too small values */ @@ -1514,6 +1515,9 @@ static void interpolate_user_regamma(uint32_t hw_poin= ts_num, } else hw_x =3D coordinates_x[i].x; =20 + if (dc_fixpt_le(one, hw_x)) + hw_x =3D one; + norm_x =3D dc_fixpt_mul(norm_factor, hw_x); index =3D dc_fixpt_floor(norm_x); if (index < 0 || index > 255) --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6142AC6FA83 for ; Mon, 26 Sep 2022 10:46:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236556AbiIZKqm (ORCPT ); Mon, 26 Sep 2022 06:46:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236582AbiIZKoF (ORCPT ); Mon, 26 Sep 2022 06:44: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 55C5243301; Mon, 26 Sep 2022 03:25: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 dfw.source.kernel.org (Postfix) with ESMTPS id 3340260B5E; Mon, 26 Sep 2022 10:25:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41EB2C433C1; Mon, 26 Sep 2022 10:25:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187915; bh=EHC/n7xhzmgYc8Q35mSJNr/a7I3lBZt9N0cpfuYwGaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hhVAD+GHgmJW8wDH2o3nAcVgJKmm1+u7ydEgsxDrF/c/l7gMVIVfscpOZk6V8aRCA cGl7WAAWadfPkXdYmBXVxjOP4ZwEoimyE57JOivhxmf6pT/LYtYLaH1GsGUeWfBrYs JthWAsCaJUm6Ar3XpuDPrMsa10WSqChdvhJjQFtk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , llvm@lists.linux.dev, Nathan Huckleberry , Nathan Chancellor , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.4 100/120] drm/rockchip: Fix return type of cdn_dp_connector_mode_valid Date: Mon, 26 Sep 2022 12:12:13 +0200 Message-Id: <20220926100754.663664789@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nathan Huckleberry [ Upstream commit b0b9408f132623dc88e78adb5282f74e4b64bb57 ] The mode_valid field in drm_connector_helper_funcs is expected to be of type: enum drm_mode_status (* mode_valid) (struct drm_connector *connector, struct drm_display_mode *mode); The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition. The return type of cdn_dp_connector_mode_valid should be changed from int to enum drm_mode_status. Reported-by: Dan Carpenter Link: https://github.com/ClangBuiltLinux/linux/issues/1703 Cc: llvm@lists.linux.dev Signed-off-by: Nathan Huckleberry Reviewed-by: Nathan Chancellor Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20220913205555.155149-1= -nhuck@google.com Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/rockchip/cdn-dp-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockc= hip/cdn-dp-core.c index 8f299d76b69b..67dae1354aa6 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -275,8 +275,9 @@ static int cdn_dp_connector_get_modes(struct drm_connec= tor *connector) return ret; } =20 -static int cdn_dp_connector_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) +static enum drm_mode_status +cdn_dp_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) { struct cdn_dp_device *dp =3D connector_to_dp(connector); struct drm_display_info *display_info =3D &dp->connector.display_info; --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA801C32771 for ; Mon, 26 Sep 2022 10:46:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236561AbiIZKqt (ORCPT ); Mon, 26 Sep 2022 06:46:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236643AbiIZKoP (ORCPT ); Mon, 26 Sep 2022 06:44:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD8BF4D4EC; Mon, 26 Sep 2022 03:25: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 015BCB8091F; Mon, 26 Sep 2022 10:25:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38501C433D6; Mon, 26 Sep 2022 10:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187918; bh=wz9FGAFTMsjW7TZL1vBSY65m+pX1Yx7gQHp9WzMqvlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=irsvDzxsNYlo2nAP7jnDWBREszSzccDFOUOAq1BTI+KsLgAsZAb+nSgJJX4/Wm+xD V8Fo2iDyoi8VBFn1sczwGkhd1HnbuJZziGRhfKMupGL1vQ95vEI0THeB+xgJTicJNf fJyu0+wIqVsVUTIjnEm8JVZjwJDEyBwtFowwy9VA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hillf Danton , Lai Jiangshan , Johannes Berg , Tetsuo Handa , Tejun Heo , Sasha Levin Subject: [PATCH 5.4 101/120] workqueue: dont skip lockdep work dependency in cancel_work_sync() Date: Mon, 26 Sep 2022 12:12:14 +0200 Message-Id: <20220926100754.692014905@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tetsuo Handa [ Upstream commit c0feea594e058223973db94c1c32a830c9807c86 ] Like Hillf Danton mentioned syzbot should have been able to catch cancel_work_sync() in work context by checking lockdep_map in __flush_work() for both flush and cancel. in [1], being unable to report an obvious deadlock scenario shown below is broken. From locking dependency perspective, sync version of cancel request should behave as if flush request, for it waits for completion of work if that work has already started execution. ---------- #include #include static DEFINE_MUTEX(mutex); static void work_fn(struct work_struct *work) { schedule_timeout_uninterruptible(HZ / 5); mutex_lock(&mutex); mutex_unlock(&mutex); } static DECLARE_WORK(work, work_fn); static int __init test_init(void) { schedule_work(&work); schedule_timeout_uninterruptible(HZ / 10); mutex_lock(&mutex); cancel_work_sync(&work); mutex_unlock(&mutex); return -EINVAL; } module_init(test_init); MODULE_LICENSE("GPL"); ---------- The check this patch restores was added by commit 0976dfc1d0cd80a4 ("workqueue: Catch more locking problems with flush_work()"). Then, lockdep's crossrelease feature was added by commit b09be676e0ff25bd ("locking/lockdep: Implement the 'crossrelease' feature"). As a result, this check was once removed by commit fd1a5b04dfb899f8 ("workqueue: Remove now redundant lock acquisitions wrt. workqueue flushes"). But lockdep's crossrelease feature was removed by commit e966eaeeb623f099 ("locking/lockdep: Remove the cross-release locking checks"). At this point, this check should have been restored. Then, commit d6e89786bed977f3 ("workqueue: skip lockdep wq dependency in cancel_work_sync()") introduced a boolean flag in order to distinguish flush_work() and cancel_work_sync(), for checking "struct workqueue_struct" dependency when called from cancel_work_sync() was causing false positives. Then, commit 87915adc3f0acdf0 ("workqueue: re-add lockdep dependencies for flushing") tried to restore "struct work_struct" dependency check, but by error checked this boolean flag. Like an example shown above indicates, "struct work_struct" dependency needs to be checked for both flush_work() and cancel_work_sync(). Link: https://lkml.kernel.org/r/20220504044800.4966-1-hdanton@sina.com [1] Reported-by: Hillf Danton Suggested-by: Lai Jiangshan Fixes: 87915adc3f0acdf0 ("workqueue: re-add lockdep dependencies for flushi= ng") Cc: Johannes Berg Signed-off-by: Tetsuo Handa Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/workqueue.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index e90f37e22202..dd96391b44de 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -3049,10 +3049,8 @@ static bool __flush_work(struct work_struct *work, b= ool from_cancel) if (WARN_ON(!work->func)) return false; =20 - if (!from_cancel) { - lock_map_acquire(&work->lockdep_map); - lock_map_release(&work->lockdep_map); - } + lock_map_acquire(&work->lockdep_map); + lock_map_release(&work->lockdep_map); =20 if (start_flush_work(work, &barr, from_cancel)) { wait_for_completion(&barr.done); --=20 2.35.1 From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 328AEC6FA86 for ; Mon, 26 Sep 2022 10:46:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236577AbiIZKqy (ORCPT ); Mon, 26 Sep 2022 06:46:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236666AbiIZKoV (ORCPT ); Mon, 26 Sep 2022 06:44: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 863684D80A; Mon, 26 Sep 2022 03:25: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 2F04FB80915; Mon, 26 Sep 2022 10:25:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6336FC433C1; Mon, 26 Sep 2022 10:25:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187921; bh=O9sB5tz9UT6qWzcTVpnyeL3ASp4RGWCnaJKLnO0qlpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MB+qA6T/Sk6nfk9kl1qMG1RPE/vYUMvtVWCYoq38o41sGi+BIXbjwJDEow0Tx+ycj TmzQ4Vv+Q4HgzFja6BtScbbF2UhxmEkfP9an5Kf9tshZ3GTs++ob7uUS/6TYHHEdlf eWknGBuZsmKA3QKh2nAasC2hbpNkw3+LqMFGtOys= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baokun Li , stable@kernel.org, =?UTF-8?q?Lu=C3=ADs=20Henriques?= , Jan Kara , Theodore Tso Subject: [PATCH 5.4 102/120] ext4: fix bug in extents parsing when eh_entries == 0 and eh_depth > 0 Date: Mon, 26 Sep 2022 12:12:15 +0200 Message-Id: <20220926100754.724346376@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lu=C3=ADs Henriques commit 29a5b8a137ac8eb410cc823653a29ac0e7b7e1b0 upstream. When walking through an inode extents, the ext4_ext_binsearch_idx() function assumes that the extent header has been previously validated. However, the= re are no checks that verify that the number of entries (eh->eh_entries) is non-zero when depth is > 0. And this will lead to problems because the EXT_FIRST_INDEX() and EXT_LAST_INDEX() will return garbage and result in th= is: [ 135.245946] ------------[ cut here ]------------ [ 135.247579] kernel BUG at fs/ext4/extents.c:2258! [ 135.249045] invalid opcode: 0000 [#1] PREEMPT SMP [ 135.250320] CPU: 2 PID: 238 Comm: tmp118 Not tainted 5.19.0-rc8+ #4 [ 135.252067] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS = rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014 [ 135.255065] RIP: 0010:ext4_ext_map_blocks+0xc20/0xcb0 [ 135.256475] Code: [ 135.261433] RSP: 0018:ffffc900005939f8 EFLAGS: 00010246 [ 135.262847] RAX: 0000000000000024 RBX: ffffc90000593b70 RCX: 00000000000= 00023 [ 135.264765] RDX: ffff8880038e5f10 RSI: 0000000000000003 RDI: ffff8880046= e922c [ 135.266670] RBP: ffff8880046e9348 R08: 0000000000000001 R09: ffff888002c= a580c [ 135.268576] R10: 0000000000002602 R11: 0000000000000000 R12: 00000000000= 00024 [ 135.270477] R13: 0000000000000000 R14: 0000000000000024 R15: 00000000000= 00000 [ 135.272394] FS: 00007fdabdc56740(0000) GS:ffff88807dd00000(0000) knlGS:= 0000000000000000 [ 135.274510] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 135.276075] CR2: 00007ffc26bd4f00 CR3: 0000000006261004 CR4: 00000000001= 70ea0 [ 135.277952] Call Trace: [ 135.278635] [ 135.279247] ? preempt_count_add+0x6d/0xa0 [ 135.280358] ? percpu_counter_add_batch+0x55/0xb0 [ 135.281612] ? _raw_read_unlock+0x18/0x30 [ 135.282704] ext4_map_blocks+0x294/0x5a0 [ 135.283745] ? xa_load+0x6f/0xa0 [ 135.284562] ext4_mpage_readpages+0x3d6/0x770 [ 135.285646] read_pages+0x67/0x1d0 [ 135.286492] ? folio_add_lru+0x51/0x80 [ 135.287441] page_cache_ra_unbounded+0x124/0x170 [ 135.288510] filemap_get_pages+0x23d/0x5a0 [ 135.289457] ? path_openat+0xa72/0xdd0 [ 135.290332] filemap_read+0xbf/0x300 [ 135.291158] ? _raw_spin_lock_irqsave+0x17/0x40 [ 135.292192] new_sync_read+0x103/0x170 [ 135.293014] vfs_read+0x15d/0x180 [ 135.293745] ksys_read+0xa1/0xe0 [ 135.294461] do_syscall_64+0x3c/0x80 [ 135.295284] entry_SYSCALL_64_after_hwframe+0x46/0xb0 This patch simply adds an extra check in __ext4_ext_check(), verifying that eh_entries is not 0 when eh_depth is > 0. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D215941 Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216283 Cc: Baokun Li Cc: stable@kernel.org Signed-off-by: Lu=C3=ADs Henriques Reviewed-by: Jan Kara Reviewed-by: Baokun Li Link: https://lore.kernel.org/r/20220822094235.2690-1-lhenriques@suse.de Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext4/extents.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -500,6 +500,10 @@ static int __ext4_ext_check(const char * error_msg =3D "invalid eh_entries"; goto corrupted; } + if (unlikely((eh->eh_entries =3D=3D 0) && (depth > 0))) { + error_msg =3D "eh_entries is 0 but eh_depth is > 0"; + goto corrupted; + } if (!ext4_valid_extent_entries(inode, eh, lblk, &pblk, depth)) { error_msg =3D "invalid extent entries"; goto corrupted; From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EE2AC07E9D for ; Mon, 26 Sep 2022 10:51:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236657AbiIZKvt (ORCPT ); Mon, 26 Sep 2022 06:51:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236774AbiIZKtU (ORCPT ); Mon, 26 Sep 2022 06:49:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A98FC57E2B; Mon, 26 Sep 2022 03:26: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 4A40DB8055F; Mon, 26 Sep 2022 10:26:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA3E5C433C1; Mon, 26 Sep 2022 10:26:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187998; bh=PO5Rmq/GPp6MyTXqGurVuNZqX+1cSG0VYjpuri+lVPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qLoNKR9tRt02gb2rsu7FWOUQoNS3bElpWP35c6NTIbRV8AM7yF+FlEaDOvKpgyWIm DvrQZsOqkc/S8eqFq1YLl94r/oj0nB22Fu+5HTNxa7KkR/3cxjWA/I77Xd8d6dA6Hp whAG6Kv0VHAaUXMktsKPEbn3O0La8hmvkUKjTgCw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Wahren , Ojaswin Mujoo , stable@kernel.org, Jan Kara , Theodore Tso Subject: [PATCH 5.4 103/120] ext4: make directory inode spreading reflect flexbg size Date: Mon, 26 Sep 2022 12:12:16 +0200 Message-Id: <20220926100754.757833170@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara commit 613c5a85898d1cd44e68f28d65eccf64a8ace9cf upstream. Currently the Orlov inode allocator searches for free inodes for a directory only in flex block groups with at most inodes_per_group/16 more directory inodes than average per flex block group. However with growing size of flex block group this becomes unnecessarily strict. Scale allowed difference from average directory count per flex block group with flex block group size as we do with other metrics. Tested-by: Stefan Wahren Tested-by: Ojaswin Mujoo Cc: stable@kernel.org Link: https://lore.kernel.org/all/0d81a7c2-46b7-6010-62a4-3e6cfc1628d6@i2se= .com/ Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220908092136.11770-3-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext4/ialloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c @@ -500,7 +500,7 @@ static int find_group_orlov(struct super goto fallback; } =20 - max_dirs =3D ndirs / ngroups + inodes_per_group / 16; + max_dirs =3D ndirs / ngroups + inodes_per_group*flex_size / 16; min_inodes =3D avefreei - inodes_per_group*flex_size / 4; if (min_inodes < 1) min_inodes =3D 1; From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A070DC07E9D for ; Mon, 26 Sep 2022 10:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234402AbiIZKrd (ORCPT ); Mon, 26 Sep 2022 06:47:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236838AbiIZKos (ORCPT ); Mon, 26 Sep 2022 06:44: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 EECC1564ED; Mon, 26 Sep 2022 03:25: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 E13D160AD6; Mon, 26 Sep 2022 10:25:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7A14C433D6; Mon, 26 Sep 2022 10:25:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187946; bh=Yx5KjNu28FOaAb4M8e0v2V3JY3kgb65cFo5nXDHD86E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bTNOENAUse78j9B6zgiGGtyaY1A4Z/fQQSdouLwAHvw144HUy8TB0+KrzjlRApfDE GSNPQYIDpqYlJE0Ib4V7vUestmD1qfc7AUDYDRmmuoj2nmxzAECcsRiMSmvgIF0zQP E70iaaoV2YgdZzsjjQKvLIgvsFGrg6JkNEmNCanE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Christoph Hellwig , Brian Foster , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 104/120] xfs: replace -EIO with -EFSCORRUPTED for corrupt metadata Date: Mon, 26 Sep 2022 12:12:17 +0200 Message-Id: <20220926100754.785888139@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" commit c2414ad6e66ab96b867309454498f7fb29b7e855 upstream. There are a few places where we return -EIO instead of -EFSCORRUPTED when we find corrupt metadata. Fix those places. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Brian Foster Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/libxfs/xfs_bmap.c | 6 +++--- fs/xfs/xfs_attr_inactive.c | 6 +++--- fs/xfs/xfs_dquot.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -1374,7 +1374,7 @@ xfs_bmap_last_before( case XFS_DINODE_FMT_EXTENTS: break; default: - return -EIO; + return -EFSCORRUPTED; } =20 if (!(ifp->if_flags & XFS_IFEXTENTS)) { @@ -1475,7 +1475,7 @@ xfs_bmap_last_offset( =20 if (XFS_IFORK_FORMAT(ip, whichfork) !=3D XFS_DINODE_FMT_BTREE && XFS_IFORK_FORMAT(ip, whichfork) !=3D XFS_DINODE_FMT_EXTENTS) - return -EIO; + return -EFSCORRUPTED; =20 error =3D xfs_bmap_last_extent(NULL, ip, whichfork, &rec, &is_empty); if (error || is_empty) @@ -5872,7 +5872,7 @@ xfs_bmap_insert_extents( del_cursor); =20 if (stop_fsb >=3D got.br_startoff + got.br_blockcount) { - error =3D -EIO; + error =3D -EFSCORRUPTED; goto del_cursor; } =20 --- a/fs/xfs/xfs_attr_inactive.c +++ b/fs/xfs/xfs_attr_inactive.c @@ -209,7 +209,7 @@ xfs_attr3_node_inactive( */ if (level > XFS_DA_NODE_MAXDEPTH) { xfs_trans_brelse(*trans, bp); /* no locks for later trans */ - return -EIO; + return -EFSCORRUPTED; } =20 node =3D bp->b_addr; @@ -258,7 +258,7 @@ xfs_attr3_node_inactive( error =3D xfs_attr3_leaf_inactive(trans, dp, child_bp); break; default: - error =3D -EIO; + error =3D -EFSCORRUPTED; xfs_trans_brelse(*trans, child_bp); break; } @@ -341,7 +341,7 @@ xfs_attr3_root_inactive( error =3D xfs_attr3_leaf_inactive(trans, dp, bp); break; default: - error =3D -EIO; + error =3D -EFSCORRUPTED; xfs_trans_brelse(*trans, bp); break; } --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c @@ -1125,7 +1125,7 @@ xfs_qm_dqflush( xfs_buf_relse(bp); xfs_dqfunlock(dqp); xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); - return -EIO; + return -EFSCORRUPTED; } =20 /* This is the only portion of data that needs to persist */ From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 685F2C32771 for ; Mon, 26 Sep 2022 10:51:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233997AbiIZKv1 (ORCPT ); Mon, 26 Sep 2022 06:51:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236662AbiIZKs4 (ORCPT ); Mon, 26 Sep 2022 06:48:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E64D357567; Mon, 26 Sep 2022 03:26: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 29A6D60B2F; Mon, 26 Sep 2022 10:26:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3645FC433C1; Mon, 26 Sep 2022 10:26:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187973; bh=zwI7lY0f1SukIEKLWB1CYEkkrvnwk5+B3cYkOhMIKvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vmTzlGAoWUjaQeqBS5LrrjpDtaR++MskhTLwl7hks0KTVEmKZwhOCIjZMTF7qumGC S9a4+z9nPsrfic3TthDi3/BMwX9ON12qisvKie2yq7gdrshzxilbF9UqnQBY0TFfyF XbkiPTn6gOC6B8hk0xURA8n0YYzdh/uO31vnuONQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , "Darrick J. Wong" , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 105/120] xfs: slightly tweak an assert in xfs_fs_map_blocks Date: Mon, 26 Sep 2022 12:12:18 +0200 Message-Id: <20220926100754.814350434@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig commit 88cdb7147b21b2d8b4bd3f3d95ce0bffd73e1ac3 upstream. We should never see delalloc blocks for a pNFS layout, write or not. Adjust the assert to check for that. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/xfs_pnfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/xfs/xfs_pnfs.c +++ b/fs/xfs/xfs_pnfs.c @@ -147,11 +147,11 @@ xfs_fs_map_blocks( if (error) goto out_unlock; =20 + ASSERT(!nimaps || imap.br_startblock !=3D DELAYSTARTBLOCK); + if (write) { enum xfs_prealloc_flags flags =3D 0; =20 - ASSERT(imap.br_startblock !=3D DELAYSTARTBLOCK); - if (!nimaps || imap.br_startblock =3D=3D HOLESTARTBLOCK) { /* * xfs_iomap_write_direct() expects to take ownership of From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51CB1C32771 for ; Mon, 26 Sep 2022 10:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236670AbiIZKvR (ORCPT ); Mon, 26 Sep 2022 06:51:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236624AbiIZKss (ORCPT ); Mon, 26 Sep 2022 06:48:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99D8E57278; Mon, 26 Sep 2022 03:26:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B847FB80915; Mon, 26 Sep 2022 10:26:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BA1AC433D6; Mon, 26 Sep 2022 10:26:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187976; bh=/TEysB9aXAw6YnUMtjKbjnb69VGEdNqHrGLDObPJF5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hS3e95NbOTHLUINvhaeGilYA9V6u+3Ng3xqdrx21+Ei8lqCtpvT0ZuvTmfPLL/TDi /2ZvLAaFTkr/cM7jJg82JjWC67lklXIgfvsdybHlPgh95/1afz/fYLfx88ioYeH6yS AhjD4A1BSZ56zbdtEtGFdNohyVZ5eoiOmUqGXmSI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Christoph Hellwig , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 106/120] xfs: add missing assert in xfs_fsmap_owner_from_rmap Date: Mon, 26 Sep 2022 12:12:19 +0200 Message-Id: <20220926100754.842710680@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" commit 110f09cb705af8c53f2a457baf771d2935ed62d4 upstream. The fsmap handler shouldn't fail silently if the rmap code ever feeds it a special owner number that isn't known to the fsmap handler. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/xfs_fsmap.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/xfs/xfs_fsmap.c +++ b/fs/xfs/xfs_fsmap.c @@ -146,6 +146,7 @@ xfs_fsmap_owner_from_rmap( dest->fmr_owner =3D XFS_FMR_OWN_FREE; break; default: + ASSERT(0); return -EFSCORRUPTED; } return 0; From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DCF7C07E9D for ; Mon, 26 Sep 2022 10:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236681AbiIZKvV (ORCPT ); Mon, 26 Sep 2022 06:51:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236643AbiIZKsx (ORCPT ); Mon, 26 Sep 2022 06:48:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE4925789E; Mon, 26 Sep 2022 03:26: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 050EB60C13; Mon, 26 Sep 2022 10:26:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05A41C433D6; Mon, 26 Sep 2022 10:26:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187979; bh=N3TddU4kN2v+JH26p5k5E5UOFYOaUiaRmR6KBiOEDBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sltEAyPcIUr1a+dNt7GmT/8Y8KrZVFb87Oudcs9M7cdwxa16eokSFvz2ktfPNRz1s dAJZgifqKfomoguurUihrOfkCcuSW4ctZ9M/57nJTM3hz2aTE/VZR0xHNBEWM/V/3F ygHt7EQuWUvdMOGtBXbiD1NJ+iBuxQ0aMIsZ9MdA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Christoph Hellwig , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 107/120] xfs: range check ri_cnt when recovering log items Date: Mon, 26 Sep 2022 12:12:20 +0200 Message-Id: <20220926100754.871725781@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" commit d6abecb82573fed5f7e4b595b5c0bd37707d2848 upstream. Range check the region counter when we're reassembling regions from log items during log recovery. In the old days ASSERT would halt the kernel, but this isn't true any more so we have to make an explicit error return. Coverity-id: 1132508 Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/xfs_log_recover.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -4293,7 +4293,16 @@ xlog_recover_add_to_trans( kmem_zalloc(item->ri_total * sizeof(xfs_log_iovec_t), 0); } - ASSERT(item->ri_total > item->ri_cnt); + + if (item->ri_total <=3D item->ri_cnt) { + xfs_warn(log->l_mp, + "log item region count (%d) overflowed size (%d)", + item->ri_cnt, item->ri_total); + ASSERT(0); + kmem_free(ptr); + return -EFSCORRUPTED; + } + /* Description region is ri_buf[0] */ item->ri_buf[item->ri_cnt].i_addr =3D ptr; item->ri_buf[item->ri_cnt].i_len =3D len; From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B54DAC07E9D for ; Mon, 26 Sep 2022 10:51:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236693AbiIZKva (ORCPT ); Mon, 26 Sep 2022 06:51:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236680AbiIZKtA (ORCPT ); Mon, 26 Sep 2022 06:49:00 -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 6B0084DB73; Mon, 26 Sep 2022 03:26:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B27EAB8055F; Mon, 26 Sep 2022 10:26:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1CA9C433D6; Mon, 26 Sep 2022 10:26:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187982; bh=psv3uKrLsqAIWdTo1TVmFaLRqzOckcFVq3aCsW3RV7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NyctNZsR8OL0/0xwAwdEutzxnvJkJu+n8HHkjQAo/JNVTRGI85oGNf6Zde7kTW+5T 3niggA3dJQhDqRR9AMbTzyOHucyxCqSw4razLQizpZNiHQ7cXXNlFs8NdPiHy0sabH Lf6Umvaf/Gd6Auoj3GRqVkN3xVEufSxlhw+AqIKI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Christoph Hellwig , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 108/120] xfs: attach dquots and reserve quota blocks during unwritten conversion Date: Mon, 26 Sep 2022 12:12:21 +0200 Message-Id: <20220926100754.905815982@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" commit 2815a16d7ff6230a8e37928829d221bb075aa160 upstream. In xfs_iomap_write_unwritten, we need to ensure that dquots are attached to the inode and quota blocks reserved so that we capture in the quota counters any blocks allocated to handle a bmbt split. This can happen on the first unwritten extent conversion to a preallocated sparse file on a fresh mount. This was found by running generic/311 with quotas enabled. The bug seems to have been introduced in "[XFS] rework iocore infrastructure, remove some code and make it more" from ~2002? Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/xfs_iomap.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -765,6 +765,11 @@ xfs_iomap_write_unwritten( */ resblks =3D XFS_DIOSTRAT_SPACE_RES(mp, 0) << 1; =20 + /* Attach dquots so that bmbt splits are accounted correctly. */ + error =3D xfs_qm_dqattach(ip); + if (error) + return error; + do { /* * Set up a transaction to convert the range of extents @@ -783,6 +788,11 @@ xfs_iomap_write_unwritten( xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, 0); =20 + error =3D xfs_trans_reserve_quota_nblks(tp, ip, resblks, 0, + XFS_QMOPT_RES_REGBLKS); + if (error) + goto error_on_bmapi_transaction; + /* * Modify the unwritten extent state of the buffer. */ From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C63AC07E9D for ; Mon, 26 Sep 2022 10:51:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236626AbiIZKvf (ORCPT ); Mon, 26 Sep 2022 06:51:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236718AbiIZKtH (ORCPT ); Mon, 26 Sep 2022 06:49:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB78B578A6; Mon, 26 Sep 2022 03:26: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 dfw.source.kernel.org (Postfix) with ESMTPS id E7F7E60BB7; Mon, 26 Sep 2022 10:26:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF265C433C1; Mon, 26 Sep 2022 10:26:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187985; bh=H0SdEeYLyQXDWiSwzuzXc82ditkqGWMKaJHVWZn2SwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EJOT3COHQ7HuSCq3NdVc90ad8mYaNlD+ouBhDXKmnSSoKXphU57DKbwaxMcDEFJl1 zI4JRh5zZY6OfIWNfRTLz+K8dputdVog2Wp16VrHVxQcPEreHEGX0U2zEVO/p08UbB 4TxVwk9vk6MLJBM/GtjXkmP+I6lQgqhHvrEt4G8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kaixuxia , "Darrick J. Wong" , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 109/120] xfs: Fix deadlock between AGI and AGF when target_ip exists in xfs_rename() Date: Mon, 26 Sep 2022 12:12:22 +0200 Message-Id: <20220926100754.935141422@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: kaixuxia commit 93597ae8dac0149b5c00b787cba6bf7ba213e666 upstream. When target_ip exists in xfs_rename(), the xfs_dir_replace() call may need to hold the AGF lock to allocate more blocks, and then invoking the xfs_droplink() call to hold AGI lock to drop target_ip onto the unlinked list, so we get the lock order AGF->AGI. This would break the ordering constraint on AGI and AGF locking - inode allocation locks the AGI, then can allocate a new extent for new inodes, locking the AGF after the AGI. In this patch we check whether the replace operation need more blocks firstly. If so, acquire the agi lock firstly to preserve locking order(AGI/AGF). Actually, the locking order problem only occurs when we are locking the AGI/AGF of the same AG. For multiple AGs the AGI lock will be released after the transaction committed. Signed-off-by: kaixuxia Reviewed-by: Darrick J. Wong [darrick: reword the comment] Signed-off-by: Darrick J. Wong Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/libxfs/xfs_dir2.h | 2 ++ fs/xfs/libxfs/xfs_dir2_sf.c | 28 +++++++++++++++++++++++----- fs/xfs/xfs_inode.c | 17 +++++++++++++++++ 3 files changed, 42 insertions(+), 5 deletions(-) --- a/fs/xfs/libxfs/xfs_dir2.h +++ b/fs/xfs/libxfs/xfs_dir2.h @@ -124,6 +124,8 @@ extern int xfs_dir_lookup(struct xfs_tra extern int xfs_dir_removename(struct xfs_trans *tp, struct xfs_inode *dp, struct xfs_name *name, xfs_ino_t ino, xfs_extlen_t tot); +extern bool xfs_dir2_sf_replace_needblock(struct xfs_inode *dp, + xfs_ino_t inum); extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp, struct xfs_name *name, xfs_ino_t inum, xfs_extlen_t tot); --- a/fs/xfs/libxfs/xfs_dir2_sf.c +++ b/fs/xfs/libxfs/xfs_dir2_sf.c @@ -945,6 +945,27 @@ xfs_dir2_sf_removename( } =20 /* + * Check whether the sf dir replace operation need more blocks. + */ +bool +xfs_dir2_sf_replace_needblock( + struct xfs_inode *dp, + xfs_ino_t inum) +{ + int newsize; + struct xfs_dir2_sf_hdr *sfp; + + if (dp->i_d.di_format !=3D XFS_DINODE_FMT_LOCAL) + return false; + + sfp =3D (struct xfs_dir2_sf_hdr *)dp->i_df.if_u1.if_data; + newsize =3D dp->i_df.if_bytes + (sfp->count + 1) * XFS_INO64_DIFF; + + return inum > XFS_DIR2_MAX_SHORT_INUM && + sfp->i8count =3D=3D 0 && newsize > XFS_IFORK_DSIZE(dp); +} + +/* * Replace the inode number of an entry in a shortform directory. */ int /* error */ @@ -980,17 +1001,14 @@ xfs_dir2_sf_replace( */ if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && sfp->i8count =3D=3D 0) { int error; /* error return value */ - int newsize; /* new inode size */ =20 - newsize =3D dp->i_df.if_bytes + (sfp->count + 1) * XFS_INO64_DIFF; /* * Won't fit as shortform, convert to block then do replace. */ - if (newsize > XFS_IFORK_DSIZE(dp)) { + if (xfs_dir2_sf_replace_needblock(dp, args->inumber)) { error =3D xfs_dir2_sf_to_block(args); - if (error) { + if (error) return error; - } return xfs_dir2_block_replace(args); } /* --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -3215,6 +3215,7 @@ xfs_rename( struct xfs_trans *tp; struct xfs_inode *wip =3D NULL; /* whiteout inode */ struct xfs_inode *inodes[__XFS_SORT_INODES]; + struct xfs_buf *agibp; int num_inodes =3D __XFS_SORT_INODES; bool new_parent =3D (src_dp !=3D target_dp); bool src_is_directory =3D S_ISDIR(VFS_I(src_ip)->i_mode); @@ -3379,6 +3380,22 @@ xfs_rename( * In case there is already an entry with the same * name at the destination directory, remove it first. */ + + /* + * Check whether the replace operation will need to allocate + * blocks. This happens when the shortform directory lacks + * space and we have to convert it to a block format directory. + * When more blocks are necessary, we must lock the AGI first + * to preserve locking order (AGI -> AGF). + */ + if (xfs_dir2_sf_replace_needblock(target_dp, src_ip->i_ino)) { + error =3D xfs_read_agi(mp, tp, + XFS_INO_TO_AGNO(mp, target_ip->i_ino), + &agibp); + if (error) + goto out_trans_cancel; + } + error =3D xfs_dir_replace(tp, target_dp, target_name, src_ip->i_ino, spaceres); if (error) From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A6DCC32771 for ; Mon, 26 Sep 2022 10:51:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236710AbiIZKvk (ORCPT ); Mon, 26 Sep 2022 06:51:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236728AbiIZKtJ (ORCPT ); Mon, 26 Sep 2022 06:49: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 5FD7C5788F; Mon, 26 Sep 2022 03:26: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 3E48C60C05; Mon, 26 Sep 2022 10:26:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 291C1C433C1; Mon, 26 Sep 2022 10:26:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187988; bh=TYkAw3ddzhpkb5703Ow+vuHz71S7/pXKULuF/8cdCsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oh+0a8kZReiv28ijsHSiPUtADvVBad8JFb5QARVfZqHCYYAXcpETW102607BuXmgh O0z+D6mY7q2NpHVEbHQdDdfgogjnmviiitlWSgKNrOQTGhBXcTf2PdSX4iQmsFnBeP Ikq4d+r74/QI9iqS71DNBtskv5RR0Il3dmCb15/I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Christoph Hellwig , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 110/120] xfs: convert EIO to EFSCORRUPTED when log contents are invalid Date: Mon, 26 Sep 2022 12:12:23 +0200 Message-Id: <20220926100754.964029305@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" commit 895e196fb6f84402dcd0c1d3c3feb8a58049564e upstream. Convert EIO to EFSCORRUPTED in the logging code when we can determine that the log contents are invalid. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/xfs_bmap_item.c | 4 ++-- fs/xfs/xfs_extfree_item.c | 2 +- fs/xfs/xfs_log_recover.c | 32 ++++++++++++++++---------------- fs/xfs/xfs_refcount_item.c | 2 +- fs/xfs/xfs_rmap_item.c | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) --- a/fs/xfs/xfs_bmap_item.c +++ b/fs/xfs/xfs_bmap_item.c @@ -456,7 +456,7 @@ xfs_bui_recover( if (buip->bui_format.bui_nextents !=3D XFS_BUI_MAX_FAST_EXTENTS) { set_bit(XFS_BUI_RECOVERED, &buip->bui_flags); xfs_bui_release(buip); - return -EIO; + return -EFSCORRUPTED; } =20 /* @@ -490,7 +490,7 @@ xfs_bui_recover( */ set_bit(XFS_BUI_RECOVERED, &buip->bui_flags); xfs_bui_release(buip); - return -EIO; + return -EFSCORRUPTED; } =20 error =3D xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, --- a/fs/xfs/xfs_extfree_item.c +++ b/fs/xfs/xfs_extfree_item.c @@ -624,7 +624,7 @@ xfs_efi_recover( */ set_bit(XFS_EFI_RECOVERED, &efip->efi_flags); xfs_efi_release(efip); - return -EIO; + return -EFSCORRUPTED; } } =20 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -471,7 +471,7 @@ xlog_find_verify_log_record( xfs_warn(log->l_mp, "Log inconsistent (didn't find previous header)"); ASSERT(0); - error =3D -EIO; + error =3D -EFSCORRUPTED; goto out; } =20 @@ -1350,7 +1350,7 @@ xlog_find_tail( return error; if (!error) { xfs_warn(log->l_mp, "%s: couldn't find sync record", __func__); - return -EIO; + return -EFSCORRUPTED; } *tail_blk =3D BLOCK_LSN(be64_to_cpu(rhead->h_tail_lsn)); =20 @@ -3166,7 +3166,7 @@ xlog_recover_inode_pass2( default: xfs_warn(log->l_mp, "%s: Invalid flag", __func__); ASSERT(0); - error =3D -EIO; + error =3D -EFSCORRUPTED; goto out_release; } } @@ -3247,12 +3247,12 @@ xlog_recover_dquot_pass2( recddq =3D item->ri_buf[1].i_addr; if (recddq =3D=3D NULL) { xfs_alert(log->l_mp, "NULL dquot in %s.", __func__); - return -EIO; + return -EFSCORRUPTED; } if (item->ri_buf[1].i_len < sizeof(xfs_disk_dquot_t)) { xfs_alert(log->l_mp, "dquot too small (%d) in %s.", item->ri_buf[1].i_len, __func__); - return -EIO; + return -EFSCORRUPTED; } =20 /* @@ -3279,7 +3279,7 @@ xlog_recover_dquot_pass2( if (fa) { xfs_alert(mp, "corrupt dquot ID 0x%x in log at %pS", dq_f->qlf_id, fa); - return -EIO; + return -EFSCORRUPTED; } ASSERT(dq_f->qlf_len =3D=3D 1); =20 @@ -4018,7 +4018,7 @@ xlog_recover_commit_pass1( xfs_warn(log->l_mp, "%s: invalid item type (%d)", __func__, ITEM_TYPE(item)); ASSERT(0); - return -EIO; + return -EFSCORRUPTED; } } =20 @@ -4066,7 +4066,7 @@ xlog_recover_commit_pass2( xfs_warn(log->l_mp, "%s: invalid item type (%d)", __func__, ITEM_TYPE(item)); ASSERT(0); - return -EIO; + return -EFSCORRUPTED; } } =20 @@ -4187,7 +4187,7 @@ xlog_recover_add_to_cont_trans( ASSERT(len <=3D sizeof(struct xfs_trans_header)); if (len > sizeof(struct xfs_trans_header)) { xfs_warn(log->l_mp, "%s: bad header length", __func__); - return -EIO; + return -EFSCORRUPTED; } =20 xlog_recover_add_item(&trans->r_itemq); @@ -4243,13 +4243,13 @@ xlog_recover_add_to_trans( xfs_warn(log->l_mp, "%s: bad header magic number", __func__); ASSERT(0); - return -EIO; + return -EFSCORRUPTED; } =20 if (len > sizeof(struct xfs_trans_header)) { xfs_warn(log->l_mp, "%s: bad header length", __func__); ASSERT(0); - return -EIO; + return -EFSCORRUPTED; } =20 /* @@ -4285,7 +4285,7 @@ xlog_recover_add_to_trans( in_f->ilf_size); ASSERT(0); kmem_free(ptr); - return -EIO; + return -EFSCORRUPTED; } =20 item->ri_total =3D in_f->ilf_size; @@ -4389,7 +4389,7 @@ xlog_recovery_process_trans( default: xfs_warn(log->l_mp, "%s: bad flag 0x%x", __func__, flags); ASSERT(0); - error =3D -EIO; + error =3D -EFSCORRUPTED; break; } if (error || freeit) @@ -4469,7 +4469,7 @@ xlog_recover_process_ophdr( xfs_warn(log->l_mp, "%s: bad clientid 0x%x", __func__, ohead->oh_clientid); ASSERT(0); - return -EIO; + return -EFSCORRUPTED; } =20 /* @@ -4479,7 +4479,7 @@ xlog_recover_process_ophdr( if (dp + len > end) { xfs_warn(log->l_mp, "%s: bad length 0x%x", __func__, len); WARN_ON(1); - return -EIO; + return -EFSCORRUPTED; } =20 trans =3D xlog_recover_ophdr_to_trans(rhash, rhead, ohead); @@ -5209,7 +5209,7 @@ xlog_valid_rec_header( (be32_to_cpu(rhead->h_version) & (~XLOG_VERSION_OKBITS))))) { xfs_warn(log->l_mp, "%s: unrecognised log version (%d).", __func__, be32_to_cpu(rhead->h_version)); - return -EIO; + return -EFSCORRUPTED; } =20 /* LR body must have data or it wouldn't have been written */ --- a/fs/xfs/xfs_refcount_item.c +++ b/fs/xfs/xfs_refcount_item.c @@ -497,7 +497,7 @@ xfs_cui_recover( */ set_bit(XFS_CUI_RECOVERED, &cuip->cui_flags); xfs_cui_release(cuip); - return -EIO; + return -EFSCORRUPTED; } } =20 --- a/fs/xfs/xfs_rmap_item.c +++ b/fs/xfs/xfs_rmap_item.c @@ -539,7 +539,7 @@ xfs_rui_recover( */ set_bit(XFS_RUI_RECOVERED, &ruip->rui_flags); xfs_rui_release(ruip); - return -EIO; + return -EFSCORRUPTED; } } From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFA25C32771 for ; Mon, 26 Sep 2022 10:51:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236637AbiIZKvn (ORCPT ); Mon, 26 Sep 2022 06:51:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236755AbiIZKtO (ORCPT ); Mon, 26 Sep 2022 06:49:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94E2757E0E; Mon, 26 Sep 2022 03:26: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 E3645B80682; Mon, 26 Sep 2022 10:26:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5453BC433D6; Mon, 26 Sep 2022 10:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187991; bh=7OG+ozUgsljxL0mxgfSztPkfWo2U65pN0r3LGQwhvuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IRO785qBPfGSoyioUe9Jy3tc0zfyBxHwYvJ0SaA7hsA775PquJb7j6EZmHeITBFE2 G+XVTVPHrsODhiVrfKLROZfpB5zDk0KY1peSvjWBqo8xiyRpWOwd2e4/EjZak4MU8S hUTNfq7zBeFCvmN0u2lPwZ/WLm/XZG3V0/gSdudI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Carlos Maiolino , Christoph Hellwig , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 111/120] xfs: constify the buffer pointer arguments to error functions Date: Mon, 26 Sep 2022 12:12:24 +0200 Message-Id: <20220926100754.992590269@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" commit d243b89a611e83dc97ce7102419360677a664076 upstream. Some of the xfs error message functions take a pointer to a buffer that will be dumped to the system log. The logging functions don't change the contents, so constify all the parameters. This enables the next patch to ensure that we log bad metadata when we encounter it. Signed-off-by: Darrick J. Wong Reviewed-by: Carlos Maiolino Reviewed-by: Christoph Hellwig Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/xfs_error.c | 6 +++--- fs/xfs/xfs_error.h | 6 +++--- fs/xfs/xfs_message.c | 2 +- fs/xfs/xfs_message.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) --- a/fs/xfs/xfs_error.c +++ b/fs/xfs/xfs_error.c @@ -329,7 +329,7 @@ xfs_corruption_error( const char *tag, int level, struct xfs_mount *mp, - void *buf, + const void *buf, size_t bufsize, const char *filename, int linenum, @@ -350,7 +350,7 @@ xfs_buf_verifier_error( struct xfs_buf *bp, int error, const char *name, - void *buf, + const void *buf, size_t bufsz, xfs_failaddr_t failaddr) { @@ -402,7 +402,7 @@ xfs_inode_verifier_error( struct xfs_inode *ip, int error, const char *name, - void *buf, + const void *buf, size_t bufsz, xfs_failaddr_t failaddr) { --- a/fs/xfs/xfs_error.h +++ b/fs/xfs/xfs_error.h @@ -12,16 +12,16 @@ extern void xfs_error_report(const char const char *filename, int linenum, xfs_failaddr_t failaddr); extern void xfs_corruption_error(const char *tag, int level, - struct xfs_mount *mp, void *buf, size_t bufsize, + struct xfs_mount *mp, const void *buf, size_t bufsize, const char *filename, int linenum, xfs_failaddr_t failaddr); extern void xfs_buf_verifier_error(struct xfs_buf *bp, int error, - const char *name, void *buf, size_t bufsz, + const char *name, const void *buf, size_t bufsz, xfs_failaddr_t failaddr); extern void xfs_verifier_error(struct xfs_buf *bp, int error, xfs_failaddr_t failaddr); extern void xfs_inode_verifier_error(struct xfs_inode *ip, int error, - const char *name, void *buf, size_t bufsz, + const char *name, const void *buf, size_t bufsz, xfs_failaddr_t failaddr); =20 #define XFS_ERROR_REPORT(e, lvl, mp) \ --- a/fs/xfs/xfs_message.c +++ b/fs/xfs/xfs_message.c @@ -105,7 +105,7 @@ assfail(char *expr, char *file, int line } =20 void -xfs_hex_dump(void *p, int length) +xfs_hex_dump(const void *p, int length) { print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_OFFSET, 16, 1, p, length, 1); } --- a/fs/xfs/xfs_message.h +++ b/fs/xfs/xfs_message.h @@ -60,6 +60,6 @@ do { \ extern void assfail(char *expr, char *f, int l); extern void asswarn(char *expr, char *f, int l); =20 -extern void xfs_hex_dump(void *p, int length); +extern void xfs_hex_dump(const void *p, int length); =20 #endif /* __XFS_MESSAGE_H */ From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37A12C07E9D for ; Mon, 26 Sep 2022 10:51:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236720AbiIZKvq (ORCPT ); Mon, 26 Sep 2022 06:51:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236769AbiIZKtQ (ORCPT ); Mon, 26 Sep 2022 06:49:16 -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 C4DCF57E05; Mon, 26 Sep 2022 03:26: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 AB22260BB7; Mon, 26 Sep 2022 10:26:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F040C433C1; Mon, 26 Sep 2022 10:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187995; bh=OXjpik695VoB1/q1y3w0fi7eA122sn46oqTTQMHbEGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NZXdOAHCnyc56R57O8MMCawI0x+M1Mix65liNfiQufL6J1GG5wqNkn4sYgVL+ejW2 HzQAc9CDYTHeBAgdjlLViX1zIncCpEbTiAFcTGqjOBdqPh/GygTpt/uW/bEn7ADLyA c/MX/l+tVP+epq01B9ITRCKtnYTY8u2ni7ibOMGA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Carlos Maiolino , Christoph Hellwig , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 112/120] xfs: always log corruption errors Date: Mon, 26 Sep 2022 12:12:25 +0200 Message-Id: <20220926100755.028907186@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" commit a5155b870d687de1a5f07e774b49b1e8ef0f6f50 upstream. Make sure we log something to dmesg whenever we return -EFSCORRUPTED up the call stack. Signed-off-by: Darrick J. Wong Reviewed-by: Carlos Maiolino Reviewed-by: Christoph Hellwig Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/libxfs/xfs_alloc.c | 9 +++++++-- fs/xfs/libxfs/xfs_attr_leaf.c | 12 +++++++++--- fs/xfs/libxfs/xfs_bmap.c | 8 +++++++- fs/xfs/libxfs/xfs_btree.c | 5 ++++- fs/xfs/libxfs/xfs_da_btree.c | 24 ++++++++++++++++++------ fs/xfs/libxfs/xfs_dir2.c | 4 +++- fs/xfs/libxfs/xfs_dir2_leaf.c | 4 +++- fs/xfs/libxfs/xfs_dir2_node.c | 12 +++++++++--- fs/xfs/libxfs/xfs_inode_fork.c | 6 ++++++ fs/xfs/libxfs/xfs_refcount.c | 4 +++- fs/xfs/libxfs/xfs_rtbitmap.c | 6 ++++-- fs/xfs/xfs_acl.c | 15 ++++++++++++--- fs/xfs/xfs_attr_inactive.c | 6 +++++- fs/xfs/xfs_attr_list.c | 5 ++++- fs/xfs/xfs_bmap_item.c | 3 ++- fs/xfs/xfs_error.c | 21 +++++++++++++++++++++ fs/xfs/xfs_error.h | 1 + fs/xfs/xfs_extfree_item.c | 3 ++- fs/xfs/xfs_inode.c | 15 ++++++++++++--- fs/xfs/xfs_inode_item.c | 5 ++++- fs/xfs/xfs_iops.c | 10 +++++++--- fs/xfs/xfs_log_recover.c | 23 ++++++++++++++++++----- fs/xfs/xfs_qm.c | 13 +++++++++++-- fs/xfs/xfs_refcount_item.c | 3 ++- fs/xfs/xfs_rmap_item.c | 7 +++++-- 25 files changed, 179 insertions(+), 45 deletions(-) --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -684,8 +684,10 @@ xfs_alloc_update_counters( =20 xfs_trans_agblocks_delta(tp, len); if (unlikely(be32_to_cpu(agf->agf_freeblks) > - be32_to_cpu(agf->agf_length))) + be32_to_cpu(agf->agf_length))) { + xfs_buf_corruption_error(agbp); return -EFSCORRUPTED; + } =20 xfs_alloc_log_agf(tp, agbp, XFS_AGF_FREEBLKS); return 0; @@ -751,6 +753,7 @@ xfs_alloc_ag_vextent_small( =20 bp =3D xfs_btree_get_bufs(args->mp, args->tp, args->agno, fbno); if (!bp) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, args->mp); error =3D -EFSCORRUPTED; goto error; } @@ -2087,8 +2090,10 @@ xfs_free_agfl_block( return error; =20 bp =3D xfs_btree_get_bufs(tp->t_mountp, tp, agno, agbno); - if (!bp) + if (!bp) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, tp->t_mountp); return -EFSCORRUPTED; + } xfs_trans_binval(tp, bp); =20 return 0; --- a/fs/xfs/libxfs/xfs_attr_leaf.c +++ b/fs/xfs/libxfs/xfs_attr_leaf.c @@ -2287,8 +2287,10 @@ xfs_attr3_leaf_lookup_int( leaf =3D bp->b_addr; xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); entries =3D xfs_attr3_leaf_entryp(leaf); - if (ichdr.count >=3D args->geo->blksize / 8) + if (ichdr.count >=3D args->geo->blksize / 8) { + xfs_buf_corruption_error(bp); return -EFSCORRUPTED; + } =20 /* * Binary search. (note: small blocks will skip this loop) @@ -2304,10 +2306,14 @@ xfs_attr3_leaf_lookup_int( else break; } - if (!(probe >=3D 0 && (!ichdr.count || probe < ichdr.count))) + if (!(probe >=3D 0 && (!ichdr.count || probe < ichdr.count))) { + xfs_buf_corruption_error(bp); return -EFSCORRUPTED; - if (!(span <=3D 4 || be32_to_cpu(entry->hashval) =3D=3D hashval)) + } + if (!(span <=3D 4 || be32_to_cpu(entry->hashval) =3D=3D hashval)) { + xfs_buf_corruption_error(bp); return -EFSCORRUPTED; + } =20 /* * Since we may have duplicate hashval's, find the first matching --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -729,6 +729,7 @@ xfs_bmap_extents_to_btree( xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, 1L); abp =3D xfs_btree_get_bufl(mp, tp, args.fsbno); if (!abp) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); error =3D -EFSCORRUPTED; goto out_unreserve_dquot; } @@ -1084,6 +1085,7 @@ xfs_bmap_add_attrfork( if (XFS_IFORK_Q(ip)) goto trans_cancel; if (ip->i_d.di_anextents !=3D 0) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); error =3D -EFSCORRUPTED; goto trans_cancel; } @@ -1374,6 +1376,7 @@ xfs_bmap_last_before( case XFS_DINODE_FMT_EXTENTS: break; default: + ASSERT(0); return -EFSCORRUPTED; } =20 @@ -1474,8 +1477,10 @@ xfs_bmap_last_offset( return 0; =20 if (XFS_IFORK_FORMAT(ip, whichfork) !=3D XFS_DINODE_FMT_BTREE && - XFS_IFORK_FORMAT(ip, whichfork) !=3D XFS_DINODE_FMT_EXTENTS) + XFS_IFORK_FORMAT(ip, whichfork) !=3D XFS_DINODE_FMT_EXTENTS) { + ASSERT(0); return -EFSCORRUPTED; + } =20 error =3D xfs_bmap_last_extent(NULL, ip, whichfork, &rec, &is_empty); if (error || is_empty) @@ -5872,6 +5877,7 @@ xfs_bmap_insert_extents( del_cursor); =20 if (stop_fsb >=3D got.br_startoff + got.br_blockcount) { + ASSERT(0); error =3D -EFSCORRUPTED; goto del_cursor; } --- a/fs/xfs/libxfs/xfs_btree.c +++ b/fs/xfs/libxfs/xfs_btree.c @@ -1820,6 +1820,7 @@ xfs_btree_lookup_get_block( =20 out_bad: *blkp =3D NULL; + xfs_buf_corruption_error(bp); xfs_trans_brelse(cur->bc_tp, bp); return -EFSCORRUPTED; } @@ -1867,8 +1868,10 @@ xfs_btree_lookup( XFS_BTREE_STATS_INC(cur, lookup); =20 /* No such thing as a zero-level tree. */ - if (cur->bc_nlevels =3D=3D 0) + if (cur->bc_nlevels =3D=3D 0) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, cur->bc_mp); return -EFSCORRUPTED; + } =20 block =3D NULL; keyno =3D 0; --- a/fs/xfs/libxfs/xfs_da_btree.c +++ b/fs/xfs/libxfs/xfs_da_btree.c @@ -504,6 +504,7 @@ xfs_da3_split( node =3D oldblk->bp->b_addr; if (node->hdr.info.forw) { if (be32_to_cpu(node->hdr.info.forw) !=3D addblk->blkno) { + xfs_buf_corruption_error(oldblk->bp); error =3D -EFSCORRUPTED; goto out; } @@ -516,6 +517,7 @@ xfs_da3_split( node =3D oldblk->bp->b_addr; if (node->hdr.info.back) { if (be32_to_cpu(node->hdr.info.back) !=3D addblk->blkno) { + xfs_buf_corruption_error(oldblk->bp); error =3D -EFSCORRUPTED; goto out; } @@ -1541,8 +1543,10 @@ xfs_da3_node_lookup_int( break; } =20 - if (magic !=3D XFS_DA_NODE_MAGIC && magic !=3D XFS_DA3_NODE_MAGIC) + if (magic !=3D XFS_DA_NODE_MAGIC && magic !=3D XFS_DA3_NODE_MAGIC) { + xfs_buf_corruption_error(blk->bp); return -EFSCORRUPTED; + } =20 blk->magic =3D XFS_DA_NODE_MAGIC; =20 @@ -1554,15 +1558,18 @@ xfs_da3_node_lookup_int( btree =3D dp->d_ops->node_tree_p(node); =20 /* Tree taller than we can handle; bail out! */ - if (nodehdr.level >=3D XFS_DA_NODE_MAXDEPTH) + if (nodehdr.level >=3D XFS_DA_NODE_MAXDEPTH) { + xfs_buf_corruption_error(blk->bp); return -EFSCORRUPTED; + } =20 /* Check the level from the root. */ if (blkno =3D=3D args->geo->leafblk) expected_level =3D nodehdr.level - 1; - else if (expected_level !=3D nodehdr.level) + else if (expected_level !=3D nodehdr.level) { + xfs_buf_corruption_error(blk->bp); return -EFSCORRUPTED; - else + } else expected_level--; =20 max =3D nodehdr.count; @@ -1612,12 +1619,17 @@ xfs_da3_node_lookup_int( } =20 /* We can't point back to the root. */ - if (blkno =3D=3D args->geo->leafblk) + if (blkno =3D=3D args->geo->leafblk) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, + dp->i_mount); return -EFSCORRUPTED; + } } =20 - if (expected_level !=3D 0) + if (expected_level !=3D 0) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, dp->i_mount); return -EFSCORRUPTED; + } =20 /* * A leaf block that ends in the hashval that we are interested in --- a/fs/xfs/libxfs/xfs_dir2.c +++ b/fs/xfs/libxfs/xfs_dir2.c @@ -600,8 +600,10 @@ xfs_dir2_isblock( if ((rval =3D xfs_bmap_last_offset(args->dp, &last, XFS_DATA_FORK))) return rval; rval =3D XFS_FSB_TO_B(args->dp->i_mount, last) =3D=3D args->geo->blksize; - if (rval !=3D 0 && args->dp->i_d.di_size !=3D args->geo->blksize) + if (rval !=3D 0 && args->dp->i_d.di_size !=3D args->geo->blksize) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, args->dp->i_mount); return -EFSCORRUPTED; + } *vp =3D rval; return 0; } --- a/fs/xfs/libxfs/xfs_dir2_leaf.c +++ b/fs/xfs/libxfs/xfs_dir2_leaf.c @@ -1343,8 +1343,10 @@ xfs_dir2_leaf_removename( oldbest =3D be16_to_cpu(bf[0].length); ltp =3D xfs_dir2_leaf_tail_p(args->geo, leaf); bestsp =3D xfs_dir2_leaf_bests_p(ltp); - if (be16_to_cpu(bestsp[db]) !=3D oldbest) + if (be16_to_cpu(bestsp[db]) !=3D oldbest) { + xfs_buf_corruption_error(lbp); return -EFSCORRUPTED; + } /* * Mark the former data entry unused. */ --- a/fs/xfs/libxfs/xfs_dir2_node.c +++ b/fs/xfs/libxfs/xfs_dir2_node.c @@ -374,8 +374,10 @@ xfs_dir2_leaf_to_node( leaf =3D lbp->b_addr; ltp =3D xfs_dir2_leaf_tail_p(args->geo, leaf); if (be32_to_cpu(ltp->bestcount) > - (uint)dp->i_d.di_size / args->geo->blksize) + (uint)dp->i_d.di_size / args->geo->blksize) { + xfs_buf_corruption_error(lbp); return -EFSCORRUPTED; + } =20 /* * Copy freespace entries from the leaf block to the new block. @@ -446,8 +448,10 @@ xfs_dir2_leafn_add( * Quick check just to make sure we are not going to index * into other peoples memory */ - if (index < 0) + if (index < 0) { + xfs_buf_corruption_error(bp); return -EFSCORRUPTED; + } =20 /* * If there are already the maximum number of leaf entries in @@ -740,8 +744,10 @@ xfs_dir2_leafn_lookup_for_entry( ents =3D dp->d_ops->leaf_ents_p(leaf); =20 xfs_dir3_leaf_check(dp, bp); - if (leafhdr.count <=3D 0) + if (leafhdr.count <=3D 0) { + xfs_buf_corruption_error(bp); return -EFSCORRUPTED; + } =20 /* * Look up the hash value in the leaf entries. --- a/fs/xfs/libxfs/xfs_inode_fork.c +++ b/fs/xfs/libxfs/xfs_inode_fork.c @@ -75,11 +75,15 @@ xfs_iformat_fork( error =3D xfs_iformat_btree(ip, dip, XFS_DATA_FORK); break; default: + xfs_inode_verifier_error(ip, -EFSCORRUPTED, __func__, + dip, sizeof(*dip), __this_address); return -EFSCORRUPTED; } break; =20 default: + xfs_inode_verifier_error(ip, -EFSCORRUPTED, __func__, dip, + sizeof(*dip), __this_address); return -EFSCORRUPTED; } if (error) @@ -110,6 +114,8 @@ xfs_iformat_fork( error =3D xfs_iformat_btree(ip, dip, XFS_ATTR_FORK); break; default: + xfs_inode_verifier_error(ip, error, __func__, dip, + sizeof(*dip), __this_address); error =3D -EFSCORRUPTED; break; } --- a/fs/xfs/libxfs/xfs_refcount.c +++ b/fs/xfs/libxfs/xfs_refcount.c @@ -1591,8 +1591,10 @@ xfs_refcount_recover_extent( struct list_head *debris =3D priv; struct xfs_refcount_recovery *rr; =20 - if (be32_to_cpu(rec->refc.rc_refcount) !=3D 1) + if (be32_to_cpu(rec->refc.rc_refcount) !=3D 1) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, cur->bc_mp); return -EFSCORRUPTED; + } =20 rr =3D kmem_alloc(sizeof(struct xfs_refcount_recovery), 0); xfs_refcount_btrec_to_irec(rec, &rr->rr_rrec); --- a/fs/xfs/libxfs/xfs_rtbitmap.c +++ b/fs/xfs/libxfs/xfs_rtbitmap.c @@ -15,7 +15,7 @@ #include "xfs_bmap.h" #include "xfs_trans.h" #include "xfs_rtalloc.h" - +#include "xfs_error.h" =20 /* * Realtime allocator bitmap functions shared with userspace. @@ -70,8 +70,10 @@ xfs_rtbuf_get( if (error) return error; =20 - if (nmap =3D=3D 0 || !xfs_bmap_is_real_extent(&map)) + if (nmap =3D=3D 0 || !xfs_bmap_is_real_extent(&map)) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); return -EFSCORRUPTED; + } =20 ASSERT(map.br_startblock !=3D NULLFSBLOCK); error =3D xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, --- a/fs/xfs/xfs_acl.c +++ b/fs/xfs/xfs_acl.c @@ -12,6 +12,7 @@ #include "xfs_inode.h" #include "xfs_attr.h" #include "xfs_trace.h" +#include "xfs_error.h" #include =20 =20 @@ -23,6 +24,7 @@ =20 STATIC struct posix_acl * xfs_acl_from_disk( + struct xfs_mount *mp, const struct xfs_acl *aclp, int len, int max_entries) @@ -32,11 +34,18 @@ xfs_acl_from_disk( const struct xfs_acl_entry *ace; unsigned int count, i; =20 - if (len < sizeof(*aclp)) + if (len < sizeof(*aclp)) { + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, aclp, + len); return ERR_PTR(-EFSCORRUPTED); + } + count =3D be32_to_cpu(aclp->acl_cnt); - if (count > max_entries || XFS_ACL_SIZE(count) !=3D len) + if (count > max_entries || XFS_ACL_SIZE(count) !=3D len) { + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, aclp, + len); return ERR_PTR(-EFSCORRUPTED); + } =20 acl =3D posix_acl_alloc(count, GFP_KERNEL); if (!acl) @@ -145,7 +154,7 @@ xfs_get_acl(struct inode *inode, int typ if (error !=3D -ENOATTR) acl =3D ERR_PTR(error); } else { - acl =3D xfs_acl_from_disk(xfs_acl, len, + acl =3D xfs_acl_from_disk(ip->i_mount, xfs_acl, len, XFS_ACL_MAX_ENTRIES(ip->i_mount)); kmem_free(xfs_acl); } --- a/fs/xfs/xfs_attr_inactive.c +++ b/fs/xfs/xfs_attr_inactive.c @@ -22,6 +22,7 @@ #include "xfs_attr_leaf.h" #include "xfs_quota.h" #include "xfs_dir2.h" +#include "xfs_error.h" =20 /* * Look at all the extents for this logical region, @@ -209,6 +210,7 @@ xfs_attr3_node_inactive( */ if (level > XFS_DA_NODE_MAXDEPTH) { xfs_trans_brelse(*trans, bp); /* no locks for later trans */ + xfs_buf_corruption_error(bp); return -EFSCORRUPTED; } =20 @@ -258,8 +260,9 @@ xfs_attr3_node_inactive( error =3D xfs_attr3_leaf_inactive(trans, dp, child_bp); break; default: - error =3D -EFSCORRUPTED; + xfs_buf_corruption_error(child_bp); xfs_trans_brelse(*trans, child_bp); + error =3D -EFSCORRUPTED; break; } if (error) @@ -342,6 +345,7 @@ xfs_attr3_root_inactive( break; default: error =3D -EFSCORRUPTED; + xfs_buf_corruption_error(bp); xfs_trans_brelse(*trans, bp); break; } --- a/fs/xfs/xfs_attr_list.c +++ b/fs/xfs/xfs_attr_list.c @@ -258,8 +258,10 @@ xfs_attr_node_list_lookup( return 0; =20 /* We can't point back to the root. */ - if (cursor->blkno =3D=3D 0) + if (cursor->blkno =3D=3D 0) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); return -EFSCORRUPTED; + } } =20 if (expected_level !=3D 0) @@ -269,6 +271,7 @@ xfs_attr_node_list_lookup( return 0; =20 out_corruptbuf: + xfs_buf_corruption_error(bp); xfs_trans_brelse(tp, bp); return -EFSCORRUPTED; } --- a/fs/xfs/xfs_bmap_item.c +++ b/fs/xfs/xfs_bmap_item.c @@ -21,7 +21,7 @@ #include "xfs_icache.h" #include "xfs_bmap_btree.h" #include "xfs_trans_space.h" - +#include "xfs_error.h" =20 kmem_zone_t *xfs_bui_zone; kmem_zone_t *xfs_bud_zone; @@ -525,6 +525,7 @@ xfs_bui_recover( type =3D bui_type; break; default: + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); error =3D -EFSCORRUPTED; goto err_inode; } --- a/fs/xfs/xfs_error.c +++ b/fs/xfs/xfs_error.c @@ -342,6 +342,27 @@ xfs_corruption_error( } =20 /* + * Complain about the kinds of metadata corruption that we can't detect fr= om a + * verifier, such as incorrect inter-block relationship data. Does not set + * bp->b_error. + */ +void +xfs_buf_corruption_error( + struct xfs_buf *bp) +{ + struct xfs_mount *mp =3D bp->b_mount; + + xfs_alert_tag(mp, XFS_PTAG_VERIFIER_ERROR, + "Metadata corruption detected at %pS, %s block 0x%llx", + __return_address, bp->b_ops->name, bp->b_bn); + + xfs_alert(mp, "Unmount and run xfs_repair"); + + if (xfs_error_level >=3D XFS_ERRLEVEL_HIGH) + xfs_stack_trace(); +} + +/* * Warnings specifically for verifier errors. Differentiate CRC vs. inval= id * values, and omit the stack trace unless the error level is tuned high. */ --- a/fs/xfs/xfs_error.h +++ b/fs/xfs/xfs_error.h @@ -15,6 +15,7 @@ extern void xfs_corruption_error(const c struct xfs_mount *mp, const void *buf, size_t bufsize, const char *filename, int linenum, xfs_failaddr_t failaddr); +void xfs_buf_corruption_error(struct xfs_buf *bp); extern void xfs_buf_verifier_error(struct xfs_buf *bp, int error, const char *name, const void *buf, size_t bufsz, xfs_failaddr_t failaddr); --- a/fs/xfs/xfs_extfree_item.c +++ b/fs/xfs/xfs_extfree_item.c @@ -21,7 +21,7 @@ #include "xfs_alloc.h" #include "xfs_bmap.h" #include "xfs_trace.h" - +#include "xfs_error.h" =20 kmem_zone_t *xfs_efi_zone; kmem_zone_t *xfs_efd_zone; @@ -228,6 +228,7 @@ xfs_efi_copy_format(xfs_log_iovec_t *buf } return 0; } + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); return -EFSCORRUPTED; } =20 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -2149,8 +2149,10 @@ xfs_iunlink_update_bucket( * passed in because either we're adding or removing ourselves from the * head of the list. */ - if (old_value =3D=3D new_agino) + if (old_value =3D=3D new_agino) { + xfs_buf_corruption_error(agibp); return -EFSCORRUPTED; + } =20 agi->agi_unlinked[bucket_index] =3D cpu_to_be32(new_agino); offset =3D offsetof(struct xfs_agi, agi_unlinked) + @@ -2213,6 +2215,8 @@ xfs_iunlink_update_inode( /* Make sure the old pointer isn't garbage. */ old_value =3D be32_to_cpu(dip->di_next_unlinked); if (!xfs_verify_agino_or_null(mp, agno, old_value)) { + xfs_inode_verifier_error(ip, -EFSCORRUPTED, __func__, dip, + sizeof(*dip), __this_address); error =3D -EFSCORRUPTED; goto out; } @@ -2224,8 +2228,11 @@ xfs_iunlink_update_inode( */ *old_next_agino =3D old_value; if (old_value =3D=3D next_agino) { - if (next_agino !=3D NULLAGINO) + if (next_agino !=3D NULLAGINO) { + xfs_inode_verifier_error(ip, -EFSCORRUPTED, __func__, + dip, sizeof(*dip), __this_address); error =3D -EFSCORRUPTED; + } goto out; } =20 @@ -2276,8 +2283,10 @@ xfs_iunlink( */ next_agino =3D be32_to_cpu(agi->agi_unlinked[bucket_index]); if (next_agino =3D=3D agino || - !xfs_verify_agino_or_null(mp, agno, next_agino)) + !xfs_verify_agino_or_null(mp, agno, next_agino)) { + xfs_buf_corruption_error(agibp); return -EFSCORRUPTED; + } =20 if (next_agino !=3D NULLAGINO) { struct xfs_perag *pag; --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c @@ -17,6 +17,7 @@ #include "xfs_trans_priv.h" #include "xfs_buf_item.h" #include "xfs_log.h" +#include "xfs_error.h" =20 #include =20 @@ -828,8 +829,10 @@ xfs_inode_item_format_convert( { struct xfs_inode_log_format_32 *in_f32 =3D buf->i_addr; =20 - if (buf->i_len !=3D sizeof(*in_f32)) + if (buf->i_len !=3D sizeof(*in_f32)) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); return -EFSCORRUPTED; + } =20 in_f->ilf_type =3D in_f32->ilf_type; in_f->ilf_size =3D in_f32->ilf_size; --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -20,6 +20,7 @@ #include "xfs_symlink.h" #include "xfs_dir2.h" #include "xfs_iomap.h" +#include "xfs_error.h" =20 #include #include @@ -470,17 +471,20 @@ xfs_vn_get_link_inline( struct inode *inode, struct delayed_call *done) { + struct xfs_inode *ip =3D XFS_I(inode); char *link; =20 - ASSERT(XFS_I(inode)->i_df.if_flags & XFS_IFINLINE); + ASSERT(ip->i_df.if_flags & XFS_IFINLINE); =20 /* * The VFS crashes on a NULL pointer, so return -EFSCORRUPTED if * if_data is junk. */ - link =3D XFS_I(inode)->i_df.if_u1.if_data; - if (!link) + link =3D ip->i_df.if_u1.if_data; + if (!link) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, ip->i_mount); return ERR_PTR(-EFSCORRUPTED); + } return link; } =20 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -3537,6 +3537,7 @@ xfs_cui_copy_format( memcpy(dst_cui_fmt, src_cui_fmt, len); return 0; } + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); return -EFSCORRUPTED; } =20 @@ -3601,8 +3602,10 @@ xlog_recover_cud_pass2( struct xfs_ail *ailp =3D log->l_ailp; =20 cud_formatp =3D item->ri_buf[0].i_addr; - if (item->ri_buf[0].i_len !=3D sizeof(struct xfs_cud_log_format)) + if (item->ri_buf[0].i_len !=3D sizeof(struct xfs_cud_log_format)) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp); return -EFSCORRUPTED; + } cui_id =3D cud_formatp->cud_cui_id; =20 /* @@ -3654,6 +3657,7 @@ xfs_bui_copy_format( memcpy(dst_bui_fmt, src_bui_fmt, len); return 0; } + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); return -EFSCORRUPTED; } =20 @@ -3677,8 +3681,10 @@ xlog_recover_bui_pass2( =20 bui_formatp =3D item->ri_buf[0].i_addr; =20 - if (bui_formatp->bui_nextents !=3D XFS_BUI_MAX_FAST_EXTENTS) + if (bui_formatp->bui_nextents !=3D XFS_BUI_MAX_FAST_EXTENTS) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp); return -EFSCORRUPTED; + } buip =3D xfs_bui_init(mp); error =3D xfs_bui_copy_format(&item->ri_buf[0], &buip->bui_format); if (error) { @@ -3720,8 +3726,10 @@ xlog_recover_bud_pass2( struct xfs_ail *ailp =3D log->l_ailp; =20 bud_formatp =3D item->ri_buf[0].i_addr; - if (item->ri_buf[0].i_len !=3D sizeof(struct xfs_bud_log_format)) + if (item->ri_buf[0].i_len !=3D sizeof(struct xfs_bud_log_format)) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp); return -EFSCORRUPTED; + } bui_id =3D bud_formatp->bud_bui_id; =20 /* @@ -5181,8 +5189,10 @@ xlog_recover_process( * If the filesystem is CRC enabled, this mismatch becomes a * fatal log corruption failure. */ - if (xfs_sb_version_hascrc(&log->l_mp->m_sb)) + if (xfs_sb_version_hascrc(&log->l_mp->m_sb)) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp); return -EFSCORRUPTED; + } } =20 xlog_unpack_data(rhead, dp, log); @@ -5305,8 +5315,11 @@ xlog_do_recovery_pass( "invalid iclog size (%d bytes), using lsunit (%d bytes)", h_size, log->l_mp->m_logbsize); h_size =3D log->l_mp->m_logbsize; - } else + } else { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, + log->l_mp); return -EFSCORRUPTED; + } } =20 if ((be32_to_cpu(rhead->h_version) & XLOG_VERSION_2) && --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c @@ -22,6 +22,7 @@ #include "xfs_qm.h" #include "xfs_trace.h" #include "xfs_icache.h" +#include "xfs_error.h" =20 /* * The global quota manager. There is only one of these for the entire @@ -754,11 +755,19 @@ xfs_qm_qino_alloc( if ((flags & XFS_QMOPT_PQUOTA) && (mp->m_sb.sb_gquotino !=3D NULLFSINO)) { ino =3D mp->m_sb.sb_gquotino; - ASSERT(mp->m_sb.sb_pquotino =3D=3D NULLFSINO); + if (mp->m_sb.sb_pquotino !=3D NULLFSINO) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, + mp); + return -EFSCORRUPTED; + } } else if ((flags & XFS_QMOPT_GQUOTA) && (mp->m_sb.sb_pquotino !=3D NULLFSINO)) { ino =3D mp->m_sb.sb_pquotino; - ASSERT(mp->m_sb.sb_gquotino =3D=3D NULLFSINO); + if (mp->m_sb.sb_gquotino !=3D NULLFSINO) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, + mp); + return -EFSCORRUPTED; + } } if (ino !=3D NULLFSINO) { error =3D xfs_iget(mp, NULL, ino, 0, 0, ip); --- a/fs/xfs/xfs_refcount_item.c +++ b/fs/xfs/xfs_refcount_item.c @@ -17,7 +17,7 @@ #include "xfs_refcount_item.h" #include "xfs_log.h" #include "xfs_refcount.h" - +#include "xfs_error.h" =20 kmem_zone_t *xfs_cui_zone; kmem_zone_t *xfs_cud_zone; @@ -536,6 +536,7 @@ xfs_cui_recover( type =3D refc_type; break; default: + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); error =3D -EFSCORRUPTED; goto abort_error; } --- a/fs/xfs/xfs_rmap_item.c +++ b/fs/xfs/xfs_rmap_item.c @@ -17,7 +17,7 @@ #include "xfs_rmap_item.h" #include "xfs_log.h" #include "xfs_rmap.h" - +#include "xfs_error.h" =20 kmem_zone_t *xfs_rui_zone; kmem_zone_t *xfs_rud_zone; @@ -171,8 +171,10 @@ xfs_rui_copy_format( src_rui_fmt =3D buf->i_addr; len =3D xfs_rui_log_format_sizeof(src_rui_fmt->rui_nextents); =20 - if (buf->i_len !=3D len) + if (buf->i_len !=3D len) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); return -EFSCORRUPTED; + } =20 memcpy(dst_rui_fmt, src_rui_fmt, len); return 0; @@ -581,6 +583,7 @@ xfs_rui_recover( type =3D XFS_RMAP_FREE; break; default: + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); error =3D -EFSCORRUPTED; goto abort_error; } From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F34B8C07E9D for ; Mon, 26 Sep 2022 10:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233587AbiIZKrt (ORCPT ); Mon, 26 Sep 2022 06:47:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236301AbiIZKpJ (ORCPT ); Mon, 26 Sep 2022 06:45:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8092D564FB; Mon, 26 Sep 2022 03:25: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 F1F0E60B2F; Mon, 26 Sep 2022 10:25:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8E69C433C1; Mon, 26 Sep 2022 10:25:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187949; bh=6CQzMC7L2OMYeY0hfewh1McdlzBx6HEsshVCI5I7lzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MsgbLL/fjNv9hvIDMUhKfFDrbvvjJg9+fIFGotzNI5t6VDvV7Medfy1uRA75LqNgs fY/E6K/FU21s8/pcR/VLwkRTMBThwEievJnHTwSnQEBlgU0K2KPYHQr5SWBFUgQmsZ HfhU4vkzVl/tvqf02lCJFSPP4CEiyuWDy7lINUo4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Brian Foster , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 113/120] xfs: fix some memory leaks in log recovery Date: Mon, 26 Sep 2022 12:12:26 +0200 Message-Id: <20220926100755.058030217@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" commit 050552cbe06a3a9c3f977dcf11ff998ae1d5c2d5 upstream. Fix a few places where we xlog_alloc_buffer a buffer, hit an error, and then bail out without freeing the buffer. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/xfs_log_recover.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -1347,10 +1347,11 @@ xlog_find_tail( error =3D xlog_rseek_logrec_hdr(log, *head_blk, *head_blk, 1, buffer, &rhead_blk, &rhead, &wrapped); if (error < 0) - return error; + goto done; if (!error) { xfs_warn(log->l_mp, "%s: couldn't find sync record", __func__); - return -EFSCORRUPTED; + error =3D -EFSCORRUPTED; + goto done; } *tail_blk =3D BLOCK_LSN(be64_to_cpu(rhead->h_tail_lsn)); =20 @@ -5318,7 +5319,8 @@ xlog_do_recovery_pass( } else { XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp); - return -EFSCORRUPTED; + error =3D -EFSCORRUPTED; + goto bread_err1; } } From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67DDAC07E9D for ; Mon, 26 Sep 2022 10:48:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234210AbiIZKsB (ORCPT ); Mon, 26 Sep 2022 06:48:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236488AbiIZKqJ (ORCPT ); Mon, 26 Sep 2022 06:46: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 AFB7556BBB; Mon, 26 Sep 2022 03:25:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CC30FB8055F; Mon, 26 Sep 2022 10:25:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F456C433C1; Mon, 26 Sep 2022 10:25:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187952; bh=h+/4jC8dkAJL9pGO+IjbkJB8AIPYC7de9IyAM3x4D2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CwbdJYyZtP7s7N2BkUtu5Ix6rmanJU5aGKrE1YJ+4AiaFhEVDStq+RmwZBSJpDJ/D loTxAS7/p/4YhIZ1FbqH97X0fKVnsjtYoympfhrakr8MdKMJZEY+cVmK4AAihVBo7e u14siaa9Q0fv0F0DjPIy/GPRZzC0/UgbKGEVO3SY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Foster , "Darrick J. Wong" , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 114/120] xfs: stabilize insert range start boundary to avoid COW writeback race Date: Mon, 26 Sep 2022 12:12:27 +0200 Message-Id: <20220926100755.090442267@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Foster commit d0c2204135a0cdbc607c94c481cf1ccb2f659aa7 upstream. generic/522 (fsx) occasionally fails with a file corruption due to an insert range operation. The primary characteristic of the corruption is a misplaced insert range operation that differs from the requested target offset. The reason for this behavior is a race between the extent shift sequence of an insert range and a COW writeback completion that causes a front merge with the first extent in the shift. The shift preparation function flushes and unmaps from the target offset of the operation to the end of the file to ensure no modifications can be made and page cache is invalidated before file data is shifted. An insert range operation then splits the extent at the target offset, if necessary, and begins to shift the start offset of each extent starting from the end of the file to the start offset. The shift sequence operates at extent level and so depends on the preparation sequence to guarantee no changes can be made to the target range during the shift. If the block immediately prior to the target offset was dirty and shared, however, it can undergo writeback and move from the COW fork to the data fork at any point during the shift. If the block is contiguous with the block at the start offset of the insert range, it can front merge and alter the start offset of the extent. Once the shift sequence reaches the target offset, it shifts based on the latest start offset and silently changes the target offset of the operation and corrupts the file. To address this problem, update the shift preparation code to stabilize the start boundary along with the full range of the insert. Also update the existing corruption check to fail if any extent is shifted with a start offset behind the target offset of the insert range. This prevents insert from racing with COW writeback completion and fails loudly in the event of an unexpected extent shift. Signed-off-by: Brian Foster Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/libxfs/xfs_bmap.c | 2 +- fs/xfs/xfs_bmap_util.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -5876,7 +5876,7 @@ xfs_bmap_insert_extents( XFS_WANT_CORRUPTED_GOTO(mp, !isnullstartblock(got.br_startblock), del_cursor); =20 - if (stop_fsb >=3D got.br_startoff + got.br_blockcount) { + if (stop_fsb > got.br_startoff) { ASSERT(0); error =3D -EFSCORRUPTED; goto del_cursor; --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -1167,6 +1167,7 @@ xfs_prepare_shift( struct xfs_inode *ip, loff_t offset) { + struct xfs_mount *mp =3D ip->i_mount; int error; =20 /* @@ -1180,6 +1181,17 @@ xfs_prepare_shift( } =20 /* + * Shift operations must stabilize the start block offset boundary along + * with the full range of the operation. If we don't, a COW writeback + * completion could race with an insert, front merge with the start + * extent (after split) during the shift and corrupt the file. Start + * with the block just prior to the start to stabilize the boundary. + */ + offset =3D round_down(offset, 1 << mp->m_sb.sb_blocklog); + if (offset) + offset -=3D (1 << mp->m_sb.sb_blocklog); + + /* * Writeback and invalidate cache for the remainder of the file as we're * about to shift down every extent from offset to EOF. */ From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFE09C6FA90 for ; Mon, 26 Sep 2022 10:50:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234291AbiIZKui (ORCPT ); Mon, 26 Sep 2022 06:50:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236570AbiIZKqw (ORCPT ); Mon, 26 Sep 2022 06:46:52 -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 B38B957232; Mon, 26 Sep 2022 03:25: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 BB772B80915; Mon, 26 Sep 2022 10:25:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2714FC433D7; Mon, 26 Sep 2022 10:25:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187955; bh=e/6xeRdBd9WX29GIdGG1MC2Ct7nHdPDSrGxL1c8Rg5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UnxVW89f4ggI4TP7VkB7ZnlMO+946TTChNENx7MbzA+vSPVTW2aX9o24JrD/Cd7Ij ae7sLmrOx4/3Wx5DsmZAcXLfu87P8ZhjgC7lFGIqKEBgaF+1NX8nFBX5L8xlYsopkv XSljZ5fPMAbDGie5BOmj30L0t89Hy74GNxkbCrdM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Foster , Eric Sandeen , "Darrick J. Wong" , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 115/120] xfs: use bitops interface for buf log item AIL flag check Date: Mon, 26 Sep 2022 12:12:28 +0200 Message-Id: <20220926100755.121201939@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Foster commit 826f7e34130a4ce756138540170cbe935c537a47 upstream. The xfs_log_item flags were converted to atomic bitops as of commit 22525c17ed ("xfs: log item flags are racy"). The assert check for AIL presence in xfs_buf_item_relse() still uses the old value based check. This likely went unnoticed as XFS_LI_IN_AIL evaluates to 0 and causes the assert to unconditionally pass. Fix up the check. Signed-off-by: Brian Foster Fixes: 22525c17ed ("xfs: log item flags are racy") Reviewed-by: Eric Sandeen Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/xfs_buf_item.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c @@ -956,7 +956,7 @@ xfs_buf_item_relse( struct xfs_buf_log_item *bip =3D bp->b_log_item; =20 trace_xfs_buf_item_relse(bp, _RET_IP_); - ASSERT(!(bip->bli_item.li_flags & XFS_LI_IN_AIL)); + ASSERT(!test_bit(XFS_LI_IN_AIL, &bip->bli_item.li_flags)); =20 bp->b_log_item =3D NULL; if (list_empty(&bp->b_li_list)) From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D42BC32771 for ; Mon, 26 Sep 2022 10:50:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236573AbiIZKuw (ORCPT ); Mon, 26 Sep 2022 06:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236261AbiIZKrF (ORCPT ); Mon, 26 Sep 2022 06:47: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 1701857252; Mon, 26 Sep 2022 03:26: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 AD6EBB80925; Mon, 26 Sep 2022 10:25:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08C10C433D6; Mon, 26 Sep 2022 10:25:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187958; bh=c0vbNjZDKh39S/tRoh2hkSUrBbZ58zaTq/Vq+FohNSM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FCJIDoOq22UENSi7NXWuNr6KoqVeiRRtsDUPo4Sk69vCd/naSv+JIgkbghxqVC+Ie u0hBNIiSInqNmP62fSSp1Pnw6vqJh6V1sw4qdwgYUlG+Y/boJxaPAT6Exx4xS7Zov0 59rvTvjCet3NoLkqoP9QNdP+qI+udVoXwC0W6Keg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Brian Foster , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 116/120] xfs: refactor agfl length computation function Date: Mon, 26 Sep 2022 12:12:29 +0200 Message-Id: <20220926100755.167350394@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" commit 1cac233cfe71f21e069705a4930c18e48d897be6 upstream. Refactor xfs_alloc_min_freelist to accept a NULL @pag argument, in which case it returns the largest possible minimum length. This will be used in an upcoming patch to compute the length of the AGFL at mkfs time. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/libxfs/xfs_alloc.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -1998,24 +1998,32 @@ xfs_alloc_longest_free_extent( return pag->pagf_flcount > 0 || pag->pagf_longest > 0; } =20 +/* + * Compute the minimum length of the AGFL in the given AG. If @pag is NUL= L, + * return the largest possible minimum length. + */ unsigned int xfs_alloc_min_freelist( struct xfs_mount *mp, struct xfs_perag *pag) { + /* AG btrees have at least 1 level. */ + static const uint8_t fake_levels[XFS_BTNUM_AGF] =3D {1, 1, 1}; + const uint8_t *levels =3D pag ? pag->pagf_levels : fake_levels; unsigned int min_free; =20 + ASSERT(mp->m_ag_maxlevels > 0); + /* space needed by-bno freespace btree */ - min_free =3D min_t(unsigned int, pag->pagf_levels[XFS_BTNUM_BNOi] + 1, + min_free =3D min_t(unsigned int, levels[XFS_BTNUM_BNOi] + 1, mp->m_ag_maxlevels); /* space needed by-size freespace btree */ - min_free +=3D min_t(unsigned int, pag->pagf_levels[XFS_BTNUM_CNTi] + 1, + min_free +=3D min_t(unsigned int, levels[XFS_BTNUM_CNTi] + 1, mp->m_ag_maxlevels); /* space needed reverse mapping used space btree */ if (xfs_sb_version_hasrmapbt(&mp->m_sb)) - min_free +=3D min_t(unsigned int, - pag->pagf_levels[XFS_BTNUM_RMAPi] + 1, - mp->m_rmap_maxlevels); + min_free +=3D min_t(unsigned int, levels[XFS_BTNUM_RMAPi] + 1, + mp->m_rmap_maxlevels); =20 return min_free; } From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE6F9C32771 for ; Mon, 26 Sep 2022 10:51:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236568AbiIZKvG (ORCPT ); Mon, 26 Sep 2022 06:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236544AbiIZKsW (ORCPT ); Mon, 26 Sep 2022 06:48: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 9C48857255; Mon, 26 Sep 2022 03:26: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 CD406B802C5; Mon, 26 Sep 2022 10:26:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21CEDC433D7; Mon, 26 Sep 2022 10:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187961; bh=dufonf4R35DJKo/jPWcMKghv7Zd7OMUYJ1IDMfRbh6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TcnMzeTmmZTdxtwBqjV9irVSyaLd57+DICcZxQIbnREbi4HqNQwbClW1Ho4nDEau3 5Zop40ah+dF+I4OhFjoM7+q17MXfyaL9SizgM66svrrLdODgrzqeCtaWkXpYVkuuuu SqGb2OoX4PL5NNC1EvzUN2tIsggggSByAuRA9Ck0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Brian Foster , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 117/120] xfs: split the sunit parameter update into two parts Date: Mon, 26 Sep 2022 12:12:30 +0200 Message-Id: <20220926100755.208230523@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" commit 4f5b1b3a8fa07dc8ecedfaf539b3deed8931a73e upstream. If the administrator provided a sunit=3D mount option, we need to validate the raw parameter, convert the mount option units (512b blocks) into the internal unit (fs blocks), and then validate that the (now cooked) parameter doesn't screw anything up on disk. The incore inode geometry computation can depend on the new sunit option, but a subsequent patch will make validating the cooked value depends on the computed inode geometry, so break the sunit update into two steps. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/xfs_mount.c | 123 +++++++++++++++++++++++++++++++-----------------= ----- 1 file changed, 72 insertions(+), 51 deletions(-) --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -365,66 +365,76 @@ release_buf: } =20 /* - * Update alignment values based on mount options and sb values + * If we were provided with new sunit/swidth values as mount options, make= sure + * that they pass basic alignment and superblock feature checks, and conve= rt + * them into the same units (FSB) that everything else expects. This step + * /must/ be done before computing the inode geometry. */ STATIC int -xfs_update_alignment(xfs_mount_t *mp) +xfs_validate_new_dalign( + struct xfs_mount *mp) { - xfs_sb_t *sbp =3D &(mp->m_sb); + if (mp->m_dalign =3D=3D 0) + return 0; =20 - if (mp->m_dalign) { + /* + * If stripe unit and stripe width are not multiples + * of the fs blocksize turn off alignment. + */ + if ((BBTOB(mp->m_dalign) & mp->m_blockmask) || + (BBTOB(mp->m_swidth) & mp->m_blockmask)) { + xfs_warn(mp, + "alignment check failed: sunit/swidth vs. blocksize(%d)", + mp->m_sb.sb_blocksize); + return -EINVAL; + } else { /* - * If stripe unit and stripe width are not multiples - * of the fs blocksize turn off alignment. + * Convert the stripe unit and width to FSBs. */ - if ((BBTOB(mp->m_dalign) & mp->m_blockmask) || - (BBTOB(mp->m_swidth) & mp->m_blockmask)) { + mp->m_dalign =3D XFS_BB_TO_FSBT(mp, mp->m_dalign); + if (mp->m_dalign && (mp->m_sb.sb_agblocks % mp->m_dalign)) { xfs_warn(mp, - "alignment check failed: sunit/swidth vs. blocksize(%d)", - sbp->sb_blocksize); + "alignment check failed: sunit/swidth vs. agsize(%d)", + mp->m_sb.sb_agblocks); return -EINVAL; - } else { - /* - * Convert the stripe unit and width to FSBs. - */ - mp->m_dalign =3D XFS_BB_TO_FSBT(mp, mp->m_dalign); - if (mp->m_dalign && (sbp->sb_agblocks % mp->m_dalign)) { - xfs_warn(mp, - "alignment check failed: sunit/swidth vs. agsize(%d)", - sbp->sb_agblocks); - return -EINVAL; - } else if (mp->m_dalign) { - mp->m_swidth =3D XFS_BB_TO_FSBT(mp, mp->m_swidth); - } else { - xfs_warn(mp, - "alignment check failed: sunit(%d) less than bsize(%d)", - mp->m_dalign, sbp->sb_blocksize); - return -EINVAL; - } - } - - /* - * Update superblock with new values - * and log changes - */ - if (xfs_sb_version_hasdalign(sbp)) { - if (sbp->sb_unit !=3D mp->m_dalign) { - sbp->sb_unit =3D mp->m_dalign; - mp->m_update_sb =3D true; - } - if (sbp->sb_width !=3D mp->m_swidth) { - sbp->sb_width =3D mp->m_swidth; - mp->m_update_sb =3D true; - } + } else if (mp->m_dalign) { + mp->m_swidth =3D XFS_BB_TO_FSBT(mp, mp->m_swidth); } else { xfs_warn(mp, - "cannot change alignment: superblock does not support data alignment"); + "alignment check failed: sunit(%d) less than bsize(%d)", + mp->m_dalign, mp->m_sb.sb_blocksize); return -EINVAL; } + } + + if (!xfs_sb_version_hasdalign(&mp->m_sb)) { + xfs_warn(mp, +"cannot change alignment: superblock does not support data alignment"); + return -EINVAL; + } + + return 0; +} + +/* Update alignment values based on mount options and sb values. */ +STATIC int +xfs_update_alignment( + struct xfs_mount *mp) +{ + struct xfs_sb *sbp =3D &mp->m_sb; + + if (mp->m_dalign) { + if (sbp->sb_unit =3D=3D mp->m_dalign && + sbp->sb_width =3D=3D mp->m_swidth) + return 0; + + sbp->sb_unit =3D mp->m_dalign; + sbp->sb_width =3D mp->m_swidth; + mp->m_update_sb =3D true; } else if ((mp->m_flags & XFS_MOUNT_NOALIGN) !=3D XFS_MOUNT_NOALIGN && xfs_sb_version_hasdalign(&mp->m_sb)) { - mp->m_dalign =3D sbp->sb_unit; - mp->m_swidth =3D sbp->sb_width; + mp->m_dalign =3D sbp->sb_unit; + mp->m_swidth =3D sbp->sb_width; } =20 return 0; @@ -692,12 +702,12 @@ xfs_mountfs( } =20 /* - * Check if sb_agblocks is aligned at stripe boundary - * If sb_agblocks is NOT aligned turn off m_dalign since - * allocator alignment is within an ag, therefore ag has - * to be aligned at stripe boundary. + * If we were given new sunit/swidth options, do some basic validation + * checks and convert the incore dalign and swidth values to the + * same units (FSB) that everything else uses. This /must/ happen + * before computing the inode geometry. */ - error =3D xfs_update_alignment(mp); + error =3D xfs_validate_new_dalign(mp); if (error) goto out; =20 @@ -708,6 +718,17 @@ xfs_mountfs( xfs_rmapbt_compute_maxlevels(mp); xfs_refcountbt_compute_maxlevels(mp); =20 + /* + * Check if sb_agblocks is aligned at stripe boundary. If sb_agblocks + * is NOT aligned turn off m_dalign since allocator alignment is within + * an ag, therefore ag has to be aligned at stripe boundary. Note that + * we must compute the free space and rmap btree geometry before doing + * this. + */ + error =3D xfs_update_alignment(mp); + if (error) + goto out; + /* enable fail_at_unmount as default */ mp->m_fail_unmount =3D true; From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9141DC32771 for ; Mon, 26 Sep 2022 10:50:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236444AbiIZKuk (ORCPT ); Mon, 26 Sep 2022 06:50:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231396AbiIZKrF (ORCPT ); Mon, 26 Sep 2022 06:47: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 D18C257543; Mon, 26 Sep 2022 03:26: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 EAE1AB80835; Mon, 26 Sep 2022 10:26:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3359AC433D7; Mon, 26 Sep 2022 10:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187964; bh=WgGXi2sDnorIfeZ/f8KhMyyqHF6msGVA4lDb8KE7coI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qm3so1UYUMA/xXQeXulDKmERslcCHCja4KLRZ7PROhwSeliWAHTfFBXVcD9z5dx9Z T24ylo54ad/26xeodhNK5Sx7UmeAzPmF+etmc5IBdkJ/5RR54LnEmSQeicskfGtEfF RHIsw19ps4jM2ONUyKHGRJ3GCDEvPeJh5LQrM9BA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Lyakas , "Darrick J. Wong" , Brian Foster , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 118/120] xfs: dont commit sunit/swidth updates to disk if that would cause repair failures Date: Mon, 26 Sep 2022 12:12:31 +0200 Message-Id: <20220926100755.237627793@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" commit 13eaec4b2adf2657b8167b67e27c97cc7314d923 upstream. Alex Lyakas reported[1] that mounting an xfs filesystem with new sunit and swidth values could cause xfs_repair to fail loudly. The problem here is that repair calculates the where mkfs should have allocated the root inode, based on the superblock geometry. The allocation decisions depend on sunit, which means that we really can't go updating sunit if it would lead to a subsequent repair failure on an otherwise correct filesystem. Port from xfs_repair some code that computes the location of the root inode and teach mount to skip the ondisk update if it would cause problems for repair. Along the way we'll update the documentation, provide a function for computing the minimum AGFL size instead of open-coding it, and cut down some indenting in the mount code. Note that we allow the mount to proceed (and new allocations will reflect this new geometry) because we've never screened this kind of thing before. We'll have to wait for a new future incompat feature to enforce correct behavior, alas. Note that the geometry reporting always uses the superblock values, not the incore ones, so that is what xfs_info and xfs_growfs will report. [1] https://lore.kernel.org/linux-xfs/20191125130744.GA44777@bfoster/T/#m00= f9594b511e076e2fcdd489d78bc30216d72a7d Reported-by: Alex Lyakas Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/libxfs/xfs_ialloc.c | 64 ++++++++++++++++++++++++++++++++++++++++= +++++ fs/xfs/libxfs/xfs_ialloc.h | 1=20 fs/xfs/xfs_mount.c | 45 ++++++++++++++++++++++++++++++- fs/xfs/xfs_trace.h | 21 ++++++++++++++ 4 files changed, 130 insertions(+), 1 deletion(-) --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c @@ -2854,3 +2854,67 @@ xfs_ialloc_setup_geometry( else igeo->ialloc_align =3D 0; } + +/* Compute the location of the root directory inode that is laid out by mk= fs. */ +xfs_ino_t +xfs_ialloc_calc_rootino( + struct xfs_mount *mp, + int sunit) +{ + struct xfs_ino_geometry *igeo =3D M_IGEO(mp); + xfs_agblock_t first_bno; + + /* + * Pre-calculate the geometry of AG 0. We know what it looks like + * because libxfs knows how to create allocation groups now. + * + * first_bno is the first block in which mkfs could possibly have + * allocated the root directory inode, once we factor in the metadata + * that mkfs formats before it. Namely, the four AG headers... + */ + first_bno =3D howmany(4 * mp->m_sb.sb_sectsize, mp->m_sb.sb_blocksize); + + /* ...the two free space btree roots... */ + first_bno +=3D 2; + + /* ...the inode btree root... */ + first_bno +=3D 1; + + /* ...the initial AGFL... */ + first_bno +=3D xfs_alloc_min_freelist(mp, NULL); + + /* ...the free inode btree root... */ + if (xfs_sb_version_hasfinobt(&mp->m_sb)) + first_bno++; + + /* ...the reverse mapping btree root... */ + if (xfs_sb_version_hasrmapbt(&mp->m_sb)) + first_bno++; + + /* ...the reference count btree... */ + if (xfs_sb_version_hasreflink(&mp->m_sb)) + first_bno++; + + /* + * ...and the log, if it is allocated in the first allocation group. + * + * This can happen with filesystems that only have a single + * allocation group, or very odd geometries created by old mkfs + * versions on very small filesystems. + */ + if (mp->m_sb.sb_logstart && + XFS_FSB_TO_AGNO(mp, mp->m_sb.sb_logstart) =3D=3D 0) + first_bno +=3D mp->m_sb.sb_logblocks; + + /* + * Now round first_bno up to whatever allocation alignment is given + * by the filesystem or was passed in. + */ + if (xfs_sb_version_hasdalign(&mp->m_sb) && igeo->ialloc_align > 0) + first_bno =3D roundup(first_bno, sunit); + else if (xfs_sb_version_hasalign(&mp->m_sb) && + mp->m_sb.sb_inoalignmt > 1) + first_bno =3D roundup(first_bno, mp->m_sb.sb_inoalignmt); + + return XFS_AGINO_TO_INO(mp, 0, XFS_AGB_TO_AGINO(mp, first_bno)); +} --- a/fs/xfs/libxfs/xfs_ialloc.h +++ b/fs/xfs/libxfs/xfs_ialloc.h @@ -152,5 +152,6 @@ int xfs_inobt_insert_rec(struct xfs_btre =20 int xfs_ialloc_cluster_alignment(struct xfs_mount *mp); void xfs_ialloc_setup_geometry(struct xfs_mount *mp); +xfs_ino_t xfs_ialloc_calc_rootino(struct xfs_mount *mp, int sunit); =20 #endif /* __XFS_IALLOC_H__ */ --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -31,7 +31,7 @@ #include "xfs_reflink.h" #include "xfs_extent_busy.h" #include "xfs_health.h" - +#include "xfs_trace.h" =20 static DEFINE_MUTEX(xfs_uuid_table_mutex); static int xfs_uuid_table_size; @@ -365,6 +365,42 @@ release_buf: } =20 /* + * If the sunit/swidth change would move the precomputed root inode value,= we + * must reject the ondisk change because repair will stumble over that. + * However, we allow the mount to proceed because we never rejected this + * combination before. Returns true to update the sb, false otherwise. + */ +static inline int +xfs_check_new_dalign( + struct xfs_mount *mp, + int new_dalign, + bool *update_sb) +{ + struct xfs_sb *sbp =3D &mp->m_sb; + xfs_ino_t calc_ino; + + calc_ino =3D xfs_ialloc_calc_rootino(mp, new_dalign); + trace_xfs_check_new_dalign(mp, new_dalign, calc_ino); + + if (sbp->sb_rootino =3D=3D calc_ino) { + *update_sb =3D true; + return 0; + } + + xfs_warn(mp, +"Cannot change stripe alignment; would require moving root inode."); + + /* + * XXX: Next time we add a new incompat feature, this should start + * returning -EINVAL to fail the mount. Until then, spit out a warning + * that we're ignoring the administrator's instructions. + */ + xfs_warn(mp, "Skipping superblock stripe alignment update."); + *update_sb =3D false; + return 0; +} + +/* * If we were provided with new sunit/swidth values as mount options, make= sure * that they pass basic alignment and superblock feature checks, and conve= rt * them into the same units (FSB) that everything else expects. This step @@ -424,10 +460,17 @@ xfs_update_alignment( struct xfs_sb *sbp =3D &mp->m_sb; =20 if (mp->m_dalign) { + bool update_sb; + int error; + if (sbp->sb_unit =3D=3D mp->m_dalign && sbp->sb_width =3D=3D mp->m_swidth) return 0; =20 + error =3D xfs_check_new_dalign(mp, mp->m_dalign, &update_sb); + if (error || !update_sb) + return error; + sbp->sb_unit =3D mp->m_dalign; sbp->sb_width =3D mp->m_swidth; mp->m_update_sb =3D true; --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h @@ -3609,6 +3609,27 @@ DEFINE_KMEM_EVENT(kmem_alloc_large); DEFINE_KMEM_EVENT(kmem_realloc); DEFINE_KMEM_EVENT(kmem_zone_alloc); =20 +TRACE_EVENT(xfs_check_new_dalign, + TP_PROTO(struct xfs_mount *mp, int new_dalign, xfs_ino_t calc_rootino), + TP_ARGS(mp, new_dalign, calc_rootino), + TP_STRUCT__entry( + __field(dev_t, dev) + __field(int, new_dalign) + __field(xfs_ino_t, sb_rootino) + __field(xfs_ino_t, calc_rootino) + ), + TP_fast_assign( + __entry->dev =3D mp->m_super->s_dev; + __entry->new_dalign =3D new_dalign; + __entry->sb_rootino =3D mp->m_sb.sb_rootino; + __entry->calc_rootino =3D calc_rootino; + ), + TP_printk("dev %d:%d new_dalign %d sb_rootino %llu calc_rootino %llu", + MAJOR(__entry->dev), MINOR(__entry->dev), + __entry->new_dalign, __entry->sb_rootino, + __entry->calc_rootino) +) + #endif /* _TRACE_XFS_H */ =20 #undef TRACE_INCLUDE_PATH From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73E08C32771 for ; Mon, 26 Sep 2022 10:50:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236541AbiIZKuo (ORCPT ); Mon, 26 Sep 2022 06:50:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234288AbiIZKrM (ORCPT ); Mon, 26 Sep 2022 06:47: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 5EAD856B8E; Mon, 26 Sep 2022 03:26: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 3632E60B5E; Mon, 26 Sep 2022 10:26:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44BB3C43143; Mon, 26 Sep 2022 10:26:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187967; bh=6/Y2u1ZYrdILy+QEFLEQf4SbkrYgHQ3YFEoUOqGIzOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tgqyu0CH0dIVlDi+re2+7dREnZVjORLlVntU34V/2MHb6r5CWgbxW4sOY3RKmFnwe NsjFD0dhlYuga+qDeLqg7+w3nbos9vhTvYmBaMg84QLqCJwtWywdzQnaighWcqAtO8 YXi2T4HEQZRuC5FC+YQ7ogj6DG1PvJsLGtHErKTg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, wenli xie , "Darrick J. Wong" , Brian Foster , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 119/120] xfs: fix an ABBA deadlock in xfs_rename Date: Mon, 26 Sep 2022 12:12:32 +0200 Message-Id: <20220926100755.268275705@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" commit 6da1b4b1ab36d80a3994fd4811c8381de10af604 upstream. When overlayfs is running on top of xfs and the user unlinks a file in the overlay, overlayfs will create a whiteout inode and ask xfs to "rename" the whiteout file atop the one being unlinked. If the file being unlinked loses its one nlink, we then have to put the inode on the unlinked list. This requires us to grab the AGI buffer of the whiteout inode to take it off the unlinked list (which is where whiteouts are created) and to grab the AGI buffer of the file being deleted. If the whiteout was created in a higher numbered AG than the file being deleted, we'll lock the AGIs in the wrong order and deadlock. Therefore, grab all the AGI locks we think we'll need ahead of time, and in order of increasing AG number per the locking rules. Reported-by: wenli xie Fixes: 93597ae8dac0 ("xfs: Fix deadlock between AGI and AGF when target_ip = exists in xfs_rename()") Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/libxfs/xfs_dir2.h | 2 -- fs/xfs/libxfs/xfs_dir2_sf.c | 2 +- fs/xfs/xfs_inode.c | 42 +++++++++++++++++++++++++--------------= --- 3 files changed, 26 insertions(+), 20 deletions(-) --- a/fs/xfs/libxfs/xfs_dir2.h +++ b/fs/xfs/libxfs/xfs_dir2.h @@ -124,8 +124,6 @@ extern int xfs_dir_lookup(struct xfs_tra extern int xfs_dir_removename(struct xfs_trans *tp, struct xfs_inode *dp, struct xfs_name *name, xfs_ino_t ino, xfs_extlen_t tot); -extern bool xfs_dir2_sf_replace_needblock(struct xfs_inode *dp, - xfs_ino_t inum); extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp, struct xfs_name *name, xfs_ino_t inum, xfs_extlen_t tot); --- a/fs/xfs/libxfs/xfs_dir2_sf.c +++ b/fs/xfs/libxfs/xfs_dir2_sf.c @@ -947,7 +947,7 @@ xfs_dir2_sf_removename( /* * Check whether the sf dir replace operation need more blocks. */ -bool +static bool xfs_dir2_sf_replace_needblock( struct xfs_inode *dp, xfs_ino_t inum) --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -3224,7 +3224,7 @@ xfs_rename( struct xfs_trans *tp; struct xfs_inode *wip =3D NULL; /* whiteout inode */ struct xfs_inode *inodes[__XFS_SORT_INODES]; - struct xfs_buf *agibp; + int i; int num_inodes =3D __XFS_SORT_INODES; bool new_parent =3D (src_dp !=3D target_dp); bool src_is_directory =3D S_ISDIR(VFS_I(src_ip)->i_mode); @@ -3337,6 +3337,30 @@ xfs_rename( } =20 /* + * Lock the AGI buffers we need to handle bumping the nlink of the + * whiteout inode off the unlinked list and to handle dropping the + * nlink of the target inode. Per locking order rules, do this in + * increasing AG order and before directory block allocation tries to + * grab AGFs because we grab AGIs before AGFs. + * + * The (vfs) caller must ensure that if src is a directory then + * target_ip is either null or an empty directory. + */ + for (i =3D 0; i < num_inodes && inodes[i] !=3D NULL; i++) { + if (inodes[i] =3D=3D wip || + (inodes[i] =3D=3D target_ip && + (VFS_I(target_ip)->i_nlink =3D=3D 1 || src_is_directory))) { + struct xfs_buf *bp; + xfs_agnumber_t agno; + + agno =3D XFS_INO_TO_AGNO(mp, inodes[i]->i_ino); + error =3D xfs_read_agi(mp, tp, agno, &bp); + if (error) + goto out_trans_cancel; + } + } + + /* * Directory entry creation below may acquire the AGF. Remove * the whiteout from the unlinked list first to preserve correct * AGI/AGF locking order. This dirties the transaction so failures @@ -3389,22 +3413,6 @@ xfs_rename( * In case there is already an entry with the same * name at the destination directory, remove it first. */ - - /* - * Check whether the replace operation will need to allocate - * blocks. This happens when the shortform directory lacks - * space and we have to convert it to a block format directory. - * When more blocks are necessary, we must lock the AGI first - * to preserve locking order (AGI -> AGF). - */ - if (xfs_dir2_sf_replace_needblock(target_dp, src_ip->i_ino)) { - error =3D xfs_read_agi(mp, tp, - XFS_INO_TO_AGNO(mp, target_ip->i_ino), - &agibp); - if (error) - goto out_trans_cancel; - } - error =3D xfs_dir_replace(tp, target_dp, target_name, src_ip->i_ino, spaceres); if (error) From nobody Thu Apr 2 11:39:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4735EC07E9D for ; Mon, 26 Sep 2022 10:51:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236642AbiIZKvK (ORCPT ); Mon, 26 Sep 2022 06:51:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236549AbiIZKs2 (ORCPT ); Mon, 26 Sep 2022 06:48: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 67F1E57247; Mon, 26 Sep 2022 03:26: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 C605DB80835; Mon, 26 Sep 2022 10:26:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35C44C433D6; Mon, 26 Sep 2022 10:26:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187970; bh=LacKJfDWzKRxxj1RLVDo37EiLjYds3xTT3p6tbr1By4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NcvKMdaZsuPyQgglxYCKoU7mcupVHTBYtgBqYILWgOEeUJjPsqOdKmkSw/B+jbvZA cUed0gj6LYBql5wxPXRbJQjquyCqiVU0us6mPnmdpF0u3ss8jv4gIY78YXj8CEevaI OiLwF7t/63VEx4Fc6LmDpgpKTmpzWaQM7pPVVA1Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Dave Chinner , Christoph Hellwig , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 120/120] xfs: fix use-after-free when aborting corrupt attr inactivation Date: Mon, 26 Sep 2022 12:12:33 +0200 Message-Id: <20220926100755.310790013@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" commit 496b9bcd62b0b3a160be61e3265a086f97adcbd3 upstream. Log the corrupt buffer before we release the buffer. Fixes: a5155b870d687 ("xfs: always log corruption errors") Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Reviewed-by: Christoph Hellwig Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman Acked-by: Marc Zyngier Reported-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/xfs/xfs_attr_inactive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/xfs/xfs_attr_inactive.c +++ b/fs/xfs/xfs_attr_inactive.c @@ -209,8 +209,8 @@ xfs_attr3_node_inactive( * Since this code is recursive (gasp!) we must protect ourselves. */ if (level > XFS_DA_NODE_MAXDEPTH) { - xfs_trans_brelse(*trans, bp); /* no locks for later trans */ xfs_buf_corruption_error(bp); + xfs_trans_brelse(*trans, bp); /* no locks for later trans */ return -EFSCORRUPTED; }