From patchwork Mon Nov 9 12:55:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322634 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0A4BC2D0A3 for ; Mon, 9 Nov 2020 13:33:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A3F5A20897 for ; Mon, 9 Nov 2020 13:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928819; bh=Z1wDiC3HwG946bzh2U4H7Ti5P50tZ77K2E8iE2Ezgis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NnNZU7oBYsdZ2LmlletZGiVAfhkxFNR9F63G9Pa83Lz8eOF6+ft2CGYU3xalRImqu iXLmWSqf6myLSxzROvHB3sbnQpL9EaFVuQaEfl3sd2+PN8e9Le7R38fIGJhXYMomgJ HDxC5/u3ZqabMgO+J4NfUxkhfv5bqv9mQI3ikDy8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731099AbgKINde (ORCPT ); Mon, 9 Nov 2020 08:33:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:59254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731094AbgKINGa (ORCPT ); Mon, 9 Nov 2020 08:06:30 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3E4A820731; Mon, 9 Nov 2020 13:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927189; bh=Z1wDiC3HwG946bzh2U4H7Ti5P50tZ77K2E8iE2Ezgis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UHxVPbew85M5y5St8TuwYxo01ejBG8LXKvYhilafoU+0Y1tSeR9H01hDjpmhITAXA er9I3AzjtpBkpq98iMW7NpvM/+SiIJJFRsjRl2X1ey3eoMYombYiHEEJqVqEhId4/k oBOf7LFsuC/92p5p8WXnB0ZBdSH559u0Pa98MLbs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Jurack , Jakub Kicinski , Claudiu Manoil Subject: [PATCH 4.14 04/48] gianfar: Replace skb_realloc_headroom with skb_cow_head for PTP Date: Mon, 9 Nov 2020 13:55:13 +0100 Message-Id: <20201109125016.950173940@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Claudiu Manoil [ Upstream commit d145c9031325fed963a887851d9fa42516efd52b ] When PTP timestamping is enabled on Tx, the controller inserts the Tx timestamp at the beginning of the frame buffer, between SFD and the L2 frame header. This means that the skb provided by the stack is required to have enough headroom otherwise a new skb needs to be created by the driver to accommodate the timestamp inserted by h/w. Up until now the driver was relying on skb_realloc_headroom() to create new skbs to accommodate PTP frames. Turns out that this method is not reliable in this context at least, as skb_realloc_headroom() for PTP frames can cause random crashes, mostly in subsequent skb_*() calls, when multiple concurrent TCP streams are run at the same time with the PTP flow on the same device (as seen in James' report). I also noticed that when the system is loaded by sending multiple TCP streams, the driver receives cloned skbs in large numbers. skb_cow_head() instead proves to be stable in this scenario, and not only handles cloned skbs too but it's also more efficient and widely used in other drivers. The commit introducing skb_realloc_headroom in the driver goes back to 2009, commit 93c1285c5d92 ("gianfar: reallocate skb when headroom is not enough for fcb"). For practical purposes I'm referencing a newer commit (from 2012) that brings the code to its current structure (and fixes the PTP case). Fixes: 9c4886e5e63b ("gianfar: Fix invalid TX frames returned on error queue when time stamping") Reported-by: James Jurack Suggested-by: Jakub Kicinski Signed-off-by: Claudiu Manoil Link: https://lore.kernel.org/r/20201029081057.8506-1-claudiu.manoil@nxp.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/freescale/gianfar.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -2370,20 +2370,12 @@ static netdev_tx_t gfar_start_xmit(struc fcb_len = GMAC_FCB_LEN + GMAC_TXPAL_LEN; /* make space for additional header when fcb is needed */ - if (fcb_len && unlikely(skb_headroom(skb) < fcb_len)) { - struct sk_buff *skb_new; - - skb_new = skb_realloc_headroom(skb, fcb_len); - if (!skb_new) { + if (fcb_len) { + if (unlikely(skb_cow_head(skb, fcb_len))) { dev->stats.tx_errors++; dev_kfree_skb_any(skb); return NETDEV_TX_OK; } - - if (skb->sk) - skb_set_owner_w(skb_new, skb->sk); - dev_consume_skb_any(skb); - skb = skb_new; } /* total number of fragments in the SKB */ From patchwork Mon Nov 9 12:55:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322791 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A33BC388F7 for ; Mon, 9 Nov 2020 13:06:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3577C20663 for ; Mon, 9 Nov 2020 13:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927211; bh=bBOPXahczJMWEma0bKzrrtfJ7ARjPV24msxAKPLzGag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=EcrfIxtSPhBHcUvElYS+tcFvneDmuPMY+YS+81iZ1QCZAxYnq3U/z96trUv/o+PMy lh66P1QEGTH5TyRxqY3M82N03vBbBeVRX0M+xz7WYzppW0gt/AxiSJvX+Q2rWfOSnH ntlkN6sMd+hLzuY25myK3GCpPZqlZRMyqsKkkRu4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730884AbgKINGp (ORCPT ); Mon, 9 Nov 2020 08:06:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:59318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731101AbgKINGd (ORCPT ); Mon, 9 Nov 2020 08:06:33 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 33A81206B2; Mon, 9 Nov 2020 13:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927192; bh=bBOPXahczJMWEma0bKzrrtfJ7ARjPV24msxAKPLzGag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gP0goEuc2Bu8QalWVPoQ4wu5IVca+ldSKdhbkqIHscjqvFjWV+kVWzN0dkGN49Epz 8IGEifC20TyzLeEKhP/3cmrlMLC3neBQ5RjYIhmKu6S8qEbNu0CH5/XtxsTG/T5fe7 N+K2RQpRUk9TcIToJ+8VkAV7OiU8iyX6W+hA2piA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Jurack , Claudiu Manoil , Jakub Kicinski Subject: [PATCH 4.14 05/48] gianfar: Account for Tx PTP timestamp in the skb headroom Date: Mon, 9 Nov 2020 13:55:14 +0100 Message-Id: <20201109125017.003586848@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Claudiu Manoil [ Upstream commit d6a076d68c6b5d6a5800f3990a513facb7016dea ] When PTP timestamping is enabled on Tx, the controller inserts the Tx timestamp at the beginning of the frame buffer, between SFD and the L2 frame header. This means that the skb provided by the stack is required to have enough headroom otherwise a new skb needs to be created by the driver to accommodate the timestamp inserted by h/w. Up until now the driver was relying on the second option, using skb_realloc_headroom() to create a new skb to accommodate PTP frames. Turns out that this method is not reliable, as reallocation of skbs for PTP frames along with the required overhead (skb_set_owner_w, consume_skb) is causing random crashes in subsequent skb_*() calls, when multiple concurrent TCP streams are run at the same time on the same device (as seen in James' report). Note that these crashes don't occur with a single TCP stream, nor with multiple concurrent UDP streams, but only when multiple TCP streams are run concurrently with the PTP packet flow (doing skb reallocation). This patch enforces the first method, by requesting enough headroom from the stack to accommodate PTP frames, and so avoiding skb_realloc_headroom() & co, and the crashes no longer occur. There's no reason not to set needed_headroom to a large enough value to accommodate PTP frames, so in this regard this patch is a fix. Reported-by: James Jurack Fixes: bee9e58c9e98 ("gianfar:don't add FCB length to hard_header_len") Signed-off-by: Claudiu Manoil Link: https://lore.kernel.org/r/20201020173605.1173-1-claudiu.manoil@nxp.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/freescale/gianfar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -1388,7 +1388,7 @@ static int gfar_probe(struct platform_de if (dev->features & NETIF_F_IP_CSUM || priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) - dev->needed_headroom = GMAC_FCB_LEN; + dev->needed_headroom = GMAC_FCB_LEN + GMAC_TXPAL_LEN; /* Initializing some of the rx/tx queue level parameters */ for (i = 0; i < priv->num_tx_queues; i++) { From patchwork Mon Nov 9 12:55:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322792 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89AE9C2D0A3 for ; Mon, 9 Nov 2020 13:06:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 316EA2076E for ; Mon, 9 Nov 2020 13:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927205; bh=cTxWRwS7V+FCMop28eVtMQqJKQyJl3ZqKN3OXhnsLH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=kTeg8MBLszDJJMwCDoJ+ytaFR27Bk8FEJKAhrKLcocaUwxFsKJKpr22xlsw6ZHr5X x2VeW3V+E+WX5qGq7QjyQCGRjS6q8WUD+IvYxeIm5uq6/9MdMVelictX9eLuITQRx+ wfus1ysALOKkiD17ijvr/COuAj0B9aI6o87flhSI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731082AbgKINGk (ORCPT ); Mon, 9 Nov 2020 08:06:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:59344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731095AbgKINGg (ORCPT ); Mon, 9 Nov 2020 08:06:36 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 17E6B20663; Mon, 9 Nov 2020 13:06:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927195; bh=cTxWRwS7V+FCMop28eVtMQqJKQyJl3ZqKN3OXhnsLH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a/FDh/QMKB1YfHRXDRZujRYQ7J4aaLHBnpZzZSDqNeddiQ63P2NNuD0J2BEoHatCQ GoPvIKhrkmrxvQmfAfdIBorvcdilGMFgWs0T6tii8HxpUYNxNljW7NkfgrC9k0k0Xb 6zLxX5DWV8qGbXSdyEBYlC6L1x37Zxo8q+n8JFAI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniele Palmas , =?utf-8?q?Bj=C3=B8rn_Mork?= , Jakub Kicinski Subject: [PATCH 4.14 06/48] net: usb: qmi_wwan: add Telit LE910Cx 0x1230 composition Date: Mon, 9 Nov 2020 13:55:15 +0100 Message-Id: <20201109125017.055124104@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Daniele Palmas [ Upstream commit 5fd8477ed8ca77e64b93d44a6dae4aa70c191396 ] Add support for Telit LE910Cx 0x1230 composition: 0x1230: tty, adb, rmnet, audio, tty, tty, tty, tty Signed-off-by: Daniele Palmas Acked-by: Bjørn Mork Link: https://lore.kernel.org/r/20201102110108.17244-1-dnlplm@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -1257,6 +1257,7 @@ static const struct usb_device_id produc {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1230, 2)}, /* Telit LE910Cx */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1260, 2)}, /* Telit LE910Cx */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1261, 2)}, /* Telit LE910Cx */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1900, 1)}, /* Telit LN940 series */ From patchwork Mon Nov 9 12:55:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322629 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBD45C56201 for ; Mon, 9 Nov 2020 13:34:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 710652067B for ; Mon, 9 Nov 2020 13:34:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928870; bh=zANjEaYWeKExlg88ELQfrF+12ID1LhEmSNomqtSz3nc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nXKx00e36Iju1rxP4ZiqYenn7Jj5S2k59077E9ttgxLXw5amh4PNm681FeAZ9U8rE 2cCwIPuSK2XQtO/dcsuyAhrymk8kZkzAayLkPwZO5O8KsYavwsto9k0d9yq9v2BvuQ N8m60jndqMu8bC4Jbvu729mG4p+qFju5Gj8+an2Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731463AbgKINeZ (ORCPT ); Mon, 9 Nov 2020 08:34:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:58618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730932AbgKINFu (ORCPT ); Mon, 9 Nov 2020 08:05:50 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 48D7220663; Mon, 9 Nov 2020 13:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927149; bh=zANjEaYWeKExlg88ELQfrF+12ID1LhEmSNomqtSz3nc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wIcFsEaD5DfH/unXXjfaXgaH7ClzQ4ytkN8Kh7yWTqBY7lO8bLl9TlFop0KB5bWoe odQDzO46fAi01/oXOMrDaa/nR1LlOP4KGE322UXQYhukJRmo1RX5JyRJe9HpkHHio2 WuWkNpoI9A72en6JTRu0P6FOj0hxmN9EFc+TYFPA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+603294af2d01acfdd6da@syzkaller.appspotmail.com, Luis Chamberlain , Christoph Hellwig , Bart Van Assche , Omar Sandoval , Hannes Reinecke , Nicolai Stange , Michal Hocko , "Martin K. Petersen" , "James E.J. Bottomley" , yu kuai , Jens Axboe , Ben Hutchings Subject: [PATCH 4.14 10/48] blktrace: fix debugfs use after free Date: Mon, 9 Nov 2020 13:55:19 +0100 Message-Id: <20201109125017.244391571@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Luis Chamberlain commit bad8e64fb19d3a0de5e564d9a7271c31bd684369 upstream. On commit 6ac93117ab00 ("blktrace: use existing disk debugfs directory") merged on v4.12 Omar fixed the original blktrace code for request-based drivers (multiqueue). This however left in place a possible crash, if you happen to abuse blktrace while racing to remove / add a device. We used to use asynchronous removal of the request_queue, and with that the issue was easier to reproduce. Now that we have reverted to synchronous removal of the request_queue, the issue is still possible to reproduce, its however just a bit more difficult. We essentially run two instances of break-blktrace which add/remove a loop device, and setup a blktrace and just never tear the blktrace down. We do this twice in parallel. This is easily reproduced with the script run_0004.sh from break-blktrace [0]. We can end up with two types of panics each reflecting where we race, one a failed blktrace setup: [ 252.426751] debugfs: Directory 'loop0' with parent 'block' already present! [ 252.432265] BUG: kernel NULL pointer dereference, address: 00000000000000a0 [ 252.436592] #PF: supervisor write access in kernel mode [ 252.439822] #PF: error_code(0x0002) - not-present page [ 252.442967] PGD 0 P4D 0 [ 252.444656] Oops: 0002 [#1] SMP NOPTI [ 252.446972] CPU: 10 PID: 1153 Comm: break-blktrace Tainted: G E 5.7.0-rc2-next-20200420+ #164 [ 252.452673] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1 04/01/2014 [ 252.456343] RIP: 0010:down_write+0x15/0x40 [ 252.458146] Code: eb ca e8 ae 22 8d ff cc cc cc cc cc cc cc cc cc cc cc cc cc cc 0f 1f 44 00 00 55 48 89 fd e8 52 db ff ff 31 c0 ba 01 00 00 00 48 0f b1 55 00 75 0f 48 8b 04 25 c0 8b 01 00 48 89 45 08 5d [ 252.463638] RSP: 0018:ffffa626415abcc8 EFLAGS: 00010246 [ 252.464950] RAX: 0000000000000000 RBX: ffff958c25f0f5c0 RCX: ffffff8100000000 [ 252.466727] RDX: 0000000000000001 RSI: ffffff8100000000 RDI: 00000000000000a0 [ 252.468482] RBP: 00000000000000a0 R08: 0000000000000000 R09: 0000000000000001 [ 252.470014] R10: 0000000000000000 R11: ffff958d1f9227ff R12: 0000000000000000 [ 252.471473] R13: ffff958c25ea5380 R14: ffffffff8cce15f1 R15: 00000000000000a0 [ 252.473346] FS: 00007f2e69dee540(0000) GS:ffff958c2fc80000(0000) knlGS:0000000000000000 [ 252.475225] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 252.476267] CR2: 00000000000000a0 CR3: 0000000427d10004 CR4: 0000000000360ee0 [ 252.477526] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 252.478776] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 252.479866] Call Trace: [ 252.480322] simple_recursive_removal+0x4e/0x2e0 [ 252.481078] ? debugfs_remove+0x60/0x60 [ 252.481725] ? relay_destroy_buf+0x77/0xb0 [ 252.482662] debugfs_remove+0x40/0x60 [ 252.483518] blk_remove_buf_file_callback+0x5/0x10 [ 252.484328] relay_close_buf+0x2e/0x60 [ 252.484930] relay_open+0x1ce/0x2c0 [ 252.485520] do_blk_trace_setup+0x14f/0x2b0 [ 252.486187] __blk_trace_setup+0x54/0xb0 [ 252.486803] blk_trace_ioctl+0x90/0x140 [ 252.487423] ? do_sys_openat2+0x1ab/0x2d0 [ 252.488053] blkdev_ioctl+0x4d/0x260 [ 252.488636] block_ioctl+0x39/0x40 [ 252.489139] ksys_ioctl+0x87/0xc0 [ 252.489675] __x64_sys_ioctl+0x16/0x20 [ 252.490380] do_syscall_64+0x52/0x180 [ 252.491032] entry_SYSCALL_64_after_hwframe+0x44/0xa9 And the other on the device removal: [ 128.528940] debugfs: Directory 'loop0' with parent 'block' already present! [ 128.615325] BUG: kernel NULL pointer dereference, address: 00000000000000a0 [ 128.619537] #PF: supervisor write access in kernel mode [ 128.622700] #PF: error_code(0x0002) - not-present page [ 128.625842] PGD 0 P4D 0 [ 128.627585] Oops: 0002 [#1] SMP NOPTI [ 128.629871] CPU: 12 PID: 544 Comm: break-blktrace Tainted: G E 5.7.0-rc2-next-20200420+ #164 [ 128.635595] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1 04/01/2014 [ 128.640471] RIP: 0010:down_write+0x15/0x40 [ 128.643041] Code: eb ca e8 ae 22 8d ff cc cc cc cc cc cc cc cc cc cc cc cc cc cc 0f 1f 44 00 00 55 48 89 fd e8 52 db ff ff 31 c0 ba 01 00 00 00 48 0f b1 55 00 75 0f 65 48 8b 04 25 c0 8b 01 00 48 89 45 08 5d [ 128.650180] RSP: 0018:ffffa9c3c05ebd78 EFLAGS: 00010246 [ 128.651820] RAX: 0000000000000000 RBX: ffff8ae9a6370240 RCX: ffffff8100000000 [ 128.653942] RDX: 0000000000000001 RSI: ffffff8100000000 RDI: 00000000000000a0 [ 128.655720] RBP: 00000000000000a0 R08: 0000000000000002 R09: ffff8ae9afd2d3d0 [ 128.657400] R10: 0000000000000056 R11: 0000000000000000 R12: 0000000000000000 [ 128.659099] R13: 0000000000000000 R14: 0000000000000003 R15: 00000000000000a0 [ 128.660500] FS: 00007febfd995540(0000) GS:ffff8ae9afd00000(0000) knlGS:0000000000000000 [ 128.662204] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 128.663426] CR2: 00000000000000a0 CR3: 0000000420042003 CR4: 0000000000360ee0 [ 128.664776] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 128.666022] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 128.667282] Call Trace: [ 128.667801] simple_recursive_removal+0x4e/0x2e0 [ 128.668663] ? debugfs_remove+0x60/0x60 [ 128.669368] debugfs_remove+0x40/0x60 [ 128.669985] blk_trace_free+0xd/0x50 [ 128.670593] __blk_trace_remove+0x27/0x40 [ 128.671274] blk_trace_shutdown+0x30/0x40 [ 128.671935] blk_release_queue+0x95/0xf0 [ 128.672589] kobject_put+0xa5/0x1b0 [ 128.673188] disk_release+0xa2/0xc0 [ 128.673786] device_release+0x28/0x80 [ 128.674376] kobject_put+0xa5/0x1b0 [ 128.674915] loop_remove+0x39/0x50 [loop] [ 128.675511] loop_control_ioctl+0x113/0x130 [loop] [ 128.676199] ksys_ioctl+0x87/0xc0 [ 128.676708] __x64_sys_ioctl+0x16/0x20 [ 128.677274] do_syscall_64+0x52/0x180 [ 128.677823] entry_SYSCALL_64_after_hwframe+0x44/0xa9 The common theme here is: debugfs: Directory 'loop0' with parent 'block' already present This crash happens because of how blktrace uses the debugfs directory where it places its files. Upon init we always create the same directory which would be needed by blktrace but we only do this for make_request drivers (multiqueue) block drivers. When you race a removal of these devices with a blktrace setup you end up in a situation where the make_request recursive debugfs removal will sweep away the blktrace files and then later blktrace will also try to remove individual dentries which are already NULL. The inverse is also possible and hence the two types of use after frees. We don't create the block debugfs directory on init for these types of block devices: * request-based block driver block devices * every possible partition * scsi-generic And so, this race should in theory only be possible with make_request drivers. We can fix the UAF by simply re-using the debugfs directory for make_request drivers (multiqueue) and only creating the ephemeral directory for the other type of block devices. The new clarifications on relying on the q->blk_trace_mutex *and* also checking for q->blk_trace *prior* to processing a blktrace ensures the debugfs directories are only created if no possible directory name clashes are possible. This goes tested with: o nvme partitions o ISCSI with tgt, and blktracing against scsi-generic with: o block o tape o cdrom o media changer o blktests This patch is part of the work which disputes the severity of CVE-2019-19770 which shows this issue is not a core debugfs issue, but a misuse of debugfs within blktace. Fixes: 6ac93117ab00 ("blktrace: use existing disk debugfs directory") Reported-by: syzbot+603294af2d01acfdd6da@syzkaller.appspotmail.com Signed-off-by: Luis Chamberlain Reviewed-by: Christoph Hellwig Cc: Bart Van Assche Cc: Omar Sandoval Cc: Hannes Reinecke Cc: Nicolai Stange Cc: Greg Kroah-Hartman Cc: Michal Hocko Cc: "Martin K. Petersen" Cc: "James E.J. Bottomley" Cc: yu kuai Signed-off-by: Jens Axboe [bwh: Backported to 4.14: open-code queue_is_mq()] Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- kernel/trace/blktrace.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -533,10 +533,18 @@ static int do_blk_trace_setup(struct req if (!bt->msg_data) goto err; - ret = -ENOENT; - - dir = debugfs_lookup(buts->name, blk_debugfs_root); - if (!dir) +#ifdef CONFIG_BLK_DEBUG_FS + /* + * When tracing whole make_request drivers (multiqueue) block devices, + * reuse the existing debugfs directory created by the block layer on + * init. For request-based block devices, all partitions block devices, + * and scsi-generic block devices we create a temporary new debugfs + * directory that will be removed once the trace ends. + */ + if (q->mq_ops && bdev && bdev == bdev->bd_contains) + dir = q->debugfs_dir; + else +#endif bt->dir = dir = debugfs_create_dir(buts->name, blk_debugfs_root); if (!dir) goto err; @@ -595,8 +603,6 @@ static int do_blk_trace_setup(struct req ret = 0; err: - if (dir && !bt->dir) - dput(dir); if (ret) blk_trace_free(bt); return ret; From patchwork Mon Nov 9 12:55:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322630 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1207C388F7 for ; Mon, 9 Nov 2020 13:34:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7368B2067B for ; Mon, 9 Nov 2020 13:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928859; bh=j6bCoaNE1qOxcaAdaphhyk4Ayzv5g6dyD4DCbCvBu2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NgJPZCw1axvc3Yfsp8jUG668MBV/7oQrJHof0aUQM28Cw+kNhT7cXiMWwQznZBD/s rENjBoG5zmIkglrSkesVxN2RQz/qjlypURVExrU/SimYK3J2YDQSO6qMtOjogiUxVF Ccs5mEZilrbP7qI6U1nWVCCiY0jQCt0YDMsUrJrk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730996AbgKINeQ (ORCPT ); Mon, 9 Nov 2020 08:34:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:58704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730947AbgKINFw (ORCPT ); Mon, 9 Nov 2020 08:05:52 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2767820789; Mon, 9 Nov 2020 13:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927151; bh=j6bCoaNE1qOxcaAdaphhyk4Ayzv5g6dyD4DCbCvBu2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oqeSVjE+CEdmQbt/+AoecOXFa28CNQm9T0oaFqF/yNlrfoXRRW8ProF5KuraopVIC JltG16sPbpf6m9tF9Xo3Q9FSA8VJk8V2Xbxs1pX6hoTu2BzglQUy/ri3AgcLvRd0QN QDlsG1aC7xlBoeB+DIbwCJYlitXM67n1d/8WWSWQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Andrew Bowers , Jeff Kirsher , Ben Hutchings Subject: [PATCH 4.14 11/48] i40e: Fix a potential NULL pointer dereference Date: Mon, 9 Nov 2020 13:55:20 +0100 Message-Id: <20201109125017.295641477@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Christophe JAILLET commit 54902349ee95045b67e2f0c39b75f5418540064b upstream. If 'kzalloc()' fails, a NULL pointer will be dereferenced. Return an error code (-ENOMEM) instead. Signed-off-by: Christophe JAILLET Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -423,6 +423,9 @@ static int i40e_config_iwarp_qvlist(stru (sizeof(struct virtchnl_iwarp_qv_info) * (qvlist_info->num_vectors - 1)); vf->qvlist_info = kzalloc(size, GFP_KERNEL); + if (!vf->qvlist_info) + return -ENOMEM; + vf->qvlist_info->num_vectors = qvlist_info->num_vectors; msix_vf = pf->hw.func_caps.num_msix_vectors_vf; From patchwork Mon Nov 9 12:55:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C029C388F7 for ; Mon, 9 Nov 2020 13:34:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DDD8F2067B for ; Mon, 9 Nov 2020 13:34:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928846; bh=/DgGfDv9KXJmJJkAmOKQEis+T+hpXrkSxv4BY9hKE1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pbiRtowrcbcNb0+tybAHBlFXJWt02fjUnOe4AZ8Ee60hbfymQiM/bItxtITfd+QVK QuAz1dRy5TR0jHtqm4nnzPGGmvzqsT3s9ThfirtHHnCiIp8Vmj2QpjizN1aeWBPaGJ ff/zROxHLTQcwz8sB/S9N58okXEXFMqkT/kPfQTE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731023AbgKINd6 (ORCPT ); Mon, 9 Nov 2020 08:33:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:58854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731026AbgKINGE (ORCPT ); Mon, 9 Nov 2020 08:06:04 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 098FF20663; Mon, 9 Nov 2020 13:06:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927163; bh=/DgGfDv9KXJmJJkAmOKQEis+T+hpXrkSxv4BY9hKE1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rlngRWZTYDknH9tCxJhiCrPHJH7EQnLViTqcm1vgMFg076Pf2utUjUbJYsq2/svi4 /oCUkThsBYymkRXS0TpqyfSon42YoFx14Ci++hQV16tBUCL9ocibSqiGUfi+k/4P/w 89Fcd2tQKpghcoT5k9Jlc7VIm4Idlz/tIphHf+Nc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martyna Szapar , Andrew Bowers , Jeff Kirsher , Ben Hutchings Subject: [PATCH 4.14 15/48] i40e: Memory leak in i40e_config_iwarp_qvlist Date: Mon, 9 Nov 2020 13:55:24 +0100 Message-Id: <20201109125017.494576058@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Martyna Szapar commit 0b63644602cfcbac849f7ea49272a39e90fa95eb upstream. Added freeing the old allocation of vf->qvlist_info in function i40e_config_iwarp_qvlist before overwriting it with the new allocation. Signed-off-by: Martyna Szapar Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 23 +++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -418,6 +418,7 @@ static int i40e_config_iwarp_qvlist(stru u32 v_idx, i, reg_idx, reg; u32 next_q_idx, next_q_type; u32 msix_vf, size; + int ret = 0; msix_vf = pf->hw.func_caps.num_msix_vectors_vf; @@ -426,16 +427,19 @@ static int i40e_config_iwarp_qvlist(stru "Incorrect number of iwarp vectors %u. Maximum %u allowed.\n", qvlist_info->num_vectors, msix_vf); - goto err; + ret = -EINVAL; + goto err_out; } size = sizeof(struct virtchnl_iwarp_qvlist_info) + (sizeof(struct virtchnl_iwarp_qv_info) * (qvlist_info->num_vectors - 1)); + kfree(vf->qvlist_info); vf->qvlist_info = kzalloc(size, GFP_KERNEL); - if (!vf->qvlist_info) - return -ENOMEM; - + if (!vf->qvlist_info) { + ret = -ENOMEM; + goto err_out; + } vf->qvlist_info->num_vectors = qvlist_info->num_vectors; msix_vf = pf->hw.func_caps.num_msix_vectors_vf; @@ -446,8 +450,10 @@ static int i40e_config_iwarp_qvlist(stru v_idx = qv_info->v_idx; /* Validate vector id belongs to this vf */ - if (!i40e_vc_isvalid_vector_id(vf, v_idx)) - goto err; + if (!i40e_vc_isvalid_vector_id(vf, v_idx)) { + ret = -EINVAL; + goto err_free; + } vf->qvlist_info->qv_info[i] = *qv_info; @@ -489,10 +495,11 @@ static int i40e_config_iwarp_qvlist(stru } return 0; -err: +err_free: kfree(vf->qvlist_info); vf->qvlist_info = NULL; - return -EINVAL; +err_out: + return ret; } /** From patchwork Mon Nov 9 12:55:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 320915 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp1738326ilc; Mon, 9 Nov 2020 05:33:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4PZZ9xWMB5/U1nvooI9zYTITiBwCzcx19gF16qf+7KKhO/4uoH+ZzhcEqunnxMTXt1EPO X-Received: by 2002:aa7:c3c1:: with SMTP id l1mr15727378edr.153.1604928838880; Mon, 09 Nov 2020 05:33:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604928838; cv=none; d=google.com; s=arc-20160816; b=IYCfUZ1ZolXT0XFptrbFITu71rOFwJm0u1H6drjtx5VfjA7s9RDkVdK30ANgZSUsTo EDkRL5/J7BHLnh3DPZTHtxpqA995RSkK8aOU83GY9jWqlM0XIMhsI6FTdU1D8dYmaVgz d+CSRXHHGMys4YugSNY++XwrYndN98KRC6CvvRUvS5IWf4w0Y8zce0uTrxr2zmWXaRD0 PzCgFMJXuBMgRSz3h8Ems1iNninPTetfOOK10F1nG7cV7XTXfxNgwmlXelruERV5ezhB k89/XTxZIrNsFhju8H6qJbpXBNbIZtUBz4Nem1pp2xXnZ2EhddIPSmyYzmao/sX1ZtA4 cD+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jtkUJzB0gqVlnYiKE/oEuAdnYD4+CWL5Tn907yjQE04=; b=tjWqI795aRpZJ9+KClZo7uTsn+o5oHYzNe63269m+KoM4rldeN1zhWxv1gLlWQv22O 4Dito6sb6Bvpd+SeQ0crmY8B5yP3z1vGubtfGy2n24fjM/CBtH1G1riB2jB6vxBCq5ZN UBWMiCiHmS+IsDAP+CAeVC+3IONUrdgR9CeU3RGnQqF4houEwh6mP5KgP5jqm2VHqnnq 4L1vuh7LKnbXdDF7oPe/ulQHEs0YNv2Z3aa4NQvYvXMYpjKNu4VH83YioHoeFPE423k+ 1cuqJ4Y7vIKJIOK6qQ7+pvp6tTn7dtR+fX5Pxcd/P6y3zX1i6Rvk9OZOjg7vrgn5gUc/ 1+Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="XYKgBIu/"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dc3si6930586edb.330.2020.11.09.05.33.58; Mon, 09 Nov 2020 05:33:58 -0800 (PST) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="XYKgBIu/"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730729AbgKINdx (ORCPT + 15 others); Mon, 9 Nov 2020 08:33:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:58880 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731027AbgKINGH (ORCPT ); Mon, 9 Nov 2020 08:06:07 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0296B208FE; Mon, 9 Nov 2020 13:06:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927166; bh=H6D+GY6NEyoh7ciiCCRtFNFt8hY+G30jsIjus4pAUx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XYKgBIu/pheNG2mV9q9vZWDrtDJFUtcJ2vvKAtS+S8tqcgZxi+hTtVLGUz5Fs5yUU 6V7I1VA858VKqy9HBmoT+PfqNgeTncEgalZHqorNzRown2csSJfjmdr59eVJqrSZsU BkcpmalbLESwLVUS8mzChIDGnswMy7DL+vLlrfu0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Lee Jones , Peilin Ye , Daniel Vetter Subject: [PATCH 4.14 16/48] Fonts: Replace discarded const qualifier Date: Mon, 9 Nov 2020 13:55:25 +0100 Message-Id: <20201109125017.544756643@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lee Jones commit 9522750c66c689b739e151fcdf895420dc81efc0 upstream. Commit 6735b4632def ("Fonts: Support FONT_EXTRA_WORDS macros for built-in fonts") introduced the following error when building rpc_defconfig (only this build appears to be affected): `acorndata_8x8' referenced in section `.text' of arch/arm/boot/compressed/ll_char_wr.o: defined in discarded section `.data' of arch/arm/boot/compressed/font.o `acorndata_8x8' referenced in section `.data.rel.ro' of arch/arm/boot/compressed/font.o: defined in discarded section `.data' of arch/arm/boot/compressed/font.o make[3]: *** [/scratch/linux/arch/arm/boot/compressed/Makefile:191: arch/arm/boot/compressed/vmlinux] Error 1 make[2]: *** [/scratch/linux/arch/arm/boot/Makefile:61: arch/arm/boot/compressed/vmlinux] Error 2 make[1]: *** [/scratch/linux/arch/arm/Makefile:317: zImage] Error 2 The .data section is discarded at link time. Reinstating acorndata_8x8 as const ensures it is still available after linking. Do the same for the other 12 built-in fonts as well, for consistency purposes. Cc: Cc: Russell King Reviewed-by: Greg Kroah-Hartman Fixes: 6735b4632def ("Fonts: Support FONT_EXTRA_WORDS macros for built-in fonts") Signed-off-by: Lee Jones Co-developed-by: Peilin Ye Signed-off-by: Peilin Ye Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20201102183242.2031659-1-yepeilin.cs@gmail.com Signed-off-by: Greg Kroah-Hartman --- lib/fonts/font_10x18.c | 2 +- lib/fonts/font_6x10.c | 2 +- lib/fonts/font_6x11.c | 2 +- lib/fonts/font_7x14.c | 2 +- lib/fonts/font_8x16.c | 2 +- lib/fonts/font_8x8.c | 2 +- lib/fonts/font_acorn_8x8.c | 2 +- lib/fonts/font_mini_4x6.c | 2 +- lib/fonts/font_pearl_8x8.c | 2 +- lib/fonts/font_sun12x22.c | 2 +- lib/fonts/font_sun8x16.c | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) --- a/lib/fonts/font_10x18.c +++ b/lib/fonts/font_10x18.c @@ -8,7 +8,7 @@ #define FONTDATAMAX 9216 -static struct font_data fontdata_10x18 = { +static const struct font_data fontdata_10x18 = { { 0, 0, FONTDATAMAX, 0 }, { /* 0 0x00 '^@' */ 0x00, 0x00, /* 0000000000 */ --- a/lib/fonts/font_6x10.c +++ b/lib/fonts/font_6x10.c @@ -3,7 +3,7 @@ #define FONTDATAMAX 2560 -static struct font_data fontdata_6x10 = { +static const struct font_data fontdata_6x10 = { { 0, 0, FONTDATAMAX, 0 }, { /* 0 0x00 '^@' */ 0x00, /* 00000000 */ --- a/lib/fonts/font_6x11.c +++ b/lib/fonts/font_6x11.c @@ -9,7 +9,7 @@ #define FONTDATAMAX (11*256) -static struct font_data fontdata_6x11 = { +static const struct font_data fontdata_6x11 = { { 0, 0, FONTDATAMAX, 0 }, { /* 0 0x00 '^@' */ 0x00, /* 00000000 */ --- a/lib/fonts/font_7x14.c +++ b/lib/fonts/font_7x14.c @@ -8,7 +8,7 @@ #define FONTDATAMAX 3584 -static struct font_data fontdata_7x14 = { +static const struct font_data fontdata_7x14 = { { 0, 0, FONTDATAMAX, 0 }, { /* 0 0x00 '^@' */ 0x00, /* 0000000 */ --- a/lib/fonts/font_8x16.c +++ b/lib/fonts/font_8x16.c @@ -10,7 +10,7 @@ #define FONTDATAMAX 4096 -static struct font_data fontdata_8x16 = { +static const struct font_data fontdata_8x16 = { { 0, 0, FONTDATAMAX, 0 }, { /* 0 0x00 '^@' */ 0x00, /* 00000000 */ --- a/lib/fonts/font_8x8.c +++ b/lib/fonts/font_8x8.c @@ -9,7 +9,7 @@ #define FONTDATAMAX 2048 -static struct font_data fontdata_8x8 = { +static const struct font_data fontdata_8x8 = { { 0, 0, FONTDATAMAX, 0 }, { /* 0 0x00 '^@' */ 0x00, /* 00000000 */ --- a/lib/fonts/font_acorn_8x8.c +++ b/lib/fonts/font_acorn_8x8.c @@ -5,7 +5,7 @@ #define FONTDATAMAX 2048 -static struct font_data acorndata_8x8 = { +static const struct font_data acorndata_8x8 = { { 0, 0, FONTDATAMAX, 0 }, { /* 00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ^@ */ /* 01 */ 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, /* ^A */ --- a/lib/fonts/font_mini_4x6.c +++ b/lib/fonts/font_mini_4x6.c @@ -43,7 +43,7 @@ __END__; #define FONTDATAMAX 1536 -static struct font_data fontdata_mini_4x6 = { +static const struct font_data fontdata_mini_4x6 = { { 0, 0, FONTDATAMAX, 0 }, { /*{*/ /* Char 0: ' ' */ --- a/lib/fonts/font_pearl_8x8.c +++ b/lib/fonts/font_pearl_8x8.c @@ -14,7 +14,7 @@ #define FONTDATAMAX 2048 -static struct font_data fontdata_pearl8x8 = { +static const struct font_data fontdata_pearl8x8 = { { 0, 0, FONTDATAMAX, 0 }, { /* 0 0x00 '^@' */ 0x00, /* 00000000 */ --- a/lib/fonts/font_sun12x22.c +++ b/lib/fonts/font_sun12x22.c @@ -3,7 +3,7 @@ #define FONTDATAMAX 11264 -static struct font_data fontdata_sun12x22 = { +static const struct font_data fontdata_sun12x22 = { { 0, 0, FONTDATAMAX, 0 }, { /* 0 0x00 '^@' */ 0x00, 0x00, /* 000000000000 */ --- a/lib/fonts/font_sun8x16.c +++ b/lib/fonts/font_sun8x16.c @@ -3,7 +3,7 @@ #define FONTDATAMAX 4096 -static struct font_data fontdata_sun8x16 = { +static const struct font_data fontdata_sun8x16 = { { 0, 0, FONTDATAMAX, 0 }, { /* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* */ 0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00, From patchwork Mon Nov 9 12:55:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322794 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C593DC2D0A3 for ; Mon, 9 Nov 2020 13:06:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 774A920684 for ; Mon, 9 Nov 2020 13:06:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927177; bh=Ddoh0zPJ0nESyfDNkjlmhetNYQNkUuxzicuDI5+jPMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hSBwKTW9Lf5jgFLAcJZV9D9SlgIV3j45h9b2KtDJR4nvfgcy+3BQru/xGT7Z/1sUP aapiBr9jRuq7W29y4dYhfGvtxOetpbtBS0k4Tw3lRbBoPiIJV+H4yETlCxMdZukRKw SUxXnPKMOyouVOQQefuEksEvqCRT2yP+D15qdWwA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729996AbgKINGN (ORCPT ); Mon, 9 Nov 2020 08:06:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:58904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731034AbgKINGJ (ORCPT ); Mon, 9 Nov 2020 08:06:09 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D59E620684; Mon, 9 Nov 2020 13:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927169; bh=Ddoh0zPJ0nESyfDNkjlmhetNYQNkUuxzicuDI5+jPMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SlU48QufBo2MIGGER/+FafyDqiv8umvFjtrqf5BA1sibcT1iAkS5MmczFCK1K1j5q oHbcKgFikZj48FP749MMyEFenGPaRm1MHByfotOregxkpWxzVErM682xhnfN4FGPcL Pk9yKaF3t3swBYx24CzuLiVLZs2e/eE8xz+2uwGo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Geoffrey D. Bennett" , Takashi Iwai Subject: [PATCH 4.14 17/48] ALSA: usb-audio: Add implicit feedback quirk for Qu-16 Date: Mon, 9 Nov 2020 13:55:26 +0100 Message-Id: <20201109125017.592783914@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Geoffrey D. Bennett commit 0938ecae432e7ac8b01080c35dd81d50a1e43033 upstream. This patch fixes audio distortion on playback for the Allen&Heath Qu-16. Signed-off-by: Geoffrey D. Bennett Cc: Link: https://lore.kernel.org/r/20201104115717.GA19046@b4.vu Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/pcm.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -332,6 +332,7 @@ static int set_sync_ep_implicit_fb_quirk switch (subs->stream->chip->usb_id) { case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */ case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */ + case USB_ID(0x22f0, 0x0006): /* Allen&Heath Qu-16 */ ep = 0x81; iface = usb_ifnum_to_if(dev, 3); From patchwork Mon Nov 9 12:55:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322633 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99B6DC388F7 for ; Mon, 9 Nov 2020 13:33:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 47AEC20897 for ; Mon, 9 Nov 2020 13:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928828; bh=J05Y2FcRanhbwjABFwfmFSqJYI6tBtBQTNpt1O4jl3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=coJqml8rTOejGpCTdtevgL3OuwnARHUz0KDaPO2Q39DGgFYucWwyqvnyIs8ZSnT6V poRBDVtd+1AIeR9O8WLrAEHp4rJsfg9iOXKRhaFbSfJcDOwnj/INxeDyZfCkyUAVrK HdKcvyn3LpqKHbTlx/7lZOoEbTrNEpejUWU67qC4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731091AbgKINdq (ORCPT ); Mon, 9 Nov 2020 08:33:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:59070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730729AbgKINGW (ORCPT ); Mon, 9 Nov 2020 08:06:22 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5574820663; Mon, 9 Nov 2020 13:06:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927181; bh=J05Y2FcRanhbwjABFwfmFSqJYI6tBtBQTNpt1O4jl3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L6kSU/pTmlsm87C4x24jrVxuevrQrjE0ZvoMxbr+ITW4vlr4NBqiTUSg6Hop9WsHG kVA4DCUzfNsPgK76GdkJbNFQtpUWmJz6VjXNiIZt+0gfE8Fob76TyduV+wYtFG14rN D9CF4tpipGlWc/J9ds0JMJTJkwJC1345Hn9VyR+w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Gunthorpe , Andrew Morton , Arnd Bergmann , Tom Lendacky , Thomas Gleixner , Andrey Ryabinin , Borislav Petkov , Brijesh Singh , Jonathan Corbet , Dmitry Vyukov , "Dave Young" , Alexander Potapenko , Konrad Rzeszutek Wilk , Andy Lutomirski , Larry Woodman , Matt Fleming , Ingo Molnar , "Michael S. Tsirkin" , Paolo Bonzini , Peter Zijlstra , Rik van Riel , Toshimitsu Kani , Linus Torvalds Subject: [PATCH 4.14 20/48] mm: always have io_remap_pfn_range() set pgprot_decrypted() Date: Mon, 9 Nov 2020 13:55:29 +0100 Message-Id: <20201109125017.745635595@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jason Gunthorpe commit f8f6ae5d077a9bdaf5cbf2ac960a5d1a04b47482 upstream. The purpose of io_remap_pfn_range() is to map IO memory, such as a memory mapped IO exposed through a PCI BAR. IO devices do not understand encryption, so this memory must always be decrypted. Automatically call pgprot_decrypted() as part of the generic implementation. This fixes a bug where enabling AMD SME causes subsystems, such as RDMA, using io_remap_pfn_range() to expose BAR pages to user space to fail. The CPU will encrypt access to those BAR pages instead of passing unencrypted IO directly to the device. Places not mapping IO should use remap_pfn_range(). Fixes: aca20d546214 ("x86/mm: Add support to make use of Secure Memory Encryption") Signed-off-by: Jason Gunthorpe Signed-off-by: Andrew Morton Cc: Arnd Bergmann Cc: Tom Lendacky Cc: Thomas Gleixner Cc: Andrey Ryabinin Cc: Borislav Petkov Cc: Brijesh Singh Cc: Jonathan Corbet Cc: Dmitry Vyukov Cc: "Dave Young" Cc: Alexander Potapenko Cc: Konrad Rzeszutek Wilk Cc: Andy Lutomirski Cc: Larry Woodman Cc: Matt Fleming Cc: Ingo Molnar Cc: "Michael S. Tsirkin" Cc: Paolo Bonzini Cc: Peter Zijlstra Cc: Rik van Riel Cc: Toshimitsu Kani Cc: Link: https://lkml.kernel.org/r/0-v1-025d64bdf6c4+e-amd_sme_fix_jgg@nvidia.com Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- include/asm-generic/pgtable.h | 4 ---- include/linux/mm.h | 9 +++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -1069,10 +1069,6 @@ static inline bool arch_has_pfn_modify_c #endif /* !__ASSEMBLY__ */ -#ifndef io_remap_pfn_range -#define io_remap_pfn_range remap_pfn_range -#endif - #ifndef has_transparent_hugepage #ifdef CONFIG_TRANSPARENT_HUGEPAGE #define has_transparent_hugepage() 1 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2422,6 +2422,15 @@ static inline int vm_fault_to_errno(int return 0; } +#ifndef io_remap_pfn_range +static inline int io_remap_pfn_range(struct vm_area_struct *vma, + unsigned long addr, unsigned long pfn, + unsigned long size, pgprot_t prot) +{ + return remap_pfn_range(vma, addr, pfn, size, pgprot_decrypted(prot)); +} +#endif + typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, void *data); extern int apply_to_page_range(struct mm_struct *mm, unsigned long address, From patchwork Mon Nov 9 12:55:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0F2DC4741F for ; Mon, 9 Nov 2020 13:06:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F4BF20789 for ; Mon, 9 Nov 2020 13:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927187; bh=65Sq76VAYAD0eVL2bxrHe53cS28VuwSk6Wn7trAvsUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=A5dYZHytl5J/OV0eQGYqEMtJdyMpJkvjfUDQQiXDADE1SWvUO7V1HyvP6gzuja7Zc 6GQ2beHWjTby1btztxog75K7wYbBGjB8A7h+jWMSRxw9JAnfacJjOqgVdS8vcQ61gk BOzZ9lZ0tTlPo4OgmjJz3GAJJZsMutzab1oKOTvI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731077AbgKINGZ (ORCPT ); Mon, 9 Nov 2020 08:06:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:59152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731070AbgKINGY (ORCPT ); Mon, 9 Nov 2020 08:06:24 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 656C420731; Mon, 9 Nov 2020 13:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927184; bh=65Sq76VAYAD0eVL2bxrHe53cS28VuwSk6Wn7trAvsUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KYE3MJ1+6MJAEw7jmmKzLGIOoZzSp0aOtVQhPn5iDFha2WSPUPv19xOhW8pw+/mp7 WY7SA49H+F8+n6colFkkoVsHbtK1o4S7CbqYMPmaetV8ziaNqAF3rVDsuLOtudSYQ9 5cX9Ha5miblIf2xWl3Gv/F4hdOLLO4d5dH4KoiJA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , Andreas Gruenbacher Subject: [PATCH 4.14 21/48] gfs2: Wake up when sd_glock_disposal becomes zero Date: Mon, 9 Nov 2020 13:55:30 +0100 Message-Id: <20201109125017.793395306@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alexander Aring commit da7d554f7c62d0c17c1ac3cc2586473c2d99f0bd upstream. Commit fc0e38dae645 ("GFS2: Fix glock deallocation race") fixed a sd_glock_disposal accounting bug by adding a missing atomic_dec statement, but it failed to wake up sd_glock_wait when that decrement causes sd_glock_disposal to reach zero. As a consequence, gfs2_gl_hash_clear can now run into a 10-minute timeout instead of being woken up. Add the missing wakeup. Fixes: fc0e38dae645 ("GFS2: Fix glock deallocation race") Cc: stable@vger.kernel.org # v2.6.39+ Signed-off-by: Alexander Aring Signed-off-by: Andreas Gruenbacher Signed-off-by: Greg Kroah-Hartman --- fs/gfs2/glock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -870,7 +870,8 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, out_free: kfree(gl->gl_lksb.sb_lvbptr); kmem_cache_free(cachep, gl); - atomic_dec(&sdp->sd_glock_disposal); + if (atomic_dec_and_test(&sdp->sd_glock_disposal)) + wake_up(&sdp->sd_glock_wait); out: return ret; From patchwork Mon Nov 9 12:55:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFD12C56202 for ; Mon, 9 Nov 2020 13:33:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C27C2222A for ; Mon, 9 Nov 2020 13:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928794; bh=rIg+/QwfQQ8/guxQVB3fTDNFoInsWNjN16FKlAaXgIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=apBu2HvG45TrHlcYrfd6y5GVf5AWJQQ65aiKoGSSuyNzsoDXOn74h+avrQfS188H9 m+ETaZzh82bVI0RXgtXGAVk8VFR0456FOe0up3r7GG+S0TAt819aoyqsbD3nhFyEpF IeaRjcpIoLRTHFOtDmZbejfWKgtY4W0YLoq/chWc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731130AbgKINGv (ORCPT ); Mon, 9 Nov 2020 08:06:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:59532 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731150AbgKINGv (ORCPT ); Mon, 9 Nov 2020 08:06:51 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B35D220731; Mon, 9 Nov 2020 13:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927210; bh=rIg+/QwfQQ8/guxQVB3fTDNFoInsWNjN16FKlAaXgIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZABd+9dMKnGdzdGpQr2nQAsGIUkzbqkLg05gzjtA1/uPd+MpOiCGloKoA8y9CBrH1 KeuySz2KjyxWBLkReETo2HmXDd5a4COSEx6RJe1plg6uLZW85qvGUTFH0nNKLEN8tJ 73j/Ar8AxblIz5OWqmqIuML1adbarZcAhUfm0J2Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (VMware)" Subject: [PATCH 4.14 23/48] ftrace: Handle tracing when switching between context Date: Mon, 9 Nov 2020 13:55:32 +0100 Message-Id: <20201109125017.896010574@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Steven Rostedt (VMware) commit 726b3d3f141fba6f841d715fc4d8a4a84f02c02a upstream. When an interrupt or NMI comes in and switches the context, there's a delay from when the preempt_count() shows the update. As the preempt_count() is used to detect recursion having each context have its own bit get set when tracing starts, and if that bit is already set, it is considered a recursion and the function exits. But if this happens in that section where context has changed but preempt_count() has not been updated, this will be incorrectly flagged as a recursion. To handle this case, create another bit call TRANSITION and test it if the current context bit is already set. Flag the call as a recursion if the TRANSITION bit is already set, and if not, set it and continue. The TRANSITION bit will be cleared normally on the return of the function that set it, or if the current context bit is clear, set it and clear the TRANSITION bit to allow for another transition between the current context and an even higher one. Cc: stable@vger.kernel.org Fixes: edc15cafcbfa3 ("tracing: Avoid unnecessary multiple recursion checks") Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.h | 23 +++++++++++++++++++++-- kernel/trace/trace_selftest.c | 9 +++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -526,6 +526,12 @@ enum { TRACE_GRAPH_DEPTH_START_BIT, TRACE_GRAPH_DEPTH_END_BIT, + + /* + * When transitioning between context, the preempt_count() may + * not be correct. Allow for a single recursion to cover this case. + */ + TRACE_TRANSITION_BIT, }; #define trace_recursion_set(bit) do { (current)->trace_recursion |= (1<<(bit)); } while (0) @@ -580,8 +586,21 @@ static __always_inline int trace_test_an return 0; bit = trace_get_context_bit() + start; - if (unlikely(val & (1 << bit))) - return -1; + if (unlikely(val & (1 << bit))) { + /* + * It could be that preempt_count has not been updated during + * a switch between contexts. Allow for a single recursion. + */ + bit = TRACE_TRANSITION_BIT; + if (trace_recursion_test(bit)) + return -1; + trace_recursion_set(bit); + barrier(); + return bit + 1; + } + + /* Normal check passed, clear the transition to allow it again */ + trace_recursion_clear(TRACE_TRANSITION_BIT); val |= 1 << bit; current->trace_recursion = val; --- a/kernel/trace/trace_selftest.c +++ b/kernel/trace/trace_selftest.c @@ -492,8 +492,13 @@ trace_selftest_function_recursion(void) unregister_ftrace_function(&test_rec_probe); ret = -1; - if (trace_selftest_recursion_cnt != 1) { - pr_cont("*callback not called once (%d)* ", + /* + * Recursion allows for transitions between context, + * and may call the callback twice. + */ + if (trace_selftest_recursion_cnt != 1 && + trace_selftest_recursion_cnt != 2) { + pr_cont("*callback not called once (or twice) (%d)* ", trace_selftest_recursion_cnt); goto out; } From patchwork Mon Nov 9 12:55:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C4EEC388F7 for ; Mon, 9 Nov 2020 13:07:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C064A20897 for ; Mon, 9 Nov 2020 13:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927251; bh=1TPAtwwuxKFpOsLHBXmFntJ8vxoiEggKfc+Y3QDa4pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=T3lREwFym/Axj6c8SCWxM8pbmrac3MR3uKNCZ329T4gAD71h4prsePfdEySY65CHf uHu7Q0Xta5Ko4HNKgcomb9dHQ6msl/J83Mi0mxlFAI83X7CQ50/DdmXRfs1x3YT5Ff N3iAi/F9+oj9uG1cPawWHy7pKkjPn+AJF0TcTChE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731321AbgKINHX (ORCPT ); Mon, 9 Nov 2020 08:07:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:60128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731316AbgKINHW (ORCPT ); Mon, 9 Nov 2020 08:07:22 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2A0CE20731; Mon, 9 Nov 2020 13:07:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927241; bh=1TPAtwwuxKFpOsLHBXmFntJ8vxoiEggKfc+Y3QDa4pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iRSIVcnPPo7d6f172XWVy+puifOC0JtTISZycOIv9Y+RFzTBQ6YoxCkfAm70KqUAF K1QylztoO9wAb+jOw40nTzEo5EH7dLggn3HtiY2/Q62+ols6DREjpY7npkxbnNBOCE Qx3DRbbZkpgnyjEtEwx/6e8WBp6pViKfKctt0WEk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiujun Huang , "Steven Rostedt (VMware)" Subject: [PATCH 4.14 24/48] tracing: Fix out of bounds write in get_trace_buf Date: Mon, 9 Nov 2020 13:55:33 +0100 Message-Id: <20201109125017.946178648@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Qiujun Huang commit c1acb4ac1a892cf08d27efcb964ad281728b0545 upstream. The nesting count of trace_printk allows for 4 levels of nesting. The nesting counter starts at zero and is incremented before being used to retrieve the current context's buffer. But the index to the buffer uses the nesting counter after it was incremented, and not its original number, which in needs to do. Link: https://lkml.kernel.org/r/20201029161905.4269-1-hqjagain@gmail.com Cc: stable@vger.kernel.org Fixes: 3d9622c12c887 ("tracing: Add barrier to trace_printk() buffer nesting modification") Signed-off-by: Qiujun Huang Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -2817,7 +2817,7 @@ static char *get_trace_buf(void) /* Interrupts must see nesting incremented before we use the buffer */ barrier(); - return &buffer->buffer[buffer->nesting][0]; + return &buffer->buffer[buffer->nesting - 1][0]; } static void put_trace_buf(void) From patchwork Mon Nov 9 12:55:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322640 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CC43C2D0A3 for ; Mon, 9 Nov 2020 13:32:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C3B7206ED for ; Mon, 9 Nov 2020 13:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928742; bh=AzkNGzZcPAS3X/Z8RvdqSqjKNkUC0T4JNxfRrlDIuhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tVML0N12oHWHG1SzYFCZBRgoQ7t8SjyqoS63MQ204Yekytz83QgD/UZMglc+CeSF0 nfECREBW5LXRJhxAGX93kKC5feoPXDW2aTgS2F6GkwTRIsgDEFeUS+H3I2ZBklnOu2 hL+sM5+LSgNaNBL1jnajYggMLmnZwtHVLgsXYVFY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732443AbgKINcS (ORCPT ); Mon, 9 Nov 2020 08:32:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:60760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731408AbgKINHu (ORCPT ); Mon, 9 Nov 2020 08:07:50 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B2FF520731; Mon, 9 Nov 2020 13:07:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927270; bh=AzkNGzZcPAS3X/Z8RvdqSqjKNkUC0T4JNxfRrlDIuhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=biyQDnn3uJAPLu3wRKffy/21d123DAqKE6qzp+jUeDXesM3eHLuR43r0CIyrPLmrZ hZd3FZMRb8r1qllAssjqmF4TjPLtdO0+VwVv9eRbAbyiuo7r10KAInHq75vXaUegMJ 0WCDY3lCcF0ScZGv8Pa8Vyfm7ZNyINiGG5t89sKw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kairui Song , Ingo Molnar , Sasha Levin Subject: [PATCH 4.14 27/48] x86/kexec: Use up-to-dated screen_info copy to fill boot params Date: Mon, 9 Nov 2020 13:55:36 +0100 Message-Id: <20201109125018.096460512@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kairui Song [ Upstream commit afc18069a2cb7ead5f86623a5f3d4ad6e21f940d ] kexec_file_load() currently reuses the old boot_params.screen_info, but if drivers have change the hardware state, boot_param.screen_info could contain invalid info. For example, the video type might be no longer VGA, or the frame buffer address might be changed. If the kexec kernel keeps using the old screen_info, kexec'ed kernel may attempt to write to an invalid framebuffer memory region. There are two screen_info instances globally available, boot_params.screen_info and screen_info. Later one is a copy, and is updated by drivers. So let kexec_file_load use the updated copy. [ mingo: Tidied up the changelog. ] Signed-off-by: Kairui Song Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20201014092429.1415040-2-kasong@redhat.com Signed-off-by: Sasha Levin --- arch/x86/kernel/kexec-bzimage64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index 4d948d87f01cc..a65636d60296c 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c @@ -211,8 +211,7 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params, params->hdr.hardware_subarch = boot_params.hdr.hardware_subarch; /* Copying screen_info will do? */ - memcpy(¶ms->screen_info, &boot_params.screen_info, - sizeof(struct screen_info)); + memcpy(¶ms->screen_info, &screen_info, sizeof(struct screen_info)); /* Fill in memsize later */ params->screen_info.ext_mem_k = 0; From patchwork Mon Nov 9 12:55:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322785 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 523EAC388F7 for ; Mon, 9 Nov 2020 13:07:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1267620789 for ; Mon, 9 Nov 2020 13:07:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927277; bh=8D9NkorKSRujwDMO/mXdkxxvC97lwF1pW+fc7RN5VcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CkElogA3AzSMjgI6syAPjFTfi0HL6iFLxin72MCXq1V9M1/eSOF0N0F50cczw+yhP icuBemMS3/CejW+jn8csuVCQGP3dVqj2AfBLFSnuASGH7sGGMTJExaQB8aDKyyjI6x ZFYMEwpkPsC+hrwxvd9JfMOmw/heGssvsDvj2vc0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731470AbgKINH4 (ORCPT ); Mon, 9 Nov 2020 08:07:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:60812 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731476AbgKINHy (ORCPT ); Mon, 9 Nov 2020 08:07:54 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C64382076E; Mon, 9 Nov 2020 13:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927273; bh=8D9NkorKSRujwDMO/mXdkxxvC97lwF1pW+fc7RN5VcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JCpykd1/3efoGHmLgBEW1J9IT1tb1QuLfAd/b8qAYEFq3zHOA8uErGF0HD+aAChJG GqHEBN80DRn39htIWbMZsZO44dVi2Lid1MBz4qw9hVTNK3sHxkuc8z/PrE+dOoOKm4 LOgY+dCYtysvC8ZNAdBnPwGSVW1mR43RkD6+68nw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Whitchurch , Rob Herring , Sasha Levin Subject: [PATCH 4.14 28/48] of: Fix reserved-memory overlap detection Date: Mon, 9 Nov 2020 13:55:37 +0100 Message-Id: <20201109125018.145816695@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Vincent Whitchurch [ Upstream commit ca05f33316559a04867295dd49f85aeedbfd6bfd ] The reserved-memory overlap detection code fails to detect overlaps if either of the regions starts at address 0x0. The code explicitly checks for and ignores such regions, apparently in order to ignore dynamically allocated regions which have an address of 0x0 at this point. These dynamically allocated regions also have a size of 0x0 at this point, so fix this by removing the check and sorting the dynamically allocated regions ahead of any static regions at address 0x0. For example, there are two overlaps in this case but they are not currently reported: foo@0 { reg = <0x0 0x2000>; }; bar@0 { reg = <0x0 0x1000>; }; baz@1000 { reg = <0x1000 0x1000>; }; quux { size = <0x1000>; }; but they are after this patch: OF: reserved mem: OVERLAP DETECTED! bar@0 (0x00000000--0x00001000) overlaps with foo@0 (0x00000000--0x00002000) OF: reserved mem: OVERLAP DETECTED! foo@0 (0x00000000--0x00002000) overlaps with baz@1000 (0x00001000--0x00002000) Signed-off-by: Vincent Whitchurch Link: https://lore.kernel.org/r/ded6fd6b47b58741aabdcc6967f73eca6a3f311e.1603273666.git-series.vincent.whitchurch@axis.com Signed-off-by: Rob Herring Signed-off-by: Sasha Levin --- drivers/of/of_reserved_mem.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 32771c2ced7bb..55cbafdb93aef 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -222,6 +222,16 @@ static int __init __rmem_cmp(const void *a, const void *b) if (ra->base > rb->base) return 1; + /* + * Put the dynamic allocations (address == 0, size == 0) before static + * allocations at address 0x0 so that overlap detection works + * correctly. + */ + if (ra->size < rb->size) + return -1; + if (ra->size > rb->size) + return 1; + return 0; } @@ -239,8 +249,7 @@ static void __init __rmem_check_for_overlap(void) this = &reserved_mem[i]; next = &reserved_mem[i + 1]; - if (!(this->base && next->base)) - continue; + if (this->base + this->size > next->base) { phys_addr_t this_end, next_end; From patchwork Mon Nov 9 12:55:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322641 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C7FEC4741F for ; Mon, 9 Nov 2020 13:32:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4DD4E206ED for ; Mon, 9 Nov 2020 13:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928733; bh=pS/wfuvgECeMv7tP2JsM2x5VhNzsY45wQ2MPzjvmbb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pqVOVmzGdQePHac2t6iXMiM4/+kRw6ezXCSe3Iukz9odOuSDiuQl4VD9t2FaxusGn A/fq6apAZOvGcKSvBJqTZaAUwz6W9qDITifwCL63Ghj6ejzCEDn04O5Lrh/Osgv31e pXR8Fnlr8llENg3FuW+pQsa6QKZbnEx8oAAh5WDY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731165AbgKINIB (ORCPT ); Mon, 9 Nov 2020 08:08:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:60952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731522AbgKINIA (ORCPT ); Mon, 9 Nov 2020 08:08:00 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9E59C20663; Mon, 9 Nov 2020 13:07:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927279; bh=pS/wfuvgECeMv7tP2JsM2x5VhNzsY45wQ2MPzjvmbb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A00N5noW/PxlZ6EyH1g8ARYs/mVsc/dO3drfkuF0LeJk2Y8Ja7mX8MQB8iYEkyAA8 WI5Td5PdyfancfkMVa4VrLnji++T4Put6U3b50Ljd3Mr8shl6ry1AbS/fGT+3cIMH8 GTeAwWQrHhlK+75aQQnYvnIqzU5Q6mTlnDtDWo70= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejun Heo , Gabriel Krisman Bertazi , Jens Axboe , Sasha Levin Subject: [PATCH 4.14 30/48] blk-cgroup: Pre-allocate tree node on blkg_conf_prep Date: Mon, 9 Nov 2020 13:55:39 +0100 Message-Id: <20201109125018.243572648@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Gabriel Krisman Bertazi [ Upstream commit f255c19b3ab46d3cad3b1b2e1036f4c926cb1d0c ] Similarly to commit 457e490f2b741 ("blkcg: allocate struct blkcg_gq outside request queue spinlock"), blkg_create can also trigger occasional -ENOMEM failures at the radix insertion because any allocation inside blkg_create has to be non-blocking, making it more likely to fail. This causes trouble for userspace tools trying to configure io weights who need to deal with this condition. This patch reduces the occurrence of -ENOMEMs on this path by preloading the radix tree element on a GFP_KERNEL context, such that we guarantee the later non-blocking insertion won't fail. A similar solution exists in blkcg_init_queue for the same situation. Acked-by: Tejun Heo Signed-off-by: Gabriel Krisman Bertazi Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-cgroup.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index a7217caea699d..34f8e69078cc1 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -872,6 +872,12 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, goto fail; } + if (radix_tree_preload(GFP_KERNEL)) { + blkg_free(new_blkg); + ret = -ENOMEM; + goto fail; + } + rcu_read_lock(); spin_lock_irq(q->queue_lock); @@ -879,7 +885,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, if (IS_ERR(blkg)) { ret = PTR_ERR(blkg); blkg_free(new_blkg); - goto fail_unlock; + goto fail_preloaded; } if (blkg) { @@ -888,10 +894,12 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, blkg = blkg_create(pos, q, new_blkg); if (unlikely(IS_ERR(blkg))) { ret = PTR_ERR(blkg); - goto fail_unlock; + goto fail_preloaded; } } + radix_tree_preload_end(); + if (pos == blkcg) goto success; } @@ -901,6 +909,8 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, ctx->body = body; return 0; +fail_preloaded: + radix_tree_preload_end(); fail_unlock: spin_unlock_irq(q->queue_lock); rcu_read_unlock(); From patchwork Mon Nov 9 12:55:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322636 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21CD6C2D0A3 for ; Mon, 9 Nov 2020 13:32:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C52F4206ED for ; Mon, 9 Nov 2020 13:32:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928768; bh=D9MdidTb1f6jW5+wfj5jVQvlNROQTt2Eti39U2kxRbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=G4x0/jLV0dsg9Fx3gC8ILGwZvSKEnq1G8OVWz6LhdgNTl1rBEbgqgvuNIl5g0HZMM BbYKKShM0khYSr9dNi6etSg8inxiDNmoumL/2YRdRiNIHsJL6P/LQYOK3VxUe2Dr72 Y4eqieDRg/2D48PWXUzeMe68Q6Spiqj517uXGJeg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731215AbgKINHA (ORCPT ); Mon, 9 Nov 2020 08:07:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:59708 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730272AbgKINHA (ORCPT ); Mon, 9 Nov 2020 08:07:00 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 84A0721D46; Mon, 9 Nov 2020 13:06:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927219; bh=D9MdidTb1f6jW5+wfj5jVQvlNROQTt2Eti39U2kxRbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jWAjKVAHfby8JKWb0ATBGSHo3LyBHo1IldiHjq/4QZ5CJD6U+6CqDB5JiUs7hLdru UePr4Nfme3k2wMrQ8YsUwkcd4yc9ulgr23LDJXDrKvkYS+5OLCom01ArWkGihgrVX8 cBmTA2w+oWSJbnJk2BZjO2lYRk0SFwxfxiDJ+L04= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Pankaj Gupta , Vishal Verma , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.14 34/48] ACPI: NFIT: Fix comparison to -ENXIO Date: Mon, 9 Nov 2020 13:55:43 +0100 Message-Id: <20201109125018.444264155@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Zhang Qilong [ Upstream commit 85f971b65a692b68181438e099b946cc06ed499b ] Initial value of rc is '-ENXIO', and we should use the initial value to check it. Signed-off-by: Zhang Qilong Reviewed-by: Pankaj Gupta Reviewed-by: Vishal Verma [ rjw: Subject edit ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/nfit/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 68205002f561e..20fd197ef74cc 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -1273,7 +1273,7 @@ static ssize_t format1_show(struct device *dev, le16_to_cpu(nfit_dcr->dcr->code)); break; } - if (rc != ENXIO) + if (rc != -ENXIO) break; } mutex_unlock(&acpi_desc->init_mutex); From patchwork Mon Nov 9 12:55:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322790 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 533D5C2D0A3 for ; Mon, 9 Nov 2020 13:07:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0345F20789 for ; Mon, 9 Nov 2020 13:07:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927228; bh=d7jTZDjhumxV/uxq1bpz9wiDj4tfj1kuk8YxmYhCV3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Qi+AsZUgknIrEyhTeuia8sh7llZkC8pp3kJboL0JIgVqlxZ1iOn8dbtryabSyil9K i7fvQOj9A3gOFDsdHBMvyqf44WC4Eh6CkwKNKY2jvqIEsx+TD9tSjN8QoGFhFPRwM5 qx1aLrRhhCxS2vzBZj+YqzmUBikOagd/R/zNMDxg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731245AbgKINHF (ORCPT ); Mon, 9 Nov 2020 08:07:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:59754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731237AbgKINHD (ORCPT ); Mon, 9 Nov 2020 08:07:03 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7C3B020663; Mon, 9 Nov 2020 13:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927222; bh=d7jTZDjhumxV/uxq1bpz9wiDj4tfj1kuk8YxmYhCV3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eBewyBjfwShlDkodEO+7/ayGdgfYXM2dSL5Jil+5ABknu1ntThCHNKDh0orlphDJU kTC39Vjq1J5ACzsH+nytAquHgcV8xX+EcUBvGqlvbVTIKU58vysVr32FgSo1Kuxdk6 winO6SsEnKmV/3L5XIGV3djGhf9XeMW5KNkW4Wfk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peilin Ye , Minh Yuan , Greg KH , Tetsuo Handa , Daniel Vetter Subject: [PATCH 4.14 35/48] vt: Disable KD_FONT_OP_COPY Date: Mon, 9 Nov 2020 13:55:44 +0100 Message-Id: <20201109125018.486802563@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Daniel Vetter commit 3c4e0dff2095c579b142d5a0693257f1c58b4804 upstream. It's buggy: On Fri, Nov 06, 2020 at 10:30:08PM +0800, Minh Yuan wrote: > We recently discovered a slab-out-of-bounds read in fbcon in the latest > kernel ( v5.10-rc2 for now ). The root cause of this vulnerability is that > "fbcon_do_set_font" did not handle "vc->vc_font.data" and > "vc->vc_font.height" correctly, and the patch > for VT_RESIZEX can't handle this > issue. > > Specifically, we use KD_FONT_OP_SET to set a small font.data for tty6, and > use KD_FONT_OP_SET again to set a large font.height for tty1. After that, > we use KD_FONT_OP_COPY to assign tty6's vc_font.data to tty1's vc_font.data > in "fbcon_do_set_font", while tty1 retains the original larger > height. Obviously, this will cause an out-of-bounds read, because we can > access a smaller vc_font.data with a larger vc_font.height. Further there was only one user ever. - Android's loadfont, busybox and console-tools only ever use OP_GET and OP_SET - fbset documentation only mentions the kernel cmdline font: option, not anything else. - systemd used OP_COPY before release 232 published in Nov 2016 Now unfortunately the crucial report seems to have gone down with gmane, and the commit message doesn't say much. But the pull request hints at OP_COPY being broken https://github.com/systemd/systemd/pull/3651 So in other words, this never worked, and the only project which foolishly every tried to use it, realized that rather quickly too. Instead of trying to fix security issues here on dead code by adding missing checks, fix the entire thing by removing the functionality. Note that systemd code using the OP_COPY function ignored the return value, so it doesn't matter what we're doing here really - just in case a lone server somewhere happens to be extremely unlucky and running an affected old version of systemd. The relevant code from font_copy_to_all_vcs() in systemd was: /* copy font from active VT, where the font was uploaded to */ cfo.op = KD_FONT_OP_COPY; cfo.height = vcs.v_active-1; /* tty1 == index 0 */ (void) ioctl(vcfd, KDFONTOP, &cfo); Note this just disables the ioctl, garbage collecting the now unused callbacks is left for -next. v2: Tetsuo found the old mail, which allowed me to find it on another archive. Add the link too. Acked-by: Peilin Ye Reported-by: Minh Yuan Cc: Greg KH Cc: Peilin Ye Cc: Tetsuo Handa Signed-off-by: Daniel Vetter Link: https://lore.kernel.org/r/20201108153806.3140315-1-daniel.vetter@ffwll.ch Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/vt.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -4227,27 +4227,6 @@ static int con_font_default(struct vc_da return rc; } -static int con_font_copy(struct vc_data *vc, struct console_font_op *op) -{ - int con = op->height; - int rc; - - - console_lock(); - if (vc->vc_mode != KD_TEXT) - rc = -EINVAL; - else if (!vc->vc_sw->con_font_copy) - rc = -ENOSYS; - else if (con < 0 || !vc_cons_allocated(con)) - rc = -ENOTTY; - else if (con == vc->vc_num) /* nothing to do */ - rc = 0; - else - rc = vc->vc_sw->con_font_copy(vc, con); - console_unlock(); - return rc; -} - int con_font_op(struct vc_data *vc, struct console_font_op *op) { switch (op->op) { @@ -4258,7 +4237,8 @@ int con_font_op(struct vc_data *vc, stru case KD_FONT_OP_SET_DEFAULT: return con_font_default(vc, op); case KD_FONT_OP_COPY: - return con_font_copy(vc, op); + /* was buggy and never really used */ + return -EINVAL; } return -ENOSYS; } From patchwork Mon Nov 9 12:55:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1DBEC4741F for ; Mon, 9 Nov 2020 13:07:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 906D92083B for ; Mon, 9 Nov 2020 13:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927237; bh=0LisRcsaOQwUHAi14yXqT89DRf0dyrFbssm8tp7AO6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=OHrWTigCpRyXz67r1cwHQEcSYupEkwvS9yQV9f90FRAS2ok5YOGmZxyMOAhKYY7rU 65gGZYenqp4J7H9ZdVQ1F/yVaFfnv+Wt6fwFTocM25ZjieE3L1G+IdliM+7ZMnlcFQ wVCAeGa8vQpyKI489SRqNE7JpLSpZeR53q4B3wjI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730462AbgKINHQ (ORCPT ); Mon, 9 Nov 2020 08:07:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:59854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731250AbgKINHJ (ORCPT ); Mon, 9 Nov 2020 08:07:09 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1B9DA20663; Mon, 9 Nov 2020 13:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927227; bh=0LisRcsaOQwUHAi14yXqT89DRf0dyrFbssm8tp7AO6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wogt0c1AI4YmdAxN1h3k1lFcXaI1+6m8GQa3BNVj+NHojSzMxjiTjUs23JCrOY7vo KErdpcEMKIN55HWCUSyc58JroH9+fUQlQjVVeIYVfUn99MqgnjYN8kA4nTKAk3TmBY Ts6TQS6oJMYT1SpeVbX7UhonnKgyjmZhatBDt3ec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claire Chang Subject: [PATCH 4.14 37/48] serial: 8250_mtk: Fix uart_get_baud_rate warning Date: Mon, 9 Nov 2020 13:55:46 +0100 Message-Id: <20201109125018.583456285@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Claire Chang commit 912ab37c798770f21b182d656937072b58553378 upstream. Mediatek 8250 port supports speed higher than uartclk / 16. If the baud rates in both the new and the old termios setting are higher than uartclk / 16, the WARN_ON in uart_get_baud_rate() will be triggered. Passing NULL as the old termios so uart_get_baud_rate() will use uartclk / 16 - 1 as the new baud rate which will be replaced by the original baud rate later by tty_termios_encode_baud_rate() in mtk8250_set_termios(). Fixes: 551e553f0d4a ("serial: 8250_mtk: Fix high-speed baud rates clamping") Signed-off-by: Claire Chang Link: https://lore.kernel.org/r/20201102120749.374458-1-tientzu@chromium.org Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/8250/8250_mtk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/serial/8250/8250_mtk.c +++ b/drivers/tty/serial/8250/8250_mtk.c @@ -56,7 +56,7 @@ mtk8250_set_termios(struct uart_port *po */ baud = tty_termios_baud_rate(termios); - serial8250_do_set_termios(port, termios, old); + serial8250_do_set_termios(port, termios, NULL); tty_termios_encode_baud_rate(termios, baud, baud); From patchwork Mon Nov 9 12:55:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE492C4741F for ; Mon, 9 Nov 2020 13:32:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7AD46206ED for ; Mon, 9 Nov 2020 13:32:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928757; bh=6M8/Nor+vjyIdL9iwcVAhnMpVgxFsCFpmtniT6+i9Fk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=plRTdPKVROunf/5l+u97JF4qMz5VyHzt+GS1fxCsvR86dhX9Bv1ajglQzgn9YFmfs 55B93EgEdOYZh0a+B9Z0djG6PQtWK244SyLoPsdJESGv+G7h8yIr7G9dD9x0pWSs60 fKLKP4LH/KLqkQlcdZi4v7xVnZu1qbPO/NcO6ToU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731273AbgKINcg (ORCPT ); Mon, 9 Nov 2020 08:32:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:59940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731279AbgKINHO (ORCPT ); Mon, 9 Nov 2020 08:07:14 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EE84C20731; Mon, 9 Nov 2020 13:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927233; bh=6M8/Nor+vjyIdL9iwcVAhnMpVgxFsCFpmtniT6+i9Fk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K8FgLlWGSgL1uZCi65RDMIKDck/pXCU9WKaVsz+vlp3gjDUroK4rqtkCU00h+xUoO cOlayiTowjDQoVm4uWKLKVfTsrTqhE4bLn/o96CSoR7MJc014RT9V3qLBHMLB7YgSl y0uTbwpo2AMxdodEXpECNB5Q9uJnwgYgF85V3Ndk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 4.14 39/48] USB: serial: cyberjack: fix write-URB completion race Date: Mon, 9 Nov 2020 13:55:48 +0100 Message-Id: <20201109125018.682376775@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Johan Hovold commit 985616f0457d9f555fff417d0da56174f70cc14f upstream. The write-URB busy flag was being cleared before the completion handler was done with the URB, something which could lead to corrupt transfers due to a racing write request if the URB is resubmitted. Fixes: 507ca9bc0476 ("[PATCH] USB: add ability for usb-serial drivers to determine if their write urb is currently being used.") Cc: stable # 2.6.13 Reviewed-by: Greg Kroah-Hartman Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/cyberjack.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c @@ -358,11 +358,12 @@ static void cyberjack_write_bulk_callbac struct cyberjack_private *priv = usb_get_serial_port_data(port); struct device *dev = &port->dev; int status = urb->status; + bool resubmitted = false; - set_bit(0, &port->write_urbs_free); if (status) { dev_dbg(dev, "%s - nonzero write bulk status received: %d\n", __func__, status); + set_bit(0, &port->write_urbs_free); return; } @@ -395,6 +396,8 @@ static void cyberjack_write_bulk_callbac goto exit; } + resubmitted = true; + dev_dbg(dev, "%s - priv->wrsent=%d\n", __func__, priv->wrsent); dev_dbg(dev, "%s - priv->wrfilled=%d\n", __func__, priv->wrfilled); @@ -411,6 +414,8 @@ static void cyberjack_write_bulk_callbac exit: spin_unlock(&priv->lock); + if (!resubmitted) + set_bit(0, &port->write_urbs_free); usb_serial_port_softint(port); } From patchwork Mon Nov 9 12:55:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322788 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4517C2D0A3 for ; Mon, 9 Nov 2020 13:07:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 66CA620867 for ; Mon, 9 Nov 2020 13:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927250; bh=/bJcuFM1enWY4PYi3NrKmpDWGx0BDVxq1x2befaNcSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ctdWUpgwrj/NTdUUvnNG5GVDzn5oIvQFuMg2iOHV+Crni563hrqu2vK0L29ht4luW G49qcYMNjF4SdW8BcKnm3ANcPf6OV9X2G+vhLgu7hBOoxS84rBx5FMwRzaT27hREHm iNhHt8kBuqp7uKl/jqr9kttQ1qLraXgnC7n5DwGo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730807AbgKINH3 (ORCPT ); Mon, 9 Nov 2020 08:07:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:60262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731316AbgKINH1 (ORCPT ); Mon, 9 Nov 2020 08:07:27 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C60CC2076E; Mon, 9 Nov 2020 13:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927247; bh=/bJcuFM1enWY4PYi3NrKmpDWGx0BDVxq1x2befaNcSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ADz+pCgBcMSSvjdEIt5g18S+p/o1XidEVsSmMPXJ2B9fdS04gMVF0VjdPN9FHTBvp T++zUhFKHLLOaccjOd/kGQe3rsKOJI6J6q6xVZHpI/O62iL6HR6blGe5gIglaxuhbB O3X9w7VAnm5Fqtk5qmVJPv9/1r7PqN01eVm2iJAU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Alan Stern , Julien Humbert Subject: [PATCH 4.14 43/48] USB: Add NO_LPM quirk for Kingston flash drive Date: Mon, 9 Nov 2020 13:55:52 +0100 Message-Id: <20201109125018.882257953@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alan Stern commit afaa2e745a246c5ab95103a65b1ed00101e1bc63 upstream. In Bugzilla #208257, Julien Humbert reports that a 32-GB Kingston flash drive spontaneously disconnects and reconnects, over and over. Testing revealed that disabling Link Power Management for the drive fixed the problem. This patch adds a quirk entry for that drive to turn off LPM permanently. CC: Hans de Goede CC: Reported-and-tested-by: Julien Humbert Signed-off-by: Alan Stern Link: https://lore.kernel.org/r/20201102145821.GA1478741@rowland.harvard.edu Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -217,6 +217,9 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x0926, 0x3333), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, + /* Kingston DataTraveler 3.0 */ + { USB_DEVICE(0x0951, 0x1666), .driver_info = USB_QUIRK_NO_LPM }, + /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, From patchwork Mon Nov 9 12:55:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322638 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87C01C2D0A3 for ; Mon, 9 Nov 2020 13:32:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37D78206ED for ; Mon, 9 Nov 2020 13:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928750; bh=olIar1ovB4S5zgnoj94RxmBX8zIrmlgcSkMMshtvHyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vYeVso4KfW+UM10Sxd436XkysarWZy2ICFdQaGnh06nEoEGpkbA2DCwah21VjRohX ICBoM127vbNOZAiwpBL0+MDoUKn6tVmP5uigKDyong0d9MCQA1JBA81TCQo7xGVS4v vKHSQagbk4iJC7kOd3tVtVLIll1ARSgCChSQl03Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730776AbgKINc1 (ORCPT ); Mon, 9 Nov 2020 08:32:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:60332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731356AbgKINHa (ORCPT ); Mon, 9 Nov 2020 08:07:30 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A31B720789; Mon, 9 Nov 2020 13:07:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927250; bh=olIar1ovB4S5zgnoj94RxmBX8zIrmlgcSkMMshtvHyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2ev2CcnNwFl4dkS+wB9UepG/pGQSx3rCOhHdJBOgBuqXj0wAN0dVsQZgWEwoU6kga Wj5GXp+HtsOSVwNT1tXt8j4/dYkIcraHe8LcKhRutso6zWPUB7klXfWGzsKAP0bS7L ejZ1bzZqMgs5k+I1VVPYCZH8QZpCc5W0aWGlQnLY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Macpaul Lin , Chunfeng Yun Subject: [PATCH 4.14 44/48] usb: mtu3: fix panic in mtu3_gadget_stop() Date: Mon, 9 Nov 2020 13:55:53 +0100 Message-Id: <20201109125018.928083163@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Macpaul Lin commit 20914919ad31849ee2b9cfe0428f4a20335c9e2a upstream. This patch fixes a possible issue when mtu3_gadget_stop() already assigned NULL to mtu->gadget_driver during mtu_gadget_disconnect(). [] notifier_call_chain+0xa4/0x128 [] __atomic_notifier_call_chain+0x84/0x138 [] notify_die+0xb0/0x120 [] die+0x1f8/0x5d0 [] __do_kernel_fault+0x19c/0x280 [] do_bad_area+0x44/0x140 [] do_translation_fault+0x4c/0x90 [] do_mem_abort+0xb8/0x258 [] el1_da+0x24/0x3c [] mtu3_gadget_disconnect+0xac/0x128 [] mtu3_irq+0x34c/0xc18 [] __handle_irq_event_percpu+0x2ac/0xcd0 [] handle_irq_event_percpu+0x80/0x138 [] handle_irq_event+0xac/0x148 [] handle_fasteoi_irq+0x234/0x568 [] generic_handle_irq+0x48/0x68 [] __handle_domain_irq+0x264/0x1740 [] gic_handle_irq+0x14c/0x250 [] el1_irq+0xec/0x194 [] dma_pool_alloc+0x6e4/0xae0 [] cmdq_mbox_pool_alloc_impl+0xb0/0x238 [] cmdq_pkt_alloc_buf+0x2dc/0x7c0 [] cmdq_pkt_add_cmd_buffer+0x178/0x270 [] cmdq_pkt_perf_begin+0x108/0x148 [] cmdq_pkt_create+0x178/0x1f0 [] mtk_crtc_config_default_path+0x328/0x7a0 [] mtk_drm_idlemgr_kick+0xa6c/0x1460 [] mtk_drm_crtc_atomic_begin+0x1a4/0x1a68 [] drm_atomic_helper_commit_planes+0x154/0x878 [] mtk_atomic_complete.isra.16+0xe80/0x19c8 [] mtk_atomic_commit+0x258/0x898 [] drm_atomic_commit+0xcc/0x108 [] drm_mode_atomic_ioctl+0x1c20/0x2580 [] drm_ioctl_kernel+0x118/0x1b0 [] drm_ioctl+0x5c0/0x920 [] do_vfs_ioctl+0x188/0x1820 [] SyS_ioctl+0x8c/0xa0 Fixes: df2069acb005 ("usb: Add MediaTek USB3 DRD driver") Signed-off-by: Macpaul Lin Acked-by: Chunfeng Yun Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/1604642069-20961-1-git-send-email-macpaul.lin@mediatek.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/mtu3/mtu3_gadget.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/mtu3/mtu3_gadget.c +++ b/drivers/usb/mtu3/mtu3_gadget.c @@ -581,6 +581,7 @@ static int mtu3_gadget_stop(struct usb_g spin_unlock_irqrestore(&mtu->lock, flags); + synchronize_irq(mtu->irq); return 0; } From patchwork Mon Nov 9 12:55:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322639 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64F26C4741F for ; Mon, 9 Nov 2020 13:32:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1BEAF2067B for ; Mon, 9 Nov 2020 13:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928746; bh=HKtZLGfCgdWvCQ5U3VKuBC3uFGSb0cHEyo6P1ocRbho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ccQRv3P6KWR5TgAfbneoPUreJrvjUdcBbSKkYsWwNiHZGI7c8q43pH3F2mpVkBgV5 Gk9BLy9MRdCwXCe4Cu2ngRDe5n5N/pPDgssEYuhkORaLX2uNPlGAOlxs2IDHU2XSI5 TYdjXWEG2bmr4BCvH1te4wjRSWFar20DZqMKo2Xs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731343AbgKINHh (ORCPT ); Mon, 9 Nov 2020 08:07:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:60386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731369AbgKINHe (ORCPT ); Mon, 9 Nov 2020 08:07:34 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9C07C20789; Mon, 9 Nov 2020 13:07:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927253; bh=HKtZLGfCgdWvCQ5U3VKuBC3uFGSb0cHEyo6P1ocRbho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NGWdSjOmO8b81ups2HFYyQHoXunUBtQnd9eRsKDRTIpzEgd5Qyf68nictl4f5+1jT cGbxZRDJV25J6YZWSdjnSUutjQSAc+1fjIX7+dmTDv1IfliTNNKMIz555hDa2S8Niw fjDhbv2rlyCaiFTLFP+LWQEFayurBEFMZQAczerY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vineet Gupta Subject: [PATCH 4.14 45/48] ARC: stack unwinding: avoid indefinite looping Date: Mon, 9 Nov 2020 13:55:54 +0100 Message-Id: <20201109125018.978132382@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Vineet Gupta commit 328d2168ca524d501fc4b133d6be076142bd305c upstream. Currently stack unwinder is a while(1) loop which relies on the dwarf unwinder to signal termination, which in turn relies on dwarf info to do so. This in theory could cause an infinite loop if the dwarf info was somehow messed up or the register contents were etc. This fix thus detects the excessive looping and breaks the loop. | Mem: 26184K used, 1009136K free, 0K shrd, 0K buff, 14416K cached | CPU: 0.0% usr 72.8% sys 0.0% nic 27.1% idle 0.0% io 0.0% irq 0.0% sirq | Load average: 4.33 2.60 1.11 2/74 139 | PID PPID USER STAT VSZ %VSZ CPU %CPU COMMAND | 133 2 root SWN 0 0.0 3 22.9 [rcu_torture_rea] | 132 2 root SWN 0 0.0 0 22.0 [rcu_torture_rea] | 131 2 root SWN 0 0.0 3 21.5 [rcu_torture_rea] | 126 2 root RW 0 0.0 2 5.4 [rcu_torture_wri] | 129 2 root SWN 0 0.0 0 0.2 [rcu_torture_fak] | 137 2 root SW 0 0.0 0 0.2 [rcu_torture_cbf] | 127 2 root SWN 0 0.0 0 0.1 [rcu_torture_fak] | 138 115 root R 1464 0.1 2 0.1 top | 130 2 root SWN 0 0.0 0 0.1 [rcu_torture_fak] | 128 2 root SWN 0 0.0 0 0.1 [rcu_torture_fak] | 115 1 root S 1472 0.1 1 0.0 -/bin/sh | 104 1 root S 1464 0.1 0 0.0 inetd | 1 0 root S 1456 0.1 2 0.0 init | 78 1 root S 1456 0.1 0 0.0 syslogd -O /var/log/messages | 134 2 root SW 0 0.0 2 0.0 [rcu_torture_sta] | 10 2 root IW 0 0.0 1 0.0 [rcu_preempt] | 88 2 root IW 0 0.0 1 0.0 [kworker/1:1-eve] | 66 2 root IW 0 0.0 2 0.0 [kworker/2:2-eve] | 39 2 root IW 0 0.0 2 0.0 [kworker/2:1-eve] | unwinder looping too long, aborting ! Cc: Signed-off-by: Vineet Gupta Signed-off-by: Greg Kroah-Hartman --- arch/arc/kernel/stacktrace.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/arch/arc/kernel/stacktrace.c +++ b/arch/arc/kernel/stacktrace.c @@ -115,7 +115,7 @@ arc_unwind_core(struct task_struct *tsk, int (*consumer_fn) (unsigned int, void *), void *arg) { #ifdef CONFIG_ARC_DW2_UNWIND - int ret = 0; + int ret = 0, cnt = 0; unsigned int address; struct unwind_frame_info frame_info; @@ -135,6 +135,11 @@ arc_unwind_core(struct task_struct *tsk, break; frame_info.regs.r63 = frame_info.regs.r31; + + if (cnt++ > 128) { + printk("unwinder looping too long, aborting !\n"); + return 0; + } } return address; /* return the last address it saw */ From patchwork Mon Nov 9 12:55:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322786 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09FEEC2D0A3 for ; Mon, 9 Nov 2020 13:07:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B34E320867 for ; Mon, 9 Nov 2020 13:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927267; bh=uDShULDW3IEZqD6fakX44PMREKkI4D00SfeIEw0r8AM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HVioTXXLf+1Ts6dLviKjhtajmCLhOj2KtrwOEp8EDd8h4y2oJG+tEGpXLj7Gzsa5G i92jdHOcsJtDYhoI7soPJ1yqxeA4Pz6rK85kbEO+pMy+sQErwAlVF9O0uQvwlEHMtr HQu9Jsi6gJLWYZjySIqEHnozMhjVhBFtRXrrzLKw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731444AbgKINHq (ORCPT ); Mon, 9 Nov 2020 08:07:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:60580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731420AbgKINHn (ORCPT ); Mon, 9 Nov 2020 08:07:43 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0F37420663; Mon, 9 Nov 2020 13:07:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927261; bh=uDShULDW3IEZqD6fakX44PMREKkI4D00SfeIEw0r8AM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UG8HMtnZ+Qr/83K86FwYj3JmDBaSDtqtw+KJryVLE5q5ZFWw5MJa2F3CQhQSHYFjk mMUYHqLMyjMeqf2+RAOy6TsZ3A3rg9hJu/6bK3zHzbkXuKtrYr/q1koNYf9TLOfQ5P DZOdkLZ77L79XiTQdN01CLIzpLhgspnpsJbE8cTc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tomasz Maciej Nowak , Gregory CLEMENT , =?utf-8?q?Pali_Roh?= =?utf-8?b?w6Fy?= Subject: [PATCH 4.14 48/48] arm64: dts: marvell: espressobin: add ethernet alias Date: Mon, 9 Nov 2020 13:55:57 +0100 Message-Id: <20201109125019.122260674@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125016.734107741@linuxfoundation.org> References: <20201109125016.734107741@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tomasz Maciej Nowak commit 5253cb8c00a6f4356760efb38bca0e0393aa06de upstream. The maker of this board and its variants, stores MAC address in U-Boot environment. Add alias for bootloader to recognise, to which ethernet node inject the factory MAC address. Signed-off-by: Tomasz Maciej Nowak Signed-off-by: Gregory CLEMENT [pali: Backported to 4.14] Signed-off-by: Pali Rohár Signed-off-by: Greg Kroah-Hartman --- arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts +++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts @@ -52,6 +52,10 @@ model = "Globalscale Marvell ESPRESSOBin Board"; compatible = "globalscale,espressobin", "marvell,armada3720", "marvell,armada3710"; + aliases { + ethernet0 = ð0; + }; + chosen { stdout-path = "serial0:115200n8"; };