From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A73EEC433F5 for ; Mon, 28 Feb 2022 17:25:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233850AbiB1R0f (ORCPT ); Mon, 28 Feb 2022 12:26:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233602AbiB1R0Z (ORCPT ); Mon, 28 Feb 2022 12:26:25 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29FFF75E6B; Mon, 28 Feb 2022 09:25:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CD25DB815A5; Mon, 28 Feb 2022 17:25:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11042C340F4; Mon, 28 Feb 2022 17:25:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069143; bh=Vv7wFnUGlLa3rURQC2K9jde3PYf5CPhS7IZInxX0iB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mYck5cBhKsgarVNK0pTvm2l+/iT7xQl5uEjfKIuvR/78zCOOtEcL+TzMQKdGCFHhF nkScTEPDTtu0uT66ddNWeQq6DQ+4DstVN0DCmnYDj1d0g+HlT7lZ0LW5Dl+fjm6SbJ SyE1aW8qd48oMSJopETavQkRTC34SyR/OMgtCxok= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, david regan , Florian Fainelli , Miquel Raynal Subject: [PATCH 4.9 01/29] mtd: rawnand: brcmnand: Fixed incorrect sub-page ECC status Date: Mon, 28 Feb 2022 18:23:28 +0100 Message-Id: <20220228172141.922269337@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: david regan commit 36415a7964711822e63695ea67fede63979054d9 upstream. The brcmnand driver contains a bug in which if a page (example 2k byte) is read from the parallel/ONFI NAND and within that page a subpage (512 byte) has correctable errors which is followed by a subpage with uncorrectable errors, the page read will return the wrong status of correctable (as opposed to the actual status of uncorrectable.) The bug is in function brcmnand_read_by_pio where there is a check for uncorrectable bits which will be preempted if a previous status for correctable bits is detected. The fix is to stop checking for bad bits only if we already have a bad bits status. Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB= NAND controller") Signed-off-by: david regan Reviewed-by: Florian Fainelli Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/trinity-478e0c09-9134-40e8-8f8c-31c= 371225eda-1643237024774@3c-app-mailcom-lxa02 [florian: make patch apply to 4.14, file was renamed] Signed-off-by: Florian Fainelli Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/mtd/nand/brcmnand/brcmnand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mtd/nand/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/brcmnand/brcmnand.c @@ -1637,7 +1637,7 @@ static int brcmnand_read_by_pio(struct m mtd->oobsize / trans, host->hwcfg.sector_size_1k); =20 - if (!ret) { + if (ret !=3D -EBADMSG) { *err_addr =3D brcmnand_read_reg(ctrl, BRCMNAND_UNCORR_ADDR) | ((u64)(brcmnand_read_reg(ctrl, From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D011C433EF for ; Mon, 28 Feb 2022 17:26:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234518AbiB1R1a (ORCPT ); Mon, 28 Feb 2022 12:27:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234358AbiB1R1G (ORCPT ); Mon, 28 Feb 2022 12:27:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5FDC85944; Mon, 28 Feb 2022 09:26:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C63DF612FA; Mon, 28 Feb 2022 17:26:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF1F8C340E7; Mon, 28 Feb 2022 17:26:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069174; bh=2dY4FaV3w1LznUAzAZ1N3zjyDTZAnC9WJ/7XnFq2k7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iRyyDxf+/QXo6icIP0uaJ9/utwKTjUYrc/Z3LjiYDor4T4Z96nEgjoXBbNMEE4Asc 4SRNnD0EfB9yD/9rjjX3ZqKe6apYfXXikRyCNqarZZ8nO5GitdO9662NZgizwg4FtC XcXehC/G3V+v2YZwMQm4NIla6kwtzDDU/OtrZsf4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+1e3ea63db39f2b4440e0@syzkaller.appspotmail.com, Stefano Garzarella , Jason Wang , "David S. Miller" , syzbot+3140b17cb44a7b174008@syzkaller.appspotmail.com Subject: [PATCH 4.9 02/29] vhost/vsock: dont check owner in vhost_vsock_stop() while releasing Date: Mon, 28 Feb 2022 18:23:29 +0100 Message-Id: <20220228172141.981731348@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stefano Garzarella commit a58da53ffd70294ebea8ecd0eb45fd0d74add9f9 upstream. vhost_vsock_stop() calls vhost_dev_check_owner() to check the device ownership. It expects current->mm to be valid. vhost_vsock_stop() is also called by vhost_vsock_dev_release() when the user has not done close(), so when we are in do_exit(). In this case current->mm is invalid and we're releasing the device, so we should clean it anyway. Let's check the owner only when vhost_vsock_stop() is called by an ioctl. When invoked from release we can not fail so we don't check return code of vhost_vsock_stop(). We need to stop vsock even if it's not the owner. Fixes: 433fc58e6bf2 ("VSOCK: Introduce vhost_vsock.ko") Cc: stable@vger.kernel.org Reported-by: syzbot+1e3ea63db39f2b4440e0@syzkaller.appspotmail.com Reported-and-tested-by: syzbot+3140b17cb44a7b174008@syzkaller.appspotmail.c= om Signed-off-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/vhost/vsock.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -484,16 +484,18 @@ err: return ret; } =20 -static int vhost_vsock_stop(struct vhost_vsock *vsock) +static int vhost_vsock_stop(struct vhost_vsock *vsock, bool check_owner) { size_t i; - int ret; + int ret =3D 0; =20 mutex_lock(&vsock->dev.mutex); =20 - ret =3D vhost_dev_check_owner(&vsock->dev); - if (ret) - goto err; + if (check_owner) { + ret =3D vhost_dev_check_owner(&vsock->dev); + if (ret) + goto err; + } =20 for (i =3D 0; i < ARRAY_SIZE(vsock->vqs); i++) { struct vhost_virtqueue *vq =3D &vsock->vqs[i]; @@ -611,7 +613,12 @@ static int vhost_vsock_dev_release(struc * inefficient. Room for improvement here. */ vsock_for_each_connected_socket(vhost_vsock_reset_orphans); =20 - vhost_vsock_stop(vsock); + /* Don't check the owner, because we are in the release path, so we + * need to stop the vsock device in any case. + * vhost_vsock_stop() can not fail in this case, so we don't need to + * check the return code. + */ + vhost_vsock_stop(vsock, false); vhost_vsock_flush(vsock); vhost_dev_stop(&vsock->dev); =20 @@ -709,7 +716,7 @@ static long vhost_vsock_dev_ioctl(struct if (start) return vhost_vsock_start(vsock); else - return vhost_vsock_stop(vsock); + return vhost_vsock_stop(vsock, true); case VHOST_GET_FEATURES: features =3D VHOST_VSOCK_FEATURES; if (copy_to_user(argp, &features, sizeof(features))) From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24C0DC433EF for ; Mon, 28 Feb 2022 17:26:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232280AbiB1R1f (ORCPT ); Mon, 28 Feb 2022 12:27:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234856AbiB1R1P (ORCPT ); Mon, 28 Feb 2022 12:27:15 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D06788B14; Mon, 28 Feb 2022 09:26:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3895E6135F; Mon, 28 Feb 2022 17:26:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F539C340E7; Mon, 28 Feb 2022 17:26:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069179; bh=IXCkHH0HWeISy7aMM/CGHlDw/KGsTSjG8aYHNGerVpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RBsPHu6ylAbhkypdXdx8EWWK3ix6dodfr9r/ryb1fAgrxLnFYx9U5kwlToaloiYut mtZ4uOizuneGALluLHPH76B4g7y6BEjL6FVDpKCVb4GmoAd+/ax/fn4Uhq+6toy5eO L+JXj2p6VBF+cV7i81T5/WX7xDWni3sUwREPv3ew= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 4.9 03/29] parisc/unaligned: Fix fldd and fstd unaligned handlers on 32-bit kernel Date: Mon, 28 Feb 2022 18:23:30 +0100 Message-Id: <20220228172142.042888559@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Helge Deller commit dd2288f4a020d693360e3e8d72f8b9d9c25f5ef6 upstream. Usually the kernel provides fixup routines to emulate the fldd and fstd floating-point instructions if they load or store 8-byte from/to a not natuarally aligned memory location. On a 32-bit kernel I noticed that those unaligned handlers didn't worked and instead the application got a SEGV. While checking the code I found two problems: First, the OPCODE_FLDD_L and OPCODE_FSTD_L cases were ifdef'ed out by the CONFIG_PA20 option, and as such those weren't built on a pure 32-bit kernel. This is now fixed by moving the CONFIG_PA20 #ifdef to prevent the compilati= on of OPCODE_LDD_L and OPCODE_FSTD_L only, and handling the fldd and fstd instructions. The second problem are two bugs in the 32-bit inline assembly code, where t= he wrong registers where used. The calculation of the natural alignment used %2 (vall) instead of %3 (ior), and the first word was stored back to address %1 (valh) instead of %3 (ior). Signed-off-by: Helge Deller Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- arch/parisc/kernel/unaligned.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/arch/parisc/kernel/unaligned.c +++ b/arch/parisc/kernel/unaligned.c @@ -410,7 +410,7 @@ static int emulate_std(struct pt_regs *r __asm__ __volatile__ ( " mtsp %4, %%sr1\n" " zdep %2, 29, 2, %%r19\n" -" dep %%r0, 31, 2, %2\n" +" dep %%r0, 31, 2, %3\n" " mtsar %%r19\n" " zvdepi -2, 32, %%r19\n" "1: ldw 0(%%sr1,%3),%%r20\n" @@ -422,7 +422,7 @@ static int emulate_std(struct pt_regs *r " andcm %%r21, %%r19, %%r21\n" " or %1, %%r20, %1\n" " or %2, %%r21, %2\n" -"3: stw %1,0(%%sr1,%1)\n" +"3: stw %1,0(%%sr1,%3)\n" "4: stw %%r1,4(%%sr1,%3)\n" "5: stw %2,8(%%sr1,%3)\n" " copy %%r0, %0\n" @@ -610,7 +610,6 @@ void handle_unaligned(struct pt_regs *re ret =3D ERR_NOTHANDLED; /* "undefined", but lets kill them. */ break; } -#ifdef CONFIG_PA20 switch (regs->iir & OPCODE2_MASK) { case OPCODE_FLDD_L: @@ -621,14 +620,15 @@ void handle_unaligned(struct pt_regs *re flop=3D1; ret =3D emulate_std(regs, R2(regs->iir),1); break; +#ifdef CONFIG_PA20 case OPCODE_LDD_L: ret =3D emulate_ldd(regs, R2(regs->iir),0); break; case OPCODE_STD_L: ret =3D emulate_std(regs, R2(regs->iir),0); break; - } #endif + } switch (regs->iir & OPCODE3_MASK) { case OPCODE_FLDW_L: From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DEF7C433F5 for ; Mon, 28 Feb 2022 17:27:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233947AbiB1R1o (ORCPT ); Mon, 28 Feb 2022 12:27:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235027AbiB1R1Q (ORCPT ); Mon, 28 Feb 2022 12:27:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C1C6887A9; Mon, 28 Feb 2022 09:26:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AFF09B815AB; Mon, 28 Feb 2022 17:26:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A6C1C340E7; Mon, 28 Feb 2022 17:26:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069182; bh=pq8SgMVNtDsMfvtpp3fqPyWT0wvb7EsmmnLCVo4H+2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ojgrOGPOaFloVciYFrUOgdSUCSvsNkg2IfQlHzQ0SkXDwr9XVqs+EDTjCX/vURybc m7bAymKcwJot8d87E/wBJ+hw1vJffXS0a9UGq2ZvKdoXNGYKLGy9GoyqvAZ32A3G6C GmJ+PHOmELx5fN4hlanrejZWfhSncJ9lVv38Pp40= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 4.9 04/29] parisc/unaligned: Fix ldw() and stw() unalignment handlers Date: Mon, 28 Feb 2022 18:23:31 +0100 Message-Id: <20220228172142.101564583@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Helge Deller commit a97279836867b1cb50a3d4f0b1bf60e0abe6d46c upstream. Fix 3 bugs: a) emulate_stw() doesn't return the error code value, so faulting instructions are not reported and aborted. b) Tell emulate_ldw() to handle fldw_l as floating point instruction c) Tell emulate_ldw() to handle ldw_m as integer instruction Signed-off-by: Helge Deller Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- arch/parisc/kernel/unaligned.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/arch/parisc/kernel/unaligned.c +++ b/arch/parisc/kernel/unaligned.c @@ -353,7 +353,7 @@ static int emulate_stw(struct pt_regs *r : "r" (val), "r" (regs->ior), "r" (regs->isr) : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER ); =20 - return 0; + return ret; } static int emulate_std(struct pt_regs *regs, int frreg, int flop) { @@ -633,10 +633,10 @@ void handle_unaligned(struct pt_regs *re { case OPCODE_FLDW_L: flop=3D1; - ret =3D emulate_ldw(regs, R2(regs->iir),0); + ret =3D emulate_ldw(regs, R2(regs->iir), 1); break; case OPCODE_LDW_M: - ret =3D emulate_ldw(regs, R2(regs->iir),1); + ret =3D emulate_ldw(regs, R2(regs->iir), 0); break; =20 case OPCODE_FSTW_L: From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39A1FC433EF for ; Mon, 28 Feb 2022 17:27:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234194AbiB1R1j (ORCPT ); Mon, 28 Feb 2022 12:27:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235069AbiB1R1Q (ORCPT ); Mon, 28 Feb 2022 12:27:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21DE1888FC; Mon, 28 Feb 2022 09:26:26 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B046461372; Mon, 28 Feb 2022 17:26:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6E09C340E7; Mon, 28 Feb 2022 17:26:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069185; bh=OKLCEiZwuHmP1wazrd3ezQTU2hh10JgNSBjwTRVn3u4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nTEF6DVNLRB0YlU5OyCZOG061doqyEXo5A8lbVRXc9IaEj5C9mmlPyuqUHQWU3do+ l7dNQvi5cvQOP9WecKuEXRrVnHf7ncD8ddxZk4UJ9uKXltrQLeNyJaLe/LlA6+e26c mtD9zkO2UE377a7G3DCllduWVFynNQ6YB2gCVTmc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum , Grant Grundler , "David S. Miller" Subject: [PATCH 4.9 05/29] sr9700: sanity check for packet length Date: Mon, 28 Feb 2022 18:23:32 +0100 Message-Id: <20220228172142.178460748@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oliver Neukum commit e9da0b56fe27206b49f39805f7dcda8a89379062 upstream. A malicious device can leak heap data to user space providing bogus frame lengths. Introduce a sanity check. Signed-off-by: Oliver Neukum Reviewed-by: Grant Grundler Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/net/usb/sr9700.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/usb/sr9700.c +++ b/drivers/net/usb/sr9700.c @@ -409,7 +409,7 @@ static int sr9700_rx_fixup(struct usbnet /* ignore the CRC length */ len =3D (skb->data[1] | (skb->data[2] << 8)) - 4; =20 - if (len > ETH_FRAME_LEN) + if (len > ETH_FRAME_LEN || len > skb->len) return 0; =20 /* the last packet of current skb */ From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F73CC433EF for ; Mon, 28 Feb 2022 17:27:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235277AbiB1R1s (ORCPT ); Mon, 28 Feb 2022 12:27:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235124AbiB1R1R (ORCPT ); Mon, 28 Feb 2022 12:27:17 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D6A989309; Mon, 28 Feb 2022 09:26:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 68E8F61365; Mon, 28 Feb 2022 17:26:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D4E0C340E7; Mon, 28 Feb 2022 17:26:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069187; bh=1hGyolwMLVbFy5rQ8VkYCl7rOXKuk1PElccLrSmZjEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lVvdhSGS1BmZ1V08UubG34LtUPHOai/sVdkoAdJo/UXOQ1xq7rD9PifzT+Mg6Vig1 o92ZBeNupZcBReGqFv/xyk8JEQ4u2GBNjOKzPKxaJ/F7gRpe9XpR77KCzYmxy6ZQE7 Y5ENJAssc9DUFiE9+5Sc3l6qORvHY9cmNqHfGKcA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum , Ross Maynard , "David S. Miller" Subject: [PATCH 4.9 06/29] USB: zaurus: support another broken Zaurus Date: Mon, 28 Feb 2022 18:23:33 +0100 Message-Id: <20220228172142.239200816@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oliver Neukum commit 6605cc67ca18b9d583eb96e18a20f5f4e726103c upstream. This SL-6000 says Direct Line, not Ethernet v2: added Reporter and Link Signed-off-by: Oliver Neukum Reported-by: Ross Maynard Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D215361 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/net/usb/cdc_ether.c | 12 ++++++++++++ drivers/net/usb/zaurus.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c @@ -555,6 +555,11 @@ static const struct usb_device_id produc .bInterfaceSubClass =3D USB_CDC_SUBCLASS_ETHERNET, \ .bInterfaceProtocol =3D USB_CDC_PROTO_NONE =20 +#define ZAURUS_FAKE_INTERFACE \ + .bInterfaceClass =3D USB_CLASS_COMM, \ + .bInterfaceSubClass =3D USB_CDC_SUBCLASS_MDLM, \ + .bInterfaceProtocol =3D USB_CDC_PROTO_NONE + /* SA-1100 based Sharp Zaurus ("collie"), or compatible; * wire-incompatible with true CDC Ethernet implementations. * (And, it seems, needlessly so...) @@ -610,6 +615,13 @@ static const struct usb_device_id produc .driver_info =3D 0, }, { .match_flags =3D USB_DEVICE_ID_MATCH_INT_INFO + | USB_DEVICE_ID_MATCH_DEVICE, + .idVendor =3D 0x04DD, + .idProduct =3D 0x9032, /* SL-6000 */ + ZAURUS_FAKE_INTERFACE, + .driver_info =3D 0, +}, { + .match_flags =3D USB_DEVICE_ID_MATCH_INT_INFO | USB_DEVICE_ID_MATCH_DEVICE, .idVendor =3D 0x04DD, /* reported with some C860 units */ --- a/drivers/net/usb/zaurus.c +++ b/drivers/net/usb/zaurus.c @@ -268,6 +268,11 @@ static const struct usb_device_id produc .bInterfaceSubClass =3D USB_CDC_SUBCLASS_ETHERNET, \ .bInterfaceProtocol =3D USB_CDC_PROTO_NONE =20 +#define ZAURUS_FAKE_INTERFACE \ + .bInterfaceClass =3D USB_CLASS_COMM, \ + .bInterfaceSubClass =3D USB_CDC_SUBCLASS_MDLM, \ + .bInterfaceProtocol =3D USB_CDC_PROTO_NONE + /* SA-1100 based Sharp Zaurus ("collie"), or compatible. */ { .match_flags =3D USB_DEVICE_ID_MATCH_INT_INFO @@ -327,6 +332,13 @@ static const struct usb_device_id produc .driver_info =3D ZAURUS_PXA_INFO, }, { .match_flags =3D USB_DEVICE_ID_MATCH_INT_INFO + | USB_DEVICE_ID_MATCH_DEVICE, + .idVendor =3D 0x04DD, + .idProduct =3D 0x9032, /* SL-6000 */ + ZAURUS_FAKE_INTERFACE, + .driver_info =3D (unsigned long)&bogus_mdlm_info, +}, { + .match_flags =3D USB_DEVICE_ID_MATCH_INT_INFO | USB_DEVICE_ID_MATCH_DEVICE, .idVendor =3D 0x04DD, /* reported with some C860 units */ From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DDC0C4321E for ; Mon, 28 Feb 2022 17:27:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235467AbiB1R2V (ORCPT ); Mon, 28 Feb 2022 12:28:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235214AbiB1R1V (ORCPT ); Mon, 28 Feb 2022 12:27:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 127608931F; Mon, 28 Feb 2022 09:26:33 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BD983B815A9; Mon, 28 Feb 2022 17:26:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1ED65C340E7; Mon, 28 Feb 2022 17:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069190; bh=zZ6LiIMj7SqtEv2H37OOoIxckBagwGVvn0Vn+J1jCAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bN0mTtZCaEEDR79YuqQjSOGborQbQTPMwWUIzthgLihxWLuCdzRZFNZ/jENgdU6br HyQezyEjdQyBLch85vvWsaQXhTeELByHwfOv6Qnorpg7yYJ5TZsjEzRScSMY0d3GyZ Os01vF6JFxSeoIsg16Qd+2HiZFJcaVNuWcz52haU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Khoroshilov , Sudip Mukherjee Subject: [PATCH 4.9 07/29] serial: 8250: fix error handling in of_platform_serial_probe() Date: Mon, 28 Feb 2022 18:23:34 +0100 Message-Id: <20220228172142.301478056@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexey Khoroshilov commit fa9ba3acb557e444fe4a736ab654f0d0a0fbccde upstream. clk_disable_unprepare(info->clk) is missed in of_platform_serial_probe(), while irq_dispose_mapping(port->irq) is missed in of_platform_serial_setup(= ). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: Greg Kroah-Hartman [sudip: adjust context] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/tty/serial/8250/8250_of.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) --- a/drivers/tty/serial/8250/8250_of.c +++ b/drivers/tty/serial/8250/8250_of.c @@ -86,7 +86,7 @@ static int of_platform_serial_setup(stru ret =3D of_address_to_resource(np, 0, &resource); if (ret) { dev_warn(&ofdev->dev, "invalid address\n"); - goto out; + goto err_unprepare; } =20 spin_lock_init(&port->lock); @@ -132,7 +132,7 @@ static int of_platform_serial_setup(stru dev_warn(&ofdev->dev, "unsupported reg-io-width (%d)\n", prop); ret =3D -EINVAL; - goto out; + goto err_dispose; } } =20 @@ -162,7 +162,9 @@ static int of_platform_serial_setup(stru port->handle_irq =3D fsl8250_handle_irq; =20 return 0; -out: +err_dispose: + irq_dispose_mapping(port->irq); +err_unprepare: if (info->clk) clk_disable_unprepare(info->clk); return ret; @@ -194,7 +196,7 @@ static int of_platform_serial_probe(stru port_type =3D (unsigned long)match->data; ret =3D of_platform_serial_setup(ofdev, port_type, &port, info); if (ret) - goto out; + goto err_free; =20 switch (port_type) { case PORT_8250 ... PORT_MAX_8250: @@ -228,15 +230,18 @@ static int of_platform_serial_probe(stru break; } if (ret < 0) - goto out; + goto err_dispose; =20 info->type =3D port_type; info->line =3D ret; platform_set_drvdata(ofdev, info); return 0; -out: - kfree(info); +err_dispose: irq_dispose_mapping(port.irq); + if (info->clk) + clk_disable_unprepare(info->clk); +err_free: + kfree(info); return ret; } From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F264C4332F for ; Mon, 28 Feb 2022 17:27:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235015AbiB1R2O (ORCPT ); Mon, 28 Feb 2022 12:28:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234782AbiB1R1Y (ORCPT ); Mon, 28 Feb 2022 12:27:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C51B48933A; Mon, 28 Feb 2022 09:26:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 78BC7B815A5; Mon, 28 Feb 2022 17:26:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA748C340E7; Mon, 28 Feb 2022 17:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069193; bh=K+PT6vm5/bQVw4GG+yLjuM2W6nNLSsFbiAZp3tkB0Fo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lT6ikH5yX12EKeJEJyIf4dExuv3BRr3Ler5e6ZIAmtVsy/7Szt+CrFaN3k3akPWz2 QFGhR22BVJfWDuzfazL+PZlfLV84TUnJrBNiU+eyVincXkwcXxi7fH8o28Fh8ESbsw u13qEuml04NVIGkio4MxEIaIbLRPHK/dSVEyxJBQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , Sudip Mukherjee Subject: [PATCH 4.9 08/29] serial: 8250: of: Fix mapped region size when using reg-offset property Date: Mon, 28 Feb 2022 18:23:35 +0100 Message-Id: <20220228172142.363909142@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Hancock commit d06b1cf28297e27127d3da54753a3a01a2fa2f28 upstream. 8250_of supports a reg-offset property which is intended to handle cases where the device registers start at an offset inside the region of memory allocated to the device. The Xilinx 16550 UART, for which this support was initially added, requires this. However, the code did not adjust the overall size of the mapped region accordingly, causing the driver to request an area of memory past the end of the device's allocation. For example, if the UART was allocated an address of 0xb0130000, size of 0x10000 and reg-offset of 0x1000 in the device tree, the region of memory reserved was b0131000-b0140fff, which caused the driver for the region starting at b0140000 to fail to probe. Fix this by subtracting reg-offset from the mapped region size. Fixes: b912b5e2cfb3 ([POWERPC] Xilinx: of_serial support for Xilinx uart 16= 550.) Cc: stable Signed-off-by: Robert Hancock Link: https://lore.kernel.org/r/20220112194214.881844-1-robert.hancock@cali= an.com Signed-off-by: Greg Kroah-Hartman [sudip: adjust context] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/tty/serial/8250/8250_of.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/drivers/tty/serial/8250/8250_of.c +++ b/drivers/tty/serial/8250/8250_of.c @@ -94,8 +94,17 @@ static int of_platform_serial_setup(stru port->mapsize =3D resource_size(&resource); =20 /* Check for shifted address mapping */ - if (of_property_read_u32(np, "reg-offset", &prop) =3D=3D 0) + if (of_property_read_u32(np, "reg-offset", &prop) =3D=3D 0) { + if (prop >=3D port->mapsize) { + dev_warn(&ofdev->dev, "reg-offset %u exceeds region size %pa\n", + prop, &port->mapsize); + ret =3D -EINVAL; + goto err_unprepare; + } + port->mapbase +=3D prop; + port->mapsize -=3D prop; + } =20 /* Compatibility with the deprecated pxa driver and 8250_pxa drivers. */ if (of_device_is_compatible(np, "mrvl,mmp-uart")) From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C593C4332F for ; Mon, 28 Feb 2022 17:27:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235973AbiB1R2Y (ORCPT ); Mon, 28 Feb 2022 12:28:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235090AbiB1R11 (ORCPT ); Mon, 28 Feb 2022 12:27:27 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3C3185658; Mon, 28 Feb 2022 09:26:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5BF67B815B0; Mon, 28 Feb 2022 17:26:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACA05C340E7; Mon, 28 Feb 2022 17:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069196; bh=usIFlN/FEikYYvUp7TbxxzRds9hM5Or9jnjcluoau0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eczhViAfmNaTZKteWJzdNFsXTvHT5XASG2L3KcYG/qO8s/NgxPGRsIcpitMA9RB+d 5jWFvQZH4AF1BPRTpiRRkzyL4jEi9u0t3Pn+nbNWMP3fzXLme0tgdUlG0Ml0IBRePA 5CYfOf17o++x6M4944cGiacxTdmrgxwJeuUEqZPs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Jakub Kicinski Subject: [PATCH 4.9 09/29] net: __pskb_pull_tail() & pskb_carve_frag_list() drop_monitor friends Date: Mon, 28 Feb 2022 18:23:36 +0100 Message-Id: <20220228172142.423342346@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet commit ef527f968ae05c6717c39f49c8709a7e2c19183a upstream. Whenever one of these functions pull all data from an skb in a frag_list, use consume_skb() instead of kfree_skb() to avoid polluting drop monitoring. Fixes: 6fa01ccd8830 ("skbuff: Add pskb_extract() helper function") Signed-off-by: Eric Dumazet Link: https://lore.kernel.org/r/20220220154052.1308469-1-eric.dumazet@gmail= .com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- net/core/skbuff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -1716,7 +1716,7 @@ unsigned char *__pskb_pull_tail(struct s /* Free pulled out fragments. */ while ((list =3D skb_shinfo(skb)->frag_list) !=3D insp) { skb_shinfo(skb)->frag_list =3D list->next; - kfree_skb(list); + consume_skb(list); } /* And insert new clone at head. */ if (clone) { @@ -4951,7 +4951,7 @@ static int pskb_carve_frag_list(struct s /* Free pulled out fragments. */ while ((list =3D shinfo->frag_list) !=3D insp) { shinfo->frag_list =3D list->next; - kfree_skb(list); + consume_skb(list); } /* And insert new clone at head. */ if (clone) { From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1500C433F5 for ; Mon, 28 Feb 2022 17:26:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233851AbiB1R0j (ORCPT ); Mon, 28 Feb 2022 12:26:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233653AbiB1R02 (ORCPT ); Mon, 28 Feb 2022 12:26:28 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4DD476E04; Mon, 28 Feb 2022 09:25:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7DEB2B815AB; Mon, 28 Feb 2022 17:25:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9294C340F1; Mon, 28 Feb 2022 17:25:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069146; bh=yC33GZMrlqD0i2w93NF1iJJZDlo/CRXfu2IKUrbZvqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Biks0AlaBumy632OvNFKYRa6cjrhJFsvo0sKXYmisHB3I5LKg4BRXoiZZMJE7Rx6q J5rmufNbBUm0iaTD7AX1kZC+uZN0eptKHcB18aQGe29XGY9v70HTPNvihuamRl2CeZ ZPB/4ox7E8ZhmYFbjmpykQPjCyMx3CnQz3wPVByY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tao Liu , Willem de Bruijn , "David S. Miller" Subject: [PATCH 4.9 10/29] gso: do not skip outer ip header in case of ipip and net_failover Date: Mon, 28 Feb 2022 18:23:37 +0100 Message-Id: <20220228172142.482484537@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tao Liu commit cc20cced0598d9a5ff91ae4ab147b3b5e99ee819 upstream. We encounter a tcp drop issue in our cloud environment. Packet GROed in host forwards to a VM virtio_net nic with net_failover enabled. VM acts as a IPVS LB with ipip encapsulation. The full path like: host gro -> vm virtio_net rx -> net_failover rx -> ipvs fullnat -> ipip encap -> net_failover tx -> virtio_net tx When net_failover transmits a ipip pkt (gso_type =3D 0x0103, which means SKB_GSO_TCPV4, SKB_GSO_DODGY and SKB_GSO_IPXIP4), there is no gso did because it supports TSO and GSO_IPXIP4. But network_header points to inner ip header. Call Trace: tcp4_gso_segment ------> return NULL inet_gso_segment ------> inner iph, network_header points to ipip_gso_segment inet_gso_segment ------> outer iph skb_mac_gso_segment Afterwards virtio_net transmits the pkt, only inner ip header is modified. And the outer one just keeps unchanged. The pkt will be dropped in remote host. Call Trace: inet_gso_segment ------> inner iph, outer iph is skipped skb_mac_gso_segment __skb_gso_segment validate_xmit_skb validate_xmit_skb_list sch_direct_xmit __qdisc_run __dev_queue_xmit ------> virtio_net dev_hard_start_xmit __dev_queue_xmit ------> net_failover ip_finish_output2 ip_output iptunnel_xmit ip_tunnel_xmit ipip_tunnel_xmit ------> ipip dev_hard_start_xmit __dev_queue_xmit ip_finish_output2 ip_output ip_forward ip_rcv __netif_receive_skb_one_core netif_receive_skb_internal napi_gro_receive receive_buf virtnet_poll net_rx_action The root cause of this issue is specific with the rare combination of SKB_GSO_DODGY and a tunnel device that adds an SKB_GSO_ tunnel option. SKB_GSO_DODGY is set from external virtio_net. We need to reset network header when callbacks.gso_segment() returns NULL. This patch also includes ipv6_gso_segment(), considering SIT, etc. Fixes: cb32f511a70b ("ipip: add GSO/TSO support") Signed-off-by: Tao Liu Reviewed-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- net/ipv4/af_inet.c | 5 ++++- net/ipv6/ip6_offload.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1238,8 +1238,11 @@ struct sk_buff *inet_gso_segment(struct } =20 ops =3D rcu_dereference(inet_offloads[proto]); - if (likely(ops && ops->callbacks.gso_segment)) + if (likely(ops && ops->callbacks.gso_segment)) { segs =3D ops->callbacks.gso_segment(skb, features); + if (!segs) + skb->network_header =3D skb_mac_header(skb) + nhoff - skb->head; + } =20 if (IS_ERR_OR_NULL(segs)) goto out; --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c @@ -96,6 +96,8 @@ static struct sk_buff *ipv6_gso_segment( if (likely(ops && ops->callbacks.gso_segment)) { skb_reset_transport_header(skb); segs =3D ops->callbacks.gso_segment(skb, features); + if (!segs) + skb->network_header =3D skb_mac_header(skb) + nhoff - skb->head; } =20 if (IS_ERR_OR_NULL(segs)) From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48A94C433F5 for ; Mon, 28 Feb 2022 17:26:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234180AbiB1R0n (ORCPT ); Mon, 28 Feb 2022 12:26:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233854AbiB1R0f (ORCPT ); Mon, 28 Feb 2022 12:26:35 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC9C87EB0D; Mon, 28 Feb 2022 09:25:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8A65E61365; Mon, 28 Feb 2022 17:25:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C4F1C340E7; Mon, 28 Feb 2022 17:25:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069149; bh=S8+WJVaVRlGGAe9E/IVQCsR4pqsJuyXLbwC/EvQkn5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fYuChwK0z2LORJghxFq5exrJ6F+jPZt+JtDAVpNSkQXDO8Tq2AI/FJvCyXD+K/MQJ szEy8ysV5T9AxiW5eqqPL4/b2p0Dzm/FkPvvadXwcTqnH2G5kqmTKqm7UxT7K9p8kp C6brKXwzvuTvwNYfKt52hIEt0ixSJ0SAPVlTqdrI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Blakey , Jakub Kicinski Subject: [PATCH 4.9 11/29] openvswitch: Fix setting ipv6 fields causing hw csum failure Date: Mon, 28 Feb 2022 18:23:38 +0100 Message-Id: <20220228172142.549697891@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Blakey commit d9b5ae5c1b241b91480aa30408be12fe91af834a upstream. Ipv6 ttl, label and tos fields are modified without first pulling/pushing the ipv6 header, which would have updated the hw csum (if available). This might cause csum validation when sending the packet to the stack, as can be seen in the trace below. Fix this by updating skb->csum if available. Trace resulted by ipv6 ttl dec and then sending packet to conntrack [actions: set(ipv6(hlimit=3D63)),ct(zone=3D99)]: [295241.900063] s_pf0vf2: hw csum failure [295241.923191] Call Trace: [295241.925728] [295241.927836] dump_stack+0x5c/0x80 [295241.931240] __skb_checksum_complete+0xac/0xc0 [295241.935778] nf_conntrack_tcp_packet+0x398/0xba0 [nf_conntrack] [295241.953030] nf_conntrack_in+0x498/0x5e0 [nf_conntrack] [295241.958344] __ovs_ct_lookup+0xac/0x860 [openvswitch] [295241.968532] ovs_ct_execute+0x4a7/0x7c0 [openvswitch] [295241.979167] do_execute_actions+0x54a/0xaa0 [openvswitch] [295242.001482] ovs_execute_actions+0x48/0x100 [openvswitch] [295242.006966] ovs_dp_process_packet+0x96/0x1d0 [openvswitch] [295242.012626] ovs_vport_receive+0x6c/0xc0 [openvswitch] [295242.028763] netdev_frame_hook+0xc0/0x180 [openvswitch] [295242.034074] __netif_receive_skb_core+0x2ca/0xcb0 [295242.047498] netif_receive_skb_internal+0x3e/0xc0 [295242.052291] napi_gro_receive+0xba/0xe0 [295242.056231] mlx5e_handle_rx_cqe_mpwrq_rep+0x12b/0x250 [mlx5_core] [295242.062513] mlx5e_poll_rx_cq+0xa0f/0xa30 [mlx5_core] [295242.067669] mlx5e_napi_poll+0xe1/0x6b0 [mlx5_core] [295242.077958] net_rx_action+0x149/0x3b0 [295242.086762] __do_softirq+0xd7/0x2d6 [295242.090427] irq_exit+0xf7/0x100 [295242.093748] do_IRQ+0x7f/0xd0 [295242.096806] common_interrupt+0xf/0xf [295242.100559] [295242.102750] RIP: 0033:0x7f9022e88cbd [295242.125246] RSP: 002b:00007f9022282b20 EFLAGS: 00000246 ORIG_RAX: fffff= fffffffffda [295242.132900] RAX: 0000000000000005 RBX: 0000000000000010 RCX: 0000000000= 000000 [295242.140120] RDX: 00007f9022282ba8 RSI: 00007f9022282a30 RDI: 00007f9014= 005c30 [295242.147337] RBP: 00007f9014014d60 R08: 0000000000000020 R09: 00007f9025= 4a8340 [295242.154557] R10: 00007f9022282a28 R11: 0000000000000246 R12: 0000000000= 000000 [295242.161775] R13: 00007f902308c000 R14: 000000000000002b R15: 00007f9022= b71f40 Fixes: 3fdbd1ce11e5 ("openvswitch: add ipv6 'set' action") Signed-off-by: Paul Blakey Link: https://lore.kernel.org/r/20220223163416.24096-1-paulb@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- include/net/checksum.h | 5 +++++ net/openvswitch/actions.c | 46 ++++++++++++++++++++++++++++++++++++++---= ----- 2 files changed, 43 insertions(+), 8 deletions(-) --- a/include/net/checksum.h +++ b/include/net/checksum.h @@ -143,6 +143,11 @@ static inline void csum_replace2(__sum16 *sum =3D ~csum16_add(csum16_sub(~(*sum), old), new); } =20 +static inline void csum_replace(__wsum *csum, __wsum old, __wsum new) +{ + *csum =3D csum_add(csum_sub(*csum, old), new); +} + struct sk_buff; void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, __be32 from, __be32 to, bool pseudohdr); --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c @@ -391,12 +391,43 @@ static void set_ipv6_addr(struct sk_buff memcpy(addr, new_addr, sizeof(__be32[4])); } =20 -static void set_ipv6_fl(struct ipv6hdr *nh, u32 fl, u32 mask) +static void set_ipv6_dsfield(struct sk_buff *skb, struct ipv6hdr *nh, u8 i= pv6_tclass, u8 mask) { + u8 old_ipv6_tclass =3D ipv6_get_dsfield(nh); + + ipv6_tclass =3D OVS_MASKED(old_ipv6_tclass, ipv6_tclass, mask); + + if (skb->ip_summed =3D=3D CHECKSUM_COMPLETE) + csum_replace(&skb->csum, (__force __wsum)(old_ipv6_tclass << 12), + (__force __wsum)(ipv6_tclass << 12)); + + ipv6_change_dsfield(nh, ~mask, ipv6_tclass); +} + +static void set_ipv6_fl(struct sk_buff *skb, struct ipv6hdr *nh, u32 fl, u= 32 mask) +{ + u32 ofl; + + ofl =3D nh->flow_lbl[0] << 16 | nh->flow_lbl[1] << 8 | nh->flow_lbl[2]; + fl =3D OVS_MASKED(ofl, fl, mask); + /* Bits 21-24 are always unmasked, so this retains their values. */ - OVS_SET_MASKED(nh->flow_lbl[0], (u8)(fl >> 16), (u8)(mask >> 16)); - OVS_SET_MASKED(nh->flow_lbl[1], (u8)(fl >> 8), (u8)(mask >> 8)); - OVS_SET_MASKED(nh->flow_lbl[2], (u8)fl, (u8)mask); + nh->flow_lbl[0] =3D (u8)(fl >> 16); + nh->flow_lbl[1] =3D (u8)(fl >> 8); + nh->flow_lbl[2] =3D (u8)fl; + + if (skb->ip_summed =3D=3D CHECKSUM_COMPLETE) + csum_replace(&skb->csum, (__force __wsum)htonl(ofl), (__force __wsum)hto= nl(fl)); +} + +static void set_ipv6_ttl(struct sk_buff *skb, struct ipv6hdr *nh, u8 new_t= tl, u8 mask) +{ + new_ttl =3D OVS_MASKED(nh->hop_limit, new_ttl, mask); + + if (skb->ip_summed =3D=3D CHECKSUM_COMPLETE) + csum_replace(&skb->csum, (__force __wsum)(nh->hop_limit << 8), + (__force __wsum)(new_ttl << 8)); + nh->hop_limit =3D new_ttl; } =20 static void set_ip_ttl(struct sk_buff *skb, struct iphdr *nh, u8 new_ttl, @@ -514,18 +545,17 @@ static int set_ipv6(struct sk_buff *skb, } } if (mask->ipv6_tclass) { - ipv6_change_dsfield(nh, ~mask->ipv6_tclass, key->ipv6_tclass); + set_ipv6_dsfield(skb, nh, key->ipv6_tclass, mask->ipv6_tclass); flow_key->ip.tos =3D ipv6_get_dsfield(nh); } if (mask->ipv6_label) { - set_ipv6_fl(nh, ntohl(key->ipv6_label), + set_ipv6_fl(skb, nh, ntohl(key->ipv6_label), ntohl(mask->ipv6_label)); flow_key->ipv6.label =3D *(__be32 *)nh & htonl(IPV6_FLOWINFO_FLOWLABEL); } if (mask->ipv6_hlimit) { - OVS_SET_MASKED(nh->hop_limit, key->ipv6_hlimit, - mask->ipv6_hlimit); + set_ipv6_ttl(skb, nh, key->ipv6_hlimit, mask->ipv6_hlimit); flow_key->ip.ttl =3D nh->hop_limit; } return 0; From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9696C433F5 for ; Mon, 28 Feb 2022 17:26:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234297AbiB1R0v (ORCPT ); Mon, 28 Feb 2022 12:26:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234066AbiB1R0g (ORCPT ); Mon, 28 Feb 2022 12:26:36 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94A488878E; Mon, 28 Feb 2022 09:25:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 42369B815AC; Mon, 28 Feb 2022 17:25:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CA5EC340F0; Mon, 28 Feb 2022 17:25:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069151; bh=couz8vFTOoH03JXBjYn+wWqTeJnS7cwShdSZT0kmgTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iKUSkvLvwq9Z4cs+mmPy7rrrVGTdlEIzjmh76CET32orriJEjZ1BBoE7cQdmd8/Mf CuGmp/Tjh+e3YjoPjMJ1vn8W4i47c668r1jO4Vr/FvrBeWQxTFICzOL5BU0Sth6I1d ZeTFWQU1X7dbjce69Vc5taKXJUdOORKegDXt5Hpk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Matthias Reichl , Maxime Ripard Subject: [PATCH 4.9 12/29] drm/edid: Always set RGB444 Date: Mon, 28 Feb 2022 18:23:39 +0100 Message-Id: <20220228172142.755023232@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxime Ripard commit ecbd4912a693b862e25cba0a6990a8c95b00721e upstream. In order to fill the drm_display_info structure each time an EDID is read, the code currently will call drm_add_display_info with the parsed EDID. drm_add_display_info will then call drm_reset_display_info to reset all the fields to 0, and then set them to the proper value depending on the EDID. In the color_formats case, we will thus report that we don't support any color format, and then fill it back with RGB444 plus the additional formats described in the EDID Feature Support byte. However, since that byte only contains format-related bits since the 1.4 specification, this doesn't happen if the EDID is following an earlier specification. In turn, it means that for one of these EDID, we end up with color_formats set to 0. The EDID 1.3 specification never really specifies what it means by RGB exactly, but since both HDMI and DVI will use RGB444, it's fairly safe to assume it's supposed to be RGB444. Let's move the addition of RGB444 to color_formats earlier in drm_add_display_info() so that it's always set for a digital display. Fixes: da05a5a71ad8 ("drm: parse color format support for digital displays") Cc: Ville Syrj=C3=A4l=C3=A4 Reported-by: Matthias Reichl Signed-off-by: Maxime Ripard Reviewed-by: Ville Syrj=C3=A4l=C3=A4 Link: https://patchwork.freedesktop.org/patch/msgid/20220203115416.1137308-= 1-maxime@cerno.tech Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/gpu/drm/drm_edid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -3886,6 +3886,7 @@ static void drm_add_display_info(struct if (!(edid->input & DRM_EDID_INPUT_DIGITAL)) return; =20 + info->color_formats |=3D DRM_COLOR_FORMAT_RGB444; drm_parse_cea_ext(connector, edid); =20 /* @@ -3934,7 +3935,6 @@ static void drm_add_display_info(struct DRM_DEBUG("%s: Assigning EDID-1.4 digital sink color depth as %d bpc.\n", connector->name, info->bpc); =20 - info->color_formats |=3D DRM_COLOR_FORMAT_RGB444; if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB444) info->color_formats |=3D DRM_COLOR_FORMAT_YCRCB444; if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB422) From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE646C433EF for ; Mon, 28 Feb 2022 17:26:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234174AbiB1R0z (ORCPT ); Mon, 28 Feb 2022 12:26:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234227AbiB1R0h (ORCPT ); Mon, 28 Feb 2022 12:26:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C60576E04; Mon, 28 Feb 2022 09:25:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DD86FB815A5; Mon, 28 Feb 2022 17:25:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35788C340E7; Mon, 28 Feb 2022 17:25:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069154; bh=w8pGtcHZO6owIM3oPeS+BA5XE3faq42KlBhU1/HkMwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uAfGLQ/SFZ2ckzLb7JrKXzi8iE889U8+5RKoufyyOJqsxjbmiEzCUsMzSlXChNZ9C kADSk1mCrUvIq6Sy//k+sZdWP9uQ697yiGPPCRcAsUU3HwS0rdkrUMf2gKMl8kgg62 D4s3ogF3DIS5G9nQopn0426ewrUiv2ZsKu9VuCGM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gal Pressman , Tariq Toukan , Saeed Mahameed Subject: [PATCH 4.9 13/29] net/mlx5e: Fix wrong return value on ioctl EEPROM query failure Date: Mon, 28 Feb 2022 18:23:40 +0100 Message-Id: <20220228172143.141526295@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gal Pressman commit 0b89429722353d112f8b8b29ca397e95fa994d27 upstream. The ioctl EEPROM query wrongly returns success on read failures, fix that by returning the appropriate error code. Fixes: bb64143eee8c ("net/mlx5e: Add ethtool support for dump module EEPROM= ") Signed-off-by: Gal Pressman Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -1405,7 +1405,7 @@ static int mlx5e_get_module_eeprom(struc if (size_read < 0) { netdev_err(priv->netdev, "%s: mlx5_query_eeprom failed:0x%x\n", __func__, size_read); - return 0; + return size_read; } =20 i +=3D size_read; From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D938C433F5 for ; Mon, 28 Feb 2022 17:26:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234534AbiB1R1A (ORCPT ); Mon, 28 Feb 2022 12:27:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234242AbiB1R0l (ORCPT ); Mon, 28 Feb 2022 12:26:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40AC486E33; Mon, 28 Feb 2022 09:26:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D38A7B815AB; Mon, 28 Feb 2022 17:25:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EAEEC340E7; Mon, 28 Feb 2022 17:25:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069157; bh=CidzmvAFVi43hMNxzqnk5tG9HKIHJRZgVsRGz6ocuw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LXMPntDm6y+8w4hcinH7mvD2/2bDfECiLO6dOm7waJSovU6OuXvNZByPAUbenM8xM YXliMkBP0hM7d0zINBiLm8uf3/Cnw37AFtMGH8JsK6f2kEU96BBupvzgmn+9L9Mv47 ct94YUWJHKiJHJOBt/+4C3ddCXExRY+dXpeWs5dw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, ChenXiaoSong , Laibin Qiu , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.9 14/29] configfs: fix a race in configfs_{,un}register_subsystem() Date: Mon, 28 Feb 2022 18:23:41 +0100 Message-Id: <20220228172143.262489847@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: ChenXiaoSong [ Upstream commit 84ec758fb2daa236026506868c8796b0500c047d ] When configfs_register_subsystem() or configfs_unregister_subsystem() is executing link_group() or unlink_group(), it is possible that two processes add or delete list concurrently. Some unfortunate interleavings of them can cause kernel panic. One of cases is: A --> B --> C --> D A <-- B <-- C <-- D delete list_head *B | delete list_head *C Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --------------------------------|----------------------------------- configfs_unregister_subsystem | configfs_unregister_subsystem unlink_group | unlink_group unlink_obj | unlink_obj list_del_init | list_del_init __list_del_entry | __list_del_entry __list_del | __list_del // next =3D=3D C | next->prev =3D prev | | next->prev =3D prev prev->next =3D next | | // prev =3D=3D B | prev->next =3D next Fix this by adding mutex when calling link_group() or unlink_group(), but parent configfs_subsystem is NULL when config_item is root. So I create a mutex configfs_subsystem_mutex. Fixes: 7063fbf22611 ("[PATCH] configfs: User-driven configuration filesyste= m") Signed-off-by: ChenXiaoSong Signed-off-by: Laibin Qiu Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- fs/configfs/dir.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index c875f246cb0e9..ccb49caed502c 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -50,6 +50,14 @@ DECLARE_RWSEM(configfs_rename_sem); */ DEFINE_SPINLOCK(configfs_dirent_lock); =20 +/* + * All of link_obj/unlink_obj/link_group/unlink_group require that + * subsys->su_mutex is held. + * But parent configfs_subsystem is NULL when config_item is root. + * Use this mutex when config_item is root. + */ +static DEFINE_MUTEX(configfs_subsystem_mutex); + static void configfs_d_iput(struct dentry * dentry, struct inode * inode) { @@ -1937,7 +1945,9 @@ int configfs_register_subsystem(struct configfs_subsy= stem *subsys) group->cg_item.ci_name =3D group->cg_item.ci_namebuf; =20 sd =3D root->d_fsdata; + mutex_lock(&configfs_subsystem_mutex); link_group(to_config_group(sd->s_element), group); + mutex_unlock(&configfs_subsystem_mutex); =20 inode_lock_nested(d_inode(root), I_MUTEX_PARENT); =20 @@ -1962,7 +1972,9 @@ int configfs_register_subsystem(struct configfs_subsy= stem *subsys) inode_unlock(d_inode(root)); =20 if (err) { + mutex_lock(&configfs_subsystem_mutex); unlink_group(group); + mutex_unlock(&configfs_subsystem_mutex); configfs_release_fs(); } put_fragment(frag); @@ -2008,7 +2020,9 @@ void configfs_unregister_subsystem(struct configfs_su= bsystem *subsys) =20 dput(dentry); =20 + mutex_lock(&configfs_subsystem_mutex); unlink_group(group); + mutex_unlock(&configfs_subsystem_mutex); configfs_release_fs(); } =20 --=20 2.34.1 From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F5CAC433EF for ; Mon, 28 Feb 2022 17:26:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234317AbiB1R1F (ORCPT ); Mon, 28 Feb 2022 12:27:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233869AbiB1R0p (ORCPT ); Mon, 28 Feb 2022 12:26:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F89685942; Mon, 28 Feb 2022 09:26:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B690FB815C6; Mon, 28 Feb 2022 17:26:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10DBEC36AF5; Mon, 28 Feb 2022 17:25:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069160; bh=2ssf9prs06l3gtTDvKaqz2wr49VTxv2DHOaap4K54nU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EdRpOi5AwwnN0A4j1rrg7zpWBJDF8x8/vHU/iTXIF2RpO9QubUp3Awf7zIvcOx9jq wr8VGCe1A6jABRaZ5/lSu7x1wc3Onj0HwSnpj8wKALemalcK881SShlnQe1B1EyvXb GG8P1S5r5dkysyK6jMja14WGQK1FcEW1LSkjVh/0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+831661966588c802aae9@syzkaller.appspotmail.com, Bart Van Assche , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.9 15/29] RDMA/ib_srp: Fix a deadlock Date: Mon, 28 Feb 2022 18:23:42 +0100 Message-Id: <20220228172143.382581693@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit 081bdc9fe05bb23248f5effb6f811da3da4b8252 ] Remove the flush_workqueue(system_long_wq) call since flushing system_long_wq is deadlock-prone and since that call is redundant with a preceding cancel_work_sync() Link: https://lore.kernel.org/r/20220215210511.28303-3-bvanassche@acm.org Fixes: ef6c49d87c34 ("IB/srp: Eliminate state SRP_TARGET_DEAD") Reported-by: syzbot+831661966588c802aae9@syzkaller.appspotmail.com Signed-off-by: Bart Van Assche Reviewed-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/infiniband/ulp/srp/ib_srp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/s= rp/ib_srp.c index af68be201c299..67b993f4ec91a 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -3646,9 +3646,11 @@ static void srp_remove_one(struct ib_device *device,= void *client_data) spin_unlock(&host->target_lock); =20 /* - * Wait for tl_err and target port removal tasks. + * srp_queue_remove_work() queues a call to + * srp_remove_target(). The latter function cancels + * target->tl_err_work so waiting for the remove works to + * finish is sufficient. */ - flush_workqueue(system_long_wq); flush_workqueue(srp_remove_wq); =20 kfree(host); --=20 2.34.1 From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 938F7C433EF for ; Mon, 28 Feb 2022 17:26:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234374AbiB1R1J (ORCPT ); Mon, 28 Feb 2022 12:27:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234339AbiB1R0v (ORCPT ); Mon, 28 Feb 2022 12:26:51 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEF33887B5; Mon, 28 Feb 2022 09:26:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5DB52B815AB; Mon, 28 Feb 2022 17:26:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA250C340E7; Mon, 28 Feb 2022 17:26:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069163; bh=zJosyq7oCq/myyxojvwiAwIeuLpNezuOpFJg2ObthN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zbyk8FTWE+y0OL/gZnP8r/p92b2qWGr8mgV1fsiMUSIngyeXyP9noK9ODfa9d0fRB PZ+kfsyUsCUj/S5OlROPdFzwI8GdUqu5A4CAW0UhkK7RAtAUk8OEEQwUBHbkRuo0Xo u+UZRY/om6RVtIwm5VFJ2aaGlOZavAJr0Ac0xc1w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 4.9 16/29] iio: adc: men_z188_adc: Fix a resource leak in an error handling path Date: Mon, 28 Feb 2022 18:23:43 +0100 Message-Id: <20220228172143.444738755@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET commit e0a2e37f303828d030a83f33ffe14b36cb88d563 upstream. If iio_device_register() fails, a previous ioremap() is left unbalanced. Update the error handling path and add the missing iounmap() call, as already done in the remove function. Fixes: 74aeac4da66f ("iio: adc: Add MEN 16z188 ADC driver") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/320fc777863880247c2aff4a9d1a54ba69abf080.16= 43445149.git.christophe.jaillet@wanadoo.fr Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/iio/adc/men_z188_adc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/drivers/iio/adc/men_z188_adc.c +++ b/drivers/iio/adc/men_z188_adc.c @@ -107,6 +107,7 @@ static int men_z188_probe(struct mcb_dev struct z188_adc *adc; struct iio_dev *indio_dev; struct resource *mem; + int ret; =20 indio_dev =3D devm_iio_device_alloc(&dev->dev, sizeof(struct z188_adc)); if (!indio_dev) @@ -133,8 +134,14 @@ static int men_z188_probe(struct mcb_dev adc->mem =3D mem; mcb_set_drvdata(dev, indio_dev); =20 - return iio_device_register(indio_dev); + ret =3D iio_device_register(indio_dev); + if (ret) + goto err_unmap; =20 + return 0; + +err_unmap: + iounmap(adc->base); err: mcb_release_mem(mem); return -ENXIO; From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5EB7C433EF for ; Mon, 28 Feb 2022 17:26:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234786AbiB1R1L (ORCPT ); Mon, 28 Feb 2022 12:27:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234375AbiB1R0v (ORCPT ); Mon, 28 Feb 2022 12:26:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F5AC887BA; Mon, 28 Feb 2022 09:26:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6EE3B61365; Mon, 28 Feb 2022 17:26:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8792CC340E7; Mon, 28 Feb 2022 17:26:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069165; bh=Vj7+RV1mSAdxwWoIV35hkfTUgm01kukRlhS/2oE8/tA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cR0SL9GdMqO9/5hGKMCB0r/zjCCM2nTBRJVJZowH8u/Hvij3ZJDOLFdgBoh/vMPvU fdbIvhCJ+H4wvuu/QMqb3VbUuspQFruBtPgiS5DTHiU/WJ0S7Ht7sIjvJ/Z8VhE5IY gpIu9cxEJzNo6WhhPjEkq1npFH9UY9l4Hb3HzOv0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Damien Le Moal Subject: [PATCH 4.9 17/29] ata: pata_hpt37x: disable primary channel on HPT371 Date: Mon, 28 Feb 2022 18:23:44 +0100 Message-Id: <20220228172143.558883748@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergey Shtylyov commit 8d093e02e898b24c58788b0289e3202317a96d2a upstream. The HPT371 chip physically has only one channel, the secondary one, however the primary channel registers do exist! Thus we have to manually disable the non-existing channel if the BIOS hasn't done this already. Similarly to the pata_hpt3x2n driver, always disable the primary channel. Fixes: 669a5db411d8 ("[libata] Add a bunch of PATA drivers.") Cc: stable@vger.kernel.org Signed-off-by: Sergey Shtylyov Signed-off-by: Damien Le Moal Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/ata/pata_hpt37x.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c @@ -920,6 +920,20 @@ static int hpt37x_init_one(struct pci_de pci_write_config_byte(dev, 0x5a, irqmask); =20 /* + * HPT371 chips physically have only one channel, the secondary one, + * but the primary channel registers do exist! Go figure... + * So, we manually disable the non-existing channel here + * (if the BIOS hasn't done this already). + */ + if (dev->device =3D=3D PCI_DEVICE_ID_TTI_HPT371) { + u8 mcr1; + + pci_read_config_byte(dev, 0x50, &mcr1); + mcr1 &=3D ~0x04; + pci_write_config_byte(dev, 0x50, mcr1); + } + + /* * default to pci clock. make sure MA15/16 are set to output * to prevent drives having problems with 40-pin cables. Needed * for some drives such as IBM-DTLA which will not enter ready From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9503FC433EF for ; Mon, 28 Feb 2022 17:26:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235183AbiB1R1S (ORCPT ); Mon, 28 Feb 2022 12:27:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234469AbiB1R0w (ORCPT ); Mon, 28 Feb 2022 12:26:52 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D6C588793; Mon, 28 Feb 2022 09:26:09 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3C40E6136C; Mon, 28 Feb 2022 17:26:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46200C340E7; Mon, 28 Feb 2022 17:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069168; bh=MGp52dmwQ7DlmOumLG7PkgGz+jwZUqoURvU/XT/ah+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GbEqXKWgxzIo05pHs53xD6rfkc8uaF38SGTGrwc4UT4o5yMAVxMXHuifR9zes+Udi 0zyj9sZWMECgcbyBk8o87IcGNSLIQuzzXp7HLTKSv+7RD2klH7FqfJQ4wPur4AAsAm 5K3U41+vizHoh75fc3Dui8De88OEDBQPpUMz0pMc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmytro Bagrii , Johan Hovold Subject: [PATCH 4.9 18/29] Revert "USB: serial: ch341: add new Product ID for CH341A" Date: Mon, 28 Feb 2022 18:23:45 +0100 Message-Id: <20220228172143.702416174@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmytro Bagrii commit 198a7ebd5fa17b4d0be8cb70240ee1be885175c0 upstream. This reverts commit 46ee4abb10a07bd8f8ce910ee6b4ae6a947d7f63. CH341 has Product ID 0x5512 in EPP/MEM mode which is used for I2C/SPI/GPIO interfaces. In asynchronous serial interface mode CH341 has PID 0x5523 which is already in the table. Mode is selected by corresponding jumper setting. Signed-off-by: Dmytro Bagrii Link: https://lore.kernel.org/r/20220210164137.4376-1-dimich.dmb@gmail.com Link: https://lore.kernel.org/r/YJ0OCS/sh+1ifD/q@hovoldconsulting.com Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/usb/serial/ch341.c | 1 - 1 file changed, 1 deletion(-) --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -70,7 +70,6 @@ =20 =20 static const struct usb_device_id id_table[] =3D { - { USB_DEVICE(0x1a86, 0x5512) }, { USB_DEVICE(0x1a86, 0x5523) }, { USB_DEVICE(0x1a86, 0x7522) }, { USB_DEVICE(0x1a86, 0x7523) }, From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C055AC433F5 for ; Mon, 28 Feb 2022 17:26:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233997AbiB1R1Y (ORCPT ); Mon, 28 Feb 2022 12:27:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234636AbiB1R1C (ORCPT ); Mon, 28 Feb 2022 12:27:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E96B486E33; Mon, 28 Feb 2022 09:26:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A18C3B815AB; Mon, 28 Feb 2022 17:26:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF82CC340E7; Mon, 28 Feb 2022 17:26:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069171; bh=uu/NMxzyfcZ9ESPLUVqwqBQJvoYcWV3zFRiBpNaEC3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BOFXEpFUf9+YVBBn73+PVpgU18AU56j1YL6r1ZuoX0TqvnhvW+jnIR7TxfW80cSPW ZdYyp7btZ8rh+WGJCTR1+DnIkyBpzkYkfyyDUpjvactYtL83XYWvJ07THJHI17MLYa 0k9QwDeNDdi9Um7giFEaCxKc6LK6HRnGqaM9kd88= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Daehwan Jung Subject: [PATCH 4.9 19/29] usb: gadget: rndis: add spinlock for rndis response list Date: Mon, 28 Feb 2022 18:23:46 +0100 Message-Id: <20220228172143.763528498@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daehwan Jung commit aaaba1c86d04dac8e49bf508b492f81506257da3 upstream. There's no lock for rndis response list. It could cause list corruption if there're two different list_add at the same time like below. It's better to add in rndis_add_response / rndis_free_response / rndis_get_next_response to prevent any race condition on response list. [ 361.894299] [1: irq/191-dwc3:16979] list_add corruption. next->prev should be prev (ffffff80651764d0), but was ffffff883dc36f80. (next=3Dffffff80651764d0). [ 361.904380] [1: irq/191-dwc3:16979] Call trace: [ 361.904391] [1: irq/191-dwc3:16979] __list_add_valid+0x74/0x90 [ 361.904401] [1: irq/191-dwc3:16979] rndis_msg_parser+0x168/0x8c0 [ 361.904409] [1: irq/191-dwc3:16979] rndis_command_complete+0x24/0x84 [ 361.904417] [1: irq/191-dwc3:16979] usb_gadget_giveback_request+0x20/= 0xe4 [ 361.904426] [1: irq/191-dwc3:16979] dwc3_gadget_giveback+0x44/0x60 [ 361.904434] [1: irq/191-dwc3:16979] dwc3_ep0_complete_data+0x1e8/0x3a0 [ 361.904442] [1: irq/191-dwc3:16979] dwc3_ep0_interrupt+0x29c/0x3dc [ 361.904450] [1: irq/191-dwc3:16979] dwc3_process_event_entry+0x78/0x6= cc [ 361.904457] [1: irq/191-dwc3:16979] dwc3_process_event_buf+0xa0/0x1ec [ 361.904465] [1: irq/191-dwc3:16979] dwc3_thread_interrupt+0x34/0x5c Fixes: f6281af9d62e ("usb: gadget: rndis: use list_for_each_entry_safe") Cc: stable Signed-off-by: Daehwan Jung Link: https://lore.kernel.org/r/1645507768-77687-1-git-send-email-dh10.jung= @samsung.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/usb/gadget/function/rndis.c | 8 ++++++++ drivers/usb/gadget/function/rndis.h | 1 + 2 files changed, 9 insertions(+) --- a/drivers/usb/gadget/function/rndis.c +++ b/drivers/usb/gadget/function/rndis.c @@ -924,6 +924,7 @@ struct rndis_params *rndis_register(void params->resp_avail =3D resp_avail; params->v =3D v; INIT_LIST_HEAD(¶ms->resp_queue); + spin_lock_init(¶ms->resp_lock); pr_debug("%s: configNr =3D %d\n", __func__, i); =20 return params; @@ -1017,12 +1018,14 @@ void rndis_free_response(struct rndis_pa { rndis_resp_t *r, *n; =20 + spin_lock(¶ms->resp_lock); list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) { if (r->buf =3D=3D buf) { list_del(&r->list); kfree(r); } } + spin_unlock(¶ms->resp_lock); } EXPORT_SYMBOL_GPL(rndis_free_response); =20 @@ -1032,14 +1035,17 @@ u8 *rndis_get_next_response(struct rndis =20 if (!length) return NULL; =20 + spin_lock(¶ms->resp_lock); list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) { if (!r->send) { r->send =3D 1; *length =3D r->length; + spin_unlock(¶ms->resp_lock); return r->buf; } } =20 + spin_unlock(¶ms->resp_lock); return NULL; } EXPORT_SYMBOL_GPL(rndis_get_next_response); @@ -1056,7 +1062,9 @@ static rndis_resp_t *rndis_add_response( r->length =3D length; r->send =3D 0; =20 + spin_lock(¶ms->resp_lock); list_add_tail(&r->list, ¶ms->resp_queue); + spin_unlock(¶ms->resp_lock); return r; } =20 --- a/drivers/usb/gadget/function/rndis.h +++ b/drivers/usb/gadget/function/rndis.h @@ -194,6 +194,7 @@ typedef struct rndis_params void (*resp_avail)(void *v); void *v; struct list_head resp_queue; + spinlock_t resp_lock; } rndis_params; =20 /* RNDIS Message parser and other useless functions */ From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47EA3C433F5 for ; Mon, 28 Feb 2022 17:27:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236018AbiB1R1w (ORCPT ); Mon, 28 Feb 2022 12:27:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234779AbiB1R1H (ORCPT ); Mon, 28 Feb 2022 12:27:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2C2C8879A; Mon, 28 Feb 2022 09:26:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7DD9561372; Mon, 28 Feb 2022 17:26:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98188C340E7; Mon, 28 Feb 2022 17:26:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069176; bh=nA9BGooZ+ch4rv9bJi2oi3GvFRimk1539Q3okqlAJ1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H68YiWtqiHIztEWSyHYFGxvkJcQPgo359x6g7hylhYqEQhKBSAfVJpjEYEZseBO7m ioyYe5DTjvW9lkpqbmvclnaZTK66A8J+vPvhQoZ2vdEH39scBFqvtLgcpUkc8Ssm1+ hMyomaQ7WAc40C6OWtMUDJLauneOsPEsxMwpNgwo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Szymon Heidrich , stable Subject: [PATCH 4.9 20/29] USB: gadget: validate endpoint index for xilinx udc Date: Mon, 28 Feb 2022 18:23:47 +0100 Message-Id: <20220228172143.830951340@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Szymon Heidrich commit 7f14c7227f342d9932f9b918893c8814f86d2a0d upstream. Assure that host may not manipulate the index to point past endpoint array. Signed-off-by: Szymon Heidrich Cc: stable Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/usb/gadget/udc/udc-xilinx.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/usb/gadget/udc/udc-xilinx.c +++ b/drivers/usb/gadget/udc/udc-xilinx.c @@ -1620,6 +1620,8 @@ static void xudc_getstatus(struct xusb_u break; case USB_RECIP_ENDPOINT: epnum =3D udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK; + if (epnum >=3D XUSB_MAX_ENDPOINTS) + goto stall; target_ep =3D &udc->ep[epnum]; epcfgreg =3D udc->read_fn(udc->addr + target_ep->offset); halt =3D epcfgreg & XUSB_EP_CFG_STALL_MASK; @@ -1687,6 +1689,10 @@ static void xudc_set_clear_feature(struc case USB_RECIP_ENDPOINT: if (!udc->setup.wValue) { endpoint =3D udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK; + if (endpoint >=3D XUSB_MAX_ENDPOINTS) { + xudc_ep0_stall(udc); + return; + } target_ep =3D &udc->ep[endpoint]; outinbit =3D udc->setup.wIndex & USB_ENDPOINT_DIR_MASK; outinbit =3D outinbit >> 7; From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED00EC433EF for ; Mon, 28 Feb 2022 17:28:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235202AbiB1R3C (ORCPT ); Mon, 28 Feb 2022 12:29:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236227AbiB1R1y (ORCPT ); Mon, 28 Feb 2022 12:27:54 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 170CA8933D; Mon, 28 Feb 2022 09:27:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9B98C61349; Mon, 28 Feb 2022 17:27:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADBE7C340E7; Mon, 28 Feb 2022 17:27:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069223; bh=917T7g5NADCLUB+jfAC4t5c2Tgf/uZE24UZy1cRKwXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HpziQAee8+6oKKY8pscfcoVcTYJJTvwlIe4PTPRAi7jPg0DdDGs1TODdoqFuJYBEU DkSnbHtvNhRkQCqnEawB4Fu+TWSubI5kl/wc7JJccUCGPsuy24w7CENb/9ZVt097q7 JPUtZvm5jdSMN/dAswOo9HGV9y7PVl86gejTQk/U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , "Steven Rostedt (Google)" Subject: [PATCH 4.9 21/29] tracefs: Set the group ownership in apply_options() not parse_options() Date: Mon, 28 Feb 2022 18:23:48 +0100 Message-Id: <20220228172143.892637061@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) commit 851e99ebeec3f4a672bb5010cf1ece095acee447 upstream. Al Viro brought it to my attention that the dentries may not be filled when the parse_options() is called, causing the call to set_gid() to possibly crash. It should only be called if parse_options() succeeds totally anyway. He suggested the logical place to do the update is in apply_options(). Link: https://lore.kernel.org/all/20220225165219.737025658@goodmis.org/ Link: https://lkml.kernel.org/r/20220225153426.1c4cab6b@gandalf.local.home Cc: stable@vger.kernel.org Acked-by: Al Viro Reported-by: Al Viro Fixes: 48b27b6b5191 ("tracefs: Set all files to the same group ownership as= the mount option") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- fs/tracefs/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -265,7 +265,6 @@ static int tracefs_parse_options(char *d if (!gid_valid(gid)) return -EINVAL; opts->gid =3D gid; - set_gid(tracefs_mount->mnt_root, gid); break; case Opt_mode: if (match_octal(&args[0], &option)) @@ -292,7 +291,9 @@ static int tracefs_apply_options(struct inode->i_mode |=3D opts->mode; =20 inode->i_uid =3D opts->uid; - inode->i_gid =3D opts->gid; + + /* Set all the group ids to the mount option */ + set_gid(sb->s_root, opts->gid); =20 return 0; } From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DFDEC433EF for ; Mon, 28 Feb 2022 17:29:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236361AbiB1RaA (ORCPT ); Mon, 28 Feb 2022 12:30:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235433AbiB1R1d (ORCPT ); Mon, 28 Feb 2022 12:27:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 782CF887B7; Mon, 28 Feb 2022 09:26:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0A6FC61368; Mon, 28 Feb 2022 17:26:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B451C340E7; Mon, 28 Feb 2022 17:26:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069201; bh=o2ESmCgyPHSQwaUceGzJDCD9pF7SYBayw3oBqz0aP5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zWS5m8q/2jdSwKpj8ayP4b1MC1Ha50x94W79PZ4K13+N128h4BgQLrfiNm9Y6rjC2 xi9L0FIBAY8DA5l/F1yc2C5iAc/vPt/T4C5HBRPYFyueGJ0TJpFpNr2s3R1PuayWq8 gz1tIyVZCqmpV0FpUgIp+Sp4qy2bNgmPPpURZIqM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Slark Xiao , Johan Hovold Subject: [PATCH 4.9 22/29] USB: serial: option: add support for DW5829e Date: Mon, 28 Feb 2022 18:23:49 +0100 Message-Id: <20220228172144.034526375@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Slark Xiao commit 6ecb3f0b18b320320460a42e40d6fb603f6ded96 upstream. Dell DW5829e same as DW5821e except CAT level. DW5821e supports CAT16 but DW5829e supports CAT9. There are 2 types product of DW5829e: normal and eSIM. So we will add 2 PID for DW5829e. And for each PID, it support MBIM or RMNET. Let's see test evidence as below: DW5829e MBIM mode: T: Bus=3D04 Lev=3D01 Prnt=3D01 Port=3D01 Cnt=3D01 Dev#=3D 4 Spd=3D5000 Mx= Ch=3D 0 D: Ver=3D 3.10 Cls=3Def(misc ) Sub=3D02 Prot=3D01 MxPS=3D 9 #Cfgs=3D 2 P: Vendor=3D413c ProdID=3D81e6 Rev=3D03.18 S: Manufacturer=3DDell Inc. S: Product=3DDW5829e Snapdragon X20 LTE S: SerialNumber=3D0123456789ABCDEF C: #Ifs=3D 7 Cfg#=3D 2 Atr=3Da0 MxPwr=3D896mA I: If#=3D0x0 Alt=3D 0 #EPs=3D 1 Cls=3D02(commc) Sub=3D0e Prot=3D00 Driver= =3Dcdc_mbim I: If#=3D0x1 Alt=3D 1 #EPs=3D 2 Cls=3D0a(data ) Sub=3D00 Prot=3D02 Driver= =3Dcdc_mbim I: If#=3D0x2 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption I: If#=3D0x3 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption I: If#=3D0x4 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption I: If#=3D0x5 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption I: If#=3D0x6 Alt=3D 0 #EPs=3D 1 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3D(none) DW5829e RMNET mode: T: Bus=3D04 Lev=3D01 Prnt=3D01 Port=3D01 Cnt=3D01 Dev#=3D 5 Spd=3D5000 Mx= Ch=3D 0 D: Ver=3D 3.10 Cls=3Def(misc ) Sub=3D02 Prot=3D01 MxPS=3D 9 #Cfgs=3D 1 P: Vendor=3D413c ProdID=3D81e6 Rev=3D03.18 S: Manufacturer=3DDell Inc. S: Product=3DDW5829e Snapdragon X20 LTE S: SerialNumber=3D0123456789ABCDEF C: #Ifs=3D 6 Cfg#=3D 1 Atr=3Da0 MxPwr=3D896mA I: If#=3D0x0 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Dqmi_wwan I: If#=3D0x1 Alt=3D 0 #EPs=3D 1 Cls=3D03(HID ) Sub=3D00 Prot=3D00 Driver= =3Dusbhid I: If#=3D0x2 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption I: If#=3D0x3 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption I: If#=3D0x4 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption I: If#=3D0x5 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption DW5829e-eSIM MBIM mode: T: Bus=3D04 Lev=3D01 Prnt=3D01 Port=3D01 Cnt=3D01 Dev#=3D 6 Spd=3D5000 Mx= Ch=3D 0 D: Ver=3D 3.10 Cls=3Def(misc ) Sub=3D02 Prot=3D01 MxPS=3D 9 #Cfgs=3D 2 P: Vendor=3D413c ProdID=3D81e4 Rev=3D03.18 S: Manufacturer=3DDell Inc. S: Product=3DDW5829e-eSIM Snapdragon X20 LTE S: SerialNumber=3D0123456789ABCDEF C: #Ifs=3D 7 Cfg#=3D 2 Atr=3Da0 MxPwr=3D896mA I: If#=3D0x0 Alt=3D 0 #EPs=3D 1 Cls=3D02(commc) Sub=3D0e Prot=3D00 Driver= =3Dcdc_mbim I: If#=3D0x1 Alt=3D 1 #EPs=3D 2 Cls=3D0a(data ) Sub=3D00 Prot=3D02 Driver= =3Dcdc_mbim I: If#=3D0x2 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption I: If#=3D0x3 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption I: If#=3D0x4 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption I: If#=3D0x5 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption I: If#=3D0x6 Alt=3D 0 #EPs=3D 1 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3D(none) DW5829e-eSIM RMNET mode: T: Bus=3D04 Lev=3D01 Prnt=3D01 Port=3D01 Cnt=3D01 Dev#=3D 7 Spd=3D5000 Mx= Ch=3D 0 D: Ver=3D 3.10 Cls=3Def(misc ) Sub=3D02 Prot=3D01 MxPS=3D 9 #Cfgs=3D 1 P: Vendor=3D413c ProdID=3D81e4 Rev=3D03.18 S: Manufacturer=3DDell Inc. S: Product=3DDW5829e-eSIM Snapdragon X20 LTE S: SerialNumber=3D0123456789ABCDEF C: #Ifs=3D 6 Cfg#=3D 1 Atr=3Da0 MxPwr=3D896mA I: If#=3D0x0 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Dqmi_wwan I: If#=3D0x1 Alt=3D 0 #EPs=3D 1 Cls=3D03(HID ) Sub=3D00 Prot=3D00 Driver= =3Dusbhid I: If#=3D0x2 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption I: If#=3D0x3 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption I: If#=3D0x4 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3D00 Prot=3D00 Driver= =3Doption I: If#=3D0x5 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption BTW, the interface 0x6 of MBIM mode is GNSS port, which not same as NMEA port. So it's banned from serial option driver. The remaining interfaces 0x2-0x5 are: MODEM, MODEM, NMEA, DIAG. Signed-off-by: Slark Xiao Link: https://lore.kernel.org/r/20220214021401.6264-1-slark_xiao@163.com [ johan: drop unnecessary reservation of interface 1 ] Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/usb/serial/option.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -201,6 +201,8 @@ static void option_instat_callback(struc =20 #define DELL_PRODUCT_5821E 0x81d7 #define DELL_PRODUCT_5821E_ESIM 0x81e0 +#define DELL_PRODUCT_5829E_ESIM 0x81e4 +#define DELL_PRODUCT_5829E 0x81e6 =20 #define KYOCERA_VENDOR_ID 0x0c88 #define KYOCERA_PRODUCT_KPC650 0x17da @@ -1058,6 +1060,10 @@ static const struct usb_device_id option .driver_info =3D RSVD(0) | RSVD(1) | RSVD(6) }, { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5821E_ESIM), .driver_info =3D RSVD(0) | RSVD(1) | RSVD(6) }, + { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E), + .driver_info =3D RSVD(0) | RSVD(6) }, + { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E_ESIM), + .driver_info =3D RSVD(0) | RSVD(6) }, { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100= , ADU-310 */ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) }, From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 868F4C433EF for ; Mon, 28 Feb 2022 17:29:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236101AbiB1R3y (ORCPT ); Mon, 28 Feb 2022 12:29:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234633AbiB1R1i (ORCPT ); Mon, 28 Feb 2022 12:27:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21C21888F1; Mon, 28 Feb 2022 09:26:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B0A3461366; Mon, 28 Feb 2022 17:26:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C60B1C340E7; Mon, 28 Feb 2022 17:26:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069204; bh=OmiwR0cP9/UDpGSq71on02f3Ni28EWSDD1wgMRG9K/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cuived22+1m08CaZkVtGWc8sAXH/xHzVHzcgcR6UcCvu8kruBOWx6r5ZLWnpvys6o c1nfYMtxEZiL8/diVeBMxQno/bd/GnviCrxwBC27BdCkI1QuNpRRY+QjzMN25mIC80 Cw/5qlUJ16/sgAXifWwLUDc56DJEVdAbw0GLBrAA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniele Palmas , Johan Hovold Subject: [PATCH 4.9 23/29] USB: serial: option: add Telit LE910R1 compositions Date: Mon, 28 Feb 2022 18:23:50 +0100 Message-Id: <20220228172144.125876469@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniele Palmas commit cfc4442c642d568014474b6718ccf65dc7ca6099 upstream. Add support for the following Telit LE910R1 compositions: 0x701a: rndis, tty, tty, tty 0x701b: ecm, tty, tty, tty 0x9201: tty Signed-off-by: Daniele Palmas Link: https://lore.kernel.org/r/20220218134552.4051-1-dnlplm@gmail.com Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/usb/serial/option.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -1255,10 +1255,16 @@ static const struct usb_device_id option .driver_info =3D NCTRL(2) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x7011, 0xff), /* Telit LE9= 10-S1 (ECM) */ .driver_info =3D NCTRL(2) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701a, 0xff), /* Telit LE9= 10R1 (RNDIS) */ + .driver_info =3D NCTRL(2) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701b, 0xff), /* Telit LE9= 10R1 (ECM) */ + .driver_info =3D NCTRL(2) }, { USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing dev= ice */ .driver_info =3D NCTRL(0) | ZLP }, { USB_DEVICE(TELIT_VENDOR_ID, 0x9200), /* Telit LE910S1 flashing devic= e */ .driver_info =3D NCTRL(0) | ZLP }, + { USB_DEVICE(TELIT_VENDOR_ID, 0x9201), /* Telit LE910R1 flashing devic= e */ + .driver_info =3D NCTRL(0) | ZLP }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0= xff, 0xff) }, /* ZTE WCDMA products */ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), .driver_info =3D RSVD(1) }, From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 522A2C433F5 for ; Mon, 28 Feb 2022 17:27:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236029AbiB1R2a (ORCPT ); Mon, 28 Feb 2022 12:28:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234750AbiB1R1i (ORCPT ); Mon, 28 Feb 2022 12:27:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCDFE887B5; Mon, 28 Feb 2022 09:26:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6962361358; Mon, 28 Feb 2022 17:26:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CBCEC340F1; Mon, 28 Feb 2022 17:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069206; bh=r2zGWISR8ADy/uMfenbo6oa4HWz6gRQAjuTFHjo4Oaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WThdPCDUqkb1Gp+1Hbr7za3ue6aA2m9h5NDYDkGVxy4cII7ani/eeaneG78M/pJn6 G7eX+s7PzyGQApUL0Cb5PQRXz1BiXtxIuHpr6GkhRu4Amri/WPSIL5NXYx3r0l2x3u jx7MzDyTKfhgSLV5mC5SfOAbY2VI0CFDux+2xvy4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Marek Szyprowski , Sebastian Andrzej Siewior Subject: [PATCH 4.9 24/29] usb: dwc3: gadget: Let the interrupt handler disable bottom halves. Date: Mon, 28 Feb 2022 18:23:51 +0100 Message-Id: <20220228172144.199942293@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sebastian Andrzej Siewior commit 84918a89d6efaff075de570b55642b6f4ceeac6d upstream. The interrupt service routine registered for the gadget is a primary handler which mask the interrupt source and a threaded handler which handles the source of the interrupt. Since the threaded handler is voluntary threaded, the IRQ-core does not disable bottom halves before invoke the handler like it does for the forced-threaded handler. Due to changes in networking it became visible that a network gadget's completions handler may schedule a softirq which remains unprocessed. The gadget's completion handler is usually invoked either in hard-IRQ or soft-IRQ context. In this context it is enough to just raise the softirq because the softirq itself will be handled once that context is left. In the case of the voluntary threaded handler, there is nothing that will process pending softirqs. Which means it remain queued until another random interrupt (on this CPU) fires and handles it on its exit path or another thread locks and unlocks a lock with the bh suffix. Worst case is that the CPU goes idle and the NOHZ complains about unhandled softirqs. Disable bottom halves before acquiring the lock (and disabling interrupts) and enable them after dropping the lock. This ensures that any pending softirqs will handled right away. Link: https://lkml.kernel.org/r/c2a64979-73d1-2c22-e048-c275c9f81558@samsun= g.com Fixes: e5f68b4a3e7b0 ("Revert "usb: dwc3: gadget: remove unnecessary _irqsa= ve()"") Cc: stable Reported-by: Marek Szyprowski Tested-by: Marek Szyprowski Signed-off-by: Sebastian Andrzej Siewior Link: https://lore.kernel.org/r/Yg/YPejVQH3KkRVd@linutronix.de Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/usb/dwc3/gadget.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2904,9 +2904,11 @@ static irqreturn_t dwc3_thread_interrupt unsigned long flags; irqreturn_t ret =3D IRQ_NONE; =20 + local_bh_disable(); spin_lock_irqsave(&dwc->lock, flags); ret =3D dwc3_process_event_buf(evt); spin_unlock_irqrestore(&dwc->lock, flags); + local_bh_enable(); =20 return ret; } From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA1FBC433FE for ; Mon, 28 Feb 2022 17:27:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234689AbiB1R2g (ORCPT ); Mon, 28 Feb 2022 12:28:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235285AbiB1R1s (ORCPT ); Mon, 28 Feb 2022 12:27:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A94388B37; Mon, 28 Feb 2022 09:26:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D2633B815AB; Mon, 28 Feb 2022 17:26:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 326D3C340E7; Mon, 28 Feb 2022 17:26:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069209; bh=4PQKIwUXxRzP9Abgeu8v7P8lJQoD90sckGSUc3Fd8ko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fjzKplmT8T0+PdDj2wu23qi58gYeMEpQSR6LgHb5leBKdvXk/8ffqwme2aKn3DVuM Heuq0ZDayNlAsLdJl8Wig+CMDardjn0/5ooOOCBkKOzLLdnCTfaYU9KZ5Q232RU4Q0 raULftYo2qZdG2QFewTDf+YtPECbufJ87g5c0JBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hongyu Xie , Mathias Nyman Subject: [PATCH 4.9 25/29] xhci: Prevent futile URB re-submissions due to incorrect return value. Date: Mon, 28 Feb 2022 18:23:52 +0100 Message-Id: <20220228172144.265818325@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hongyu Xie commit 243a1dd7ba48c120986dd9e66fee74bcb7751034 upstream. The -ENODEV return value from xhci_check_args() is incorrectly changed to -EINVAL in a couple places before propagated further. xhci_check_args() returns 4 types of value, -ENODEV, -EINVAL, 1 and 0. xhci_urb_enqueue and xhci_check_streams_endpoint return -EINVAL if the return value of xhci_check_args <=3D 0. This causes problems for example r8152_submit_rx, calling usb_submit_urb in drivers/net/usb/r8152.c. r8152_submit_rx will never get -ENODEV after submiting an urb when xHC is halted because xhci_urb_enqueue returns -EINVAL in the very beginning. [commit message and header edit -Mathias] Fixes: 203a86613fb3 ("xhci: Avoid NULL pointer deref when host dies.") Cc: stable@vger.kernel.org Signed-off-by: Hongyu Xie Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20220215123320.1253947-3-mathias.nyman@linu= x.intel.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/usb/host/xhci.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1397,9 +1397,12 @@ int xhci_urb_enqueue(struct usb_hcd *hcd struct urb_priv *urb_priv; int size, i; =20 - if (!urb || xhci_check_args(hcd, urb->dev, urb->ep, - true, true, __func__) <=3D 0) + if (!urb) return -EINVAL; + ret =3D xhci_check_args(hcd, urb->dev, urb->ep, + true, true, __func__); + if (ret <=3D 0) + return ret ? ret : -EINVAL; =20 slot_id =3D urb->dev->slot_id; ep_index =3D xhci_get_endpoint_index(&urb->ep->desc); @@ -3031,7 +3034,7 @@ static int xhci_check_streams_endpoint(s return -EINVAL; ret =3D xhci_check_args(xhci_to_hcd(xhci), udev, ep, 1, true, __func__); if (ret <=3D 0) - return -EINVAL; + return ret ? ret : -EINVAL; if (usb_ss_max_streams(&ep->ss_ep_comp) =3D=3D 0) { xhci_warn(xhci, "WARN: SuperSpeed Endpoint Companion" " descriptor for ep 0x%x does not support streams\n", From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0686C433F5 for ; Mon, 28 Feb 2022 17:29:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234936AbiB1R3o (ORCPT ); Mon, 28 Feb 2022 12:29:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235540AbiB1R1t (ORCPT ); Mon, 28 Feb 2022 12:27:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 494F388B3C; Mon, 28 Feb 2022 09:26:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CD82561359; Mon, 28 Feb 2022 17:26:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE168C340E7; Mon, 28 Feb 2022 17:26:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069212; bh=ME5hYI9dA5CJMdTQviur9WnfT8yjCYRmFBcC3IX9d6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1BYEKe33jtOb5qDPFGAuWXN6kmJaW9ERwxc2wJyGEoycE9Gpd4Cv9p8q+CNuTMI0f gQLJnxr/DmM8dDPqCUd1VVdFthK4L6Rh55NYIDKUlshiPKhMhEkdVvhfFxiy4rK1+m n1ikd4dJXsd2uW5ni5mK2yfdlp+Bl3LiAcHZQ7h4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke Subject: [PATCH 4.9 26/29] tty: n_gsm: fix encoding of control signal octet bit DV Date: Mon, 28 Feb 2022 18:23:53 +0100 Message-Id: <20220228172144.329264359@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: daniel.starke@siemens.com commit 737b0ef3be6b319d6c1fd64193d1603311969326 upstream. n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010. See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDeta= ils.aspx?specificationId=3D1516 The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to the newer 27.010 here. Chapter 5.4.6.3.7 describes the encoding of the control signal octet used by the MSC (modem status command). The same encoding is also used in convergence layer type 2 as described in chapter 5.5.2. Table 7 and 24 both require the DV (data valid) bit to be set 1 for outgoing control signal octets sent by the DTE (data terminal equipment), i.e. for the initiator side. Currently, the DV bit is only set if CD (carrier detect) is on, regardless of the side. This patch fixes this behavior by setting the DV bit on the initiator side unconditionally. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Cc: stable@vger.kernel.org Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220218073123.2121-1-daniel.starke@siemens= .com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -444,7 +444,7 @@ static u8 gsm_encode_modem(const struct modembits |=3D MDM_RTR; if (dlci->modem_tx & TIOCM_RI) modembits |=3D MDM_IC; - if (dlci->modem_tx & TIOCM_CD) + if (dlci->modem_tx & TIOCM_CD || dlci->gsm->initiator) modembits |=3D MDM_DV; return modembits; } From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D246DC433F5 for ; Mon, 28 Feb 2022 17:28:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234588AbiB1R3Q (ORCPT ); Mon, 28 Feb 2022 12:29:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235836AbiB1R1v (ORCPT ); Mon, 28 Feb 2022 12:27:51 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCE3889CCB; Mon, 28 Feb 2022 09:26:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3945AB815B4; Mon, 28 Feb 2022 17:26:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93E9CC340E7; Mon, 28 Feb 2022 17:26:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069214; bh=KcD0VeXis5K6pfFfjojtXd9veRqSBEP7ZPOuwSBvwoU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qq+ZBdj5rE+RSShgBsXzS6UYzE6JSwhBAzJLjnkngNym/bW7TwbcTORviIfa5lMwO LGYAis/fQXQM4Gdv6t6aXpyJ2mHKm4q2YiLJXBUZ6EKVzchwSy3Km73+g+nUPTGQN9 5m0Lw5NekWo5SWBSRpumwXi3fEYy+1d5SgF1/aAo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke Subject: [PATCH 4.9 27/29] tty: n_gsm: fix proper link termination after failed open Date: Mon, 28 Feb 2022 18:23:54 +0100 Message-Id: <20220228172144.391709007@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: daniel.starke@siemens.com commit e3b7468f082d106459e86e8dc6fb9bdd65553433 upstream. Trying to open a DLCI by sending a SABM frame may fail with a timeout. The link is closed on the initiator side without informing the responder about this event. The responder assumes the link is open after sending a UA frame to answer the SABM frame. The link gets stuck in a half open state. This patch fixes this by initiating the proper link termination procedure after link setup timeout instead of silently closing it down. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Cc: stable@vger.kernel.org Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220218073123.2121-3-daniel.starke@siemens= .com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1506,7 +1506,7 @@ static void gsm_dlci_t1(unsigned long da dlci->mode =3D DLCI_MODE_ADM; gsm_dlci_open(dlci); } else { - gsm_dlci_close(dlci); + gsm_dlci_begin_close(dlci); /* prevent half open link */ } =20 break; From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E6C2C433F5 for ; Mon, 28 Feb 2022 17:29:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234953AbiB1R3j (ORCPT ); Mon, 28 Feb 2022 12:29:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235842AbiB1R1v (ORCPT ); Mon, 28 Feb 2022 12:27:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C13A389CD1; Mon, 28 Feb 2022 09:26:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 36D256136E; Mon, 28 Feb 2022 17:26:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BC70C340E7; Mon, 28 Feb 2022 17:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069217; bh=9K0UzSGCz4nli94eISe4QfoPGkKsQJl3zLABJrN/GYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Qlmp3mEsOZnnf4UfibwNASnU0uY+sMO7di4hnGf1EXU1Q+M7VRhc+wcpmyBna/f3 VW3BH4+v1BxZUd2pnhxNp1uC6Zo1pXzcz55pFNWbd5uF3ya1HDY6ZrI1sFXzkO4yYH TK7/o5QRne2mZalu7YRDZA8Rm/X6j+WEiugAjV1U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , Mike Rapoport Subject: [PATCH 4.9 28/29] memblock: use kfree() to release kmalloced memblock regions Date: Mon, 28 Feb 2022 18:23:55 +0100 Message-Id: <20220228172144.473893436@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaohe Lin commit c94afc46cae7ad41b2ad6a99368147879f4b0e56 upstream. memblock.{reserved,memory}.regions may be allocated using kmalloc() in memblock_double_array(). Use kfree() to release these kmalloced regions indicated by memblock_{reserved,memory}_in_slab. Signed-off-by: Miaohe Lin Fixes: 3010f876500f ("mm: discard memblock data later") Signed-off-by: Mike Rapoport Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- mm/memblock.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/mm/memblock.c +++ b/mm/memblock.c @@ -272,14 +272,20 @@ void __init memblock_discard(void) addr =3D __pa(memblock.reserved.regions); size =3D PAGE_ALIGN(sizeof(struct memblock_region) * memblock.reserved.max); - __memblock_free_late(addr, size); + if (memblock_reserved_in_slab) + kfree(memblock.reserved.regions); + else + __memblock_free_late(addr, size); } =20 if (memblock.memory.regions !=3D memblock_memory_init_regions) { addr =3D __pa(memblock.memory.regions); size =3D PAGE_ALIGN(sizeof(struct memblock_region) * memblock.memory.max); - __memblock_free_late(addr, size); + if (memblock_memory_in_slab) + kfree(memblock.memory.regions); + else + __memblock_free_late(addr, size); } } #endif From nobody Tue Jun 23 18:14:05 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46702C43219 for ; Mon, 28 Feb 2022 17:28:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234840AbiB1R3N (ORCPT ); Mon, 28 Feb 2022 12:29:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236218AbiB1R1x (ORCPT ); Mon, 28 Feb 2022 12:27:53 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 179998932A; Mon, 28 Feb 2022 09:27:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A040AB815A6; Mon, 28 Feb 2022 17:27:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E71C1C340F0; Mon, 28 Feb 2022 17:26:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646069220; bh=pkOCGlI0oawlvjr58pfeQHv4Iga9CO17MGI1+uxuUoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dJW4Rk3s8lIf4nOjfSOKJyd30ZrnzsBJvsYYacuQem57+J7elMvKKnXwFzFrQrw7S GYuedIuNTF0G2m4Vy+rqOtUlGj0zVOQGWoopbcFkpKw6MBc9O/IfgJmKMvijTCT6GJ YbNpno/ZcUQzgfqLo0tv/DHfdLEmt5o/YFzH6UN0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Carel Si , Jann Horn , Miklos Szeredi , Linus Torvalds , Baokun Li Subject: [PATCH 4.9 29/29] fget: clarify and improve __fget_files() implementation Date: Mon, 28 Feb 2022 18:23:56 +0100 Message-Id: <20220228172144.557686370@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172141.744228435@linuxfoundation.org> References: <20220228172141.744228435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Torvalds commit e386dfc56f837da66d00a078e5314bc8382fab83 upstream. Commit 054aa8d439b9 ("fget: check that the fd still exists after getting a ref to it") fixed a race with getting a reference to a file just as it was being closed. It was a fairly minimal patch, and I didn't think re-checking the file pointer lookup would be a measurable overhead, since it was all right there and cached. But I was wrong, as pointed out by the kernel test robot. The 'poll2' case of the will-it-scale.per_thread_ops benchmark regressed quite noticeably. Admittedly it seems to be a very artificial test: doing "poll()" system calls on regular files in a very tight loop in multiple threads. That means that basically all the time is spent just looking up file descriptors without ever doing anything useful with them (not that doing 'poll()' on a regular file is useful to begin with). And as a result it shows the extra "re-check fd" cost as a sore thumb. Happily, the regression is fixable by just writing the code to loook up the fd to be better and clearer. There's still a cost to verify the file pointer, but now it's basically in the noise even for that benchmark that does nothing else - and the code is more understandable and has better comments too. [ Side note: this patch is also a classic case of one that looks very messy with the default greedy Myers diff - it's much more legible with either the patience of histogram diff algorithm ] Link: https://lore.kernel.org/lkml/20211210053743.GA36420@xsang-OptiPlex-90= 20/ Link: https://lore.kernel.org/lkml/20211213083154.GA20853@linux.intel.com/ Reported-by: kernel test robot Tested-by: Carel Si Cc: Jann Horn Cc: Miklos Szeredi Signed-off-by: Linus Torvalds Signed-off-by: Baokun Li Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Slade Watkins --- fs/file.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++---------= ----- 1 file changed, 57 insertions(+), 16 deletions(-) --- a/fs/file.c +++ b/fs/file.c @@ -692,28 +692,69 @@ void do_close_on_exec(struct files_struc spin_unlock(&files->file_lock); } =20 -static struct file *__fget(unsigned int fd, fmode_t mask, unsigned int ref= s) +static inline struct file *__fget_files_rcu(struct files_struct *files, + unsigned int fd, fmode_t mask, unsigned int refs) { - struct files_struct *files =3D current->files; - struct file *file; + for (;;) { + struct file *file; + struct fdtable *fdt =3D rcu_dereference_raw(files->fdt); + struct file __rcu **fdentry; =20 - rcu_read_lock(); -loop: - file =3D fcheck_files(files, fd); - if (file) { - /* File object ref couldn't be taken. - * dup2() atomicity guarantee is the reason - * we loop to catch the new file (or NULL pointer) + if (unlikely(fd >=3D fdt->max_fds)) + return NULL; + + fdentry =3D fdt->fd + array_index_nospec(fd, fdt->max_fds); + file =3D rcu_dereference_raw(*fdentry); + if (unlikely(!file)) + return NULL; + + if (unlikely(file->f_mode & mask)) + return NULL; + + /* + * Ok, we have a file pointer. However, because we do + * this all locklessly under RCU, we may be racing with + * that file being closed. + * + * Such a race can take two forms: + * + * (a) the file ref already went down to zero, + * and get_file_rcu_many() fails. Just try + * again: */ - if (file->f_mode & mask) - file =3D NULL; - else if (!get_file_rcu_many(file, refs)) - goto loop; - else if (__fcheck_files(files, fd) !=3D file) { + if (unlikely(!get_file_rcu_many(file, refs))) + continue; + + /* + * (b) the file table entry has changed under us. + * Note that we don't need to re-check the 'fdt->fd' + * pointer having changed, because it always goes + * hand-in-hand with 'fdt'. + * + * If so, we need to put our refs and try again. + */ + if (unlikely(rcu_dereference_raw(files->fdt) !=3D fdt) || + unlikely(rcu_dereference_raw(*fdentry) !=3D file)) { fput_many(file, refs); - goto loop; + continue; } + + /* + * Ok, we have a ref to the file, and checked that it + * still exists. + */ + return file; } +} + + +static struct file *__fget(unsigned int fd, fmode_t mask, unsigned int ref= s) +{ + struct files_struct *files =3D current->files; + struct file *file; + + rcu_read_lock(); + file =3D __fget_files_rcu(files, fd, mask, refs); rcu_read_unlock(); =20 return file;