From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8D5FC43334 for ; Tue, 19 Jul 2022 12:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241759AbiGSMsN (ORCPT ); Tue, 19 Jul 2022 08:48:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241725AbiGSMrF (ORCPT ); Tue, 19 Jul 2022 08:47:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4DC48C17A; Tue, 19 Jul 2022 05:18:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B5853B81B10; Tue, 19 Jul 2022 12:18:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12679C341C6; Tue, 19 Jul 2022 12:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233108; bh=ZHDS7axaqv3eoGXc0bA8B+TANT3b2ltotVfUt2qyR04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AHmuEJtVwPrBR5RDco9CnaIOZCaKaNlUUtOhY+3AawVVeABw/eWplNPKz0+wITxuJ hmJ2dekwLzYrEeuA1T1KKp+v2swCEDCt9qAnmYMmIit+lRKlP1cF+yraLZ/LtSyZ45 rte8pFh7ya2LLqt6dN/bYGQMn2UcuZx2VA7tf22Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucien Buchmann , Johan Hovold Subject: [PATCH 5.18 001/231] USB: serial: ftdi_sio: add Belimo device ids Date: Tue, 19 Jul 2022 13:51:26 +0200 Message-Id: <20220719114714.357456591@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lucien Buchmann commit 7c239a071d1f04b7137789810807b4108d475c72 upstream. Those two product ids are known. Signed-off-by: Lucien Buchmann Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/usb/serial/ftdi_sio.c | 3 +++ drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++ 2 files changed, 9 insertions(+) --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1023,6 +1023,9 @@ static const struct usb_device_id id_tab { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_DISPLAY_PID) }, { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_LITE_PID) }, { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ANALOG_PID) }, + /* Belimo Automation devices */ + { USB_DEVICE(FTDI_VID, BELIMO_ZTH_PID) }, + { USB_DEVICE(FTDI_VID, BELIMO_ZIP_PID) }, /* ICP DAS I-756xU devices */ { USB_DEVICE(ICPDAS_VID, ICPDAS_I7560U_PID) }, { USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) }, --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h @@ -1569,6 +1569,12 @@ #define CHETCO_SEASMART_ANALOG_PID 0xA5AF /* SeaSmart Analog Adapter */ =20 /* + * Belimo Automation + */ +#define BELIMO_ZTH_PID 0x8050 +#define BELIMO_ZIP_PID 0xC811 + +/* * Unjo AB */ #define UNJO_VID 0x22B7 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D7BEC433EF for ; Tue, 19 Jul 2022 12:50:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241829AbiGSMuc (ORCPT ); Tue, 19 Jul 2022 08:50:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241777AbiGSMss (ORCPT ); Tue, 19 Jul 2022 08:48:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 628998E1D0; Tue, 19 Jul 2022 05:19:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 92C94617D6; Tue, 19 Jul 2022 12:19:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70778C341C6; Tue, 19 Jul 2022 12:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233139; bh=rcwtNqc+GPYqJXpwkFe1nLuwgUVQoC9tmju2aIdG9LU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dhyJgwm28rt8AJKVoubWNXPYSdKiwMB1uGI6o1Fg4b2ueFMcWh8UCb2sNXt8oOI8J d1VpBLwdtMyrc//H7LEXEyYeEVvzpTQEWc/SGAdhNfCCv3lu7TWOwuazliUJcho5Nl BE7LjOxXRnfC49yYFa6aTjRFNAVxGW/9tfQKeAmM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linyu Yuan Subject: [PATCH 5.18 002/231] usb: typec: add missing uevent when partner support PD Date: Tue, 19 Jul 2022 13:51:27 +0200 Message-Id: <20220719114714.426482805@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linyu Yuan commit 6fb9e1d94789e8ee5a258a23bc588693f743fd6c upstream. System like Android allow user control power role from UI, it is possible to implement application base on typec uevent to refresh UI, but found there is chance that UI show different state from typec attribute file. In typec_set_pwr_opmode(), when partner support PD, there is no uevent send to user space which cause the problem. Fix it by sending uevent notification when change power mode to PD. Fixes: bdecb33af34f ("usb: typec: API for controlling USB Type-C Multiplexe= rs") Cc: stable@vger.kernel.org Signed-off-by: Linyu Yuan Link: https://lore.kernel.org/r/1656662934-10226-1-git-send-email-quic_liny= yuan@quicinc.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/usb/typec/class.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -1718,6 +1718,7 @@ void typec_set_pwr_opmode(struct typec_p partner->usb_pd =3D 1; sysfs_notify(&partner_dev->kobj, NULL, "supports_usb_power_delivery"); + kobject_uevent(&partner_dev->kobj, KOBJ_CHANGE); } put_device(partner_dev); } From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4851C433EF for ; Tue, 19 Jul 2022 12:50:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238056AbiGSMuw (ORCPT ); Tue, 19 Jul 2022 08:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241832AbiGSMtO (ORCPT ); Tue, 19 Jul 2022 08:49:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A83368E4E2; Tue, 19 Jul 2022 05:19:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2F1F761828; Tue, 19 Jul 2022 12:19:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1C5AC341C6; Tue, 19 Jul 2022 12:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233162; bh=OhqI3tmN1jI+O03uvUGXiDsTMffZQnJe7ltreY4ykBs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fzen81EuWztvNBwKmn72cGSf6qEbuJbLUIyqlhMm/bXzfias71llWjsMK6TmIbGr+ X2CaXyKNcbIIs95YDNJ8suFVdK6OIS3VQs8KUFzJpyYzhlr9H4B6DhCrFC/IDOtUvY xLl9gpk1byHGulj6hwOmmQD3THHJDsSBMpkpbemY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen Subject: [PATCH 5.18 003/231] usb: dwc3: gadget: Fix event pending check Date: Tue, 19 Jul 2022 13:51:28 +0200 Message-Id: <20220719114714.494293609@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thinh Nguyen commit 7441b273388b9a59d8387a03ffbbca9d5af6348c upstream. The DWC3_EVENT_PENDING flag is used to protect against invalid call to top-half interrupt handler, which can occur when there's a delay in software detection of the interrupt line deassertion. However, the clearing of this flag was done prior to unmasking the interrupt line, creating opportunity where the top-half handler can come. This breaks the serialization and creates a race between the top-half and bottom-half handler, resulting in losing synchronization between the controller and the driver when processing events. To fix this, make sure the clearing of the DWC3_EVENT_PENDING is done at the end of the bottom-half handler. Fixes: d325a1de49d6 ("usb: dwc3: gadget: Prevent losing events in event cac= he") Cc: stable@vger.kernel.org Signed-off-by: Thinh Nguyen Link: https://lore.kernel.org/r/8670aaf1cf52e7d1e6df2a827af2d77263b93b75.16= 56380429.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/usb/dwc3/gadget.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -4224,7 +4224,6 @@ static irqreturn_t dwc3_process_event_bu } =20 evt->count =3D 0; - evt->flags &=3D ~DWC3_EVENT_PENDING; ret =3D IRQ_HANDLED; =20 /* Unmask interrupt */ @@ -4236,6 +4235,9 @@ static irqreturn_t dwc3_process_event_bu dwc3_writel(dwc->regs, DWC3_DEV_IMOD(0), dwc->imod_interval); } =20 + /* Keep the clearing of DWC3_EVENT_PENDING at the end */ + evt->flags &=3D ~DWC3_EVENT_PENDING; + return ret; } From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98C2CC43334 for ; Tue, 19 Jul 2022 12:50:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241898AbiGSMu5 (ORCPT ); Tue, 19 Jul 2022 08:50:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241847AbiGSMtP (ORCPT ); Tue, 19 Jul 2022 08:49:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FDF357242; Tue, 19 Jul 2022 05:19:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DAB1F61772; Tue, 19 Jul 2022 12:19:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC7C0C341C6; Tue, 19 Jul 2022 12:19:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233165; bh=fWLVeCCoW64f3SORlNiUVtRzyubquhGPlJxz8Kjpo+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KXgQMN+AG0+NA/gHe7lFgBjJPGTjxcgLrCSXuo0N/IZWKHroininz9ovKtOVpt1P8 pAqHx4MgH4PECTHuzU32Wg86yeLZzdR3AdJ3SVFeqJkuAAeb8TZZguD1C/ZL29dP16 ndizdPTGYKt7mzHDlY3tQfmi24rcDF24wQYZEkFY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kent Gibson , Bartosz Golaszewski , Andy Shevchenko Subject: [PATCH 5.18 004/231] gpio: sim: fix the chip_name configfs item Date: Tue, 19 Jul 2022 13:51:29 +0200 Message-Id: <20220719114714.564175103@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski commit 7329b071729645e243b6207e76bca2f4951c991b upstream. The chip_name configs attribute always displays the device name of the first GPIO bank because the logic of the relevant function is simply wrong. Fix it by correctly comparing the bank's swnode against the GPIO device's children. Fixes: cb8c474e79be ("gpio: sim: new testing module") Cc: stable@vger.kernel.org Reported-by: Kent Gibson Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko Reviewed-by: Kent Gibson Tested-by: Kent Gibson Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpio/gpio-sim.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c index 98109839102f..1020c2feb249 100644 --- a/drivers/gpio/gpio-sim.c +++ b/drivers/gpio/gpio-sim.c @@ -991,28 +991,22 @@ static struct configfs_attribute *gpio_sim_device_con= fig_attrs[] =3D { }; =20 struct gpio_sim_chip_name_ctx { - struct gpio_sim_device *dev; + struct fwnode_handle *swnode; char *page; }; =20 static int gpio_sim_emit_chip_name(struct device *dev, void *data) { struct gpio_sim_chip_name_ctx *ctx =3D data; - struct fwnode_handle *swnode; - struct gpio_sim_bank *bank; =20 /* This would be the sysfs device exported in /sys/class/gpio. */ if (dev->class) return 0; =20 - swnode =3D dev_fwnode(dev); + if (device_match_fwnode(dev, ctx->swnode)) + return sprintf(ctx->page, "%s\n", dev_name(dev)); =20 - list_for_each_entry(bank, &ctx->dev->bank_list, siblings) { - if (bank->swnode =3D=3D swnode) - return sprintf(ctx->page, "%s\n", dev_name(dev)); - } - - return -ENODATA; + return 0; } =20 static ssize_t gpio_sim_bank_config_chip_name_show(struct config_item *ite= m, @@ -1020,7 +1014,7 @@ static ssize_t gpio_sim_bank_config_chip_name_show(st= ruct config_item *item, { struct gpio_sim_bank *bank =3D to_gpio_sim_bank(item); struct gpio_sim_device *dev =3D gpio_sim_bank_get_device(bank); - struct gpio_sim_chip_name_ctx ctx =3D { dev, page }; + struct gpio_sim_chip_name_ctx ctx =3D { bank->swnode, page }; int ret; =20 mutex_lock(&dev->lock); --=20 2.37.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F144C43334 for ; Tue, 19 Jul 2022 12:51:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241920AbiGSMu7 (ORCPT ); Tue, 19 Jul 2022 08:50:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241890AbiGSMtU (ORCPT ); Tue, 19 Jul 2022 08:49:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDCC857262; Tue, 19 Jul 2022 05:19:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5AA67B81B1A; Tue, 19 Jul 2022 12:19:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96B56C341C6; Tue, 19 Jul 2022 12:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233168; bh=tDk3be72/UF4Ume5NsKASOFXAKCgogPYwNFyRZ70KOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xG0DA5JFcLyMFSxav++3lofmEJPLAAsb/T7R4sGSwTEIYLU/pvwMFBDqn51xy/eCm fhHzU9GUi//4bwa1xEXip8+eEfPtet9KcTW/mRo7ZPzfWi6tX+GzyyZGX1/EaKqdN5 VKoiUePsStbgklTXwu6pkUPexwmICbMDF7xfqjdU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Marek Szyprowski , Krzysztof Kozlowski , Chanho Park Subject: [PATCH 5.18 005/231] tty: serial: samsung_tty: set dma burst_size to 1 Date: Tue, 19 Jul 2022 13:51:30 +0200 Message-Id: <20220719114714.634827047@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chanho Park commit f7e35e4bf1e8dc2c8cbd5e0955dc1bd58558dae0 upstream. The src_maxburst and dst_maxburst have been changed to 1 but the settings of the UCON register aren't changed yet. They should be changed as well according to the dmaengine slave config. Fixes: aa2f80e752c7 ("serial: samsung: fix maxburst parameter for DMA trans= actions") Cc: stable Cc: Marek Szyprowski Reviewed-by: Krzysztof Kozlowski Signed-off-by: Chanho Park Link: https://lore.kernel.org/r/20220627065113.139520-1-chanho61.park@samsu= ng.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/serial/samsung_tty.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -377,8 +377,7 @@ static void enable_tx_dma(struct s3c24xx /* Enable tx dma mode */ ucon =3D rd_regl(port, S3C2410_UCON); ucon &=3D ~(S3C64XX_UCON_TXBURST_MASK | S3C64XX_UCON_TXMODE_MASK); - ucon |=3D (dma_get_cache_alignment() >=3D 16) ? - S3C64XX_UCON_TXBURST_16 : S3C64XX_UCON_TXBURST_1; + ucon |=3D S3C64XX_UCON_TXBURST_1; ucon |=3D S3C64XX_UCON_TXMODE_DMA; wr_regl(port, S3C2410_UCON, ucon); =20 @@ -674,7 +673,7 @@ static void enable_rx_dma(struct s3c24xx S3C64XX_UCON_DMASUS_EN | S3C64XX_UCON_TIMEOUT_EN | S3C64XX_UCON_RXMODE_MASK); - ucon |=3D S3C64XX_UCON_RXBURST_16 | + ucon |=3D S3C64XX_UCON_RXBURST_1 | 0xf << S3C64XX_UCON_TIMEOUT_SHIFT | S3C64XX_UCON_EMPTYINT_EN | S3C64XX_UCON_TIMEOUT_EN | From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABEBFC433EF for ; Tue, 19 Jul 2022 12:51:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241928AbiGSMvE (ORCPT ); Tue, 19 Jul 2022 08:51:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241906AbiGSMtV (ORCPT ); Tue, 19 Jul 2022 08:49:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 190EF8E4F1; Tue, 19 Jul 2022 05:19:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7FF13617B2; Tue, 19 Jul 2022 12:19:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FA1DC341CA; Tue, 19 Jul 2022 12:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233170; bh=wt4k0BMHgTqMtsDUiI5OoAhxupig8hdc03zTNxLLy00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xBbZJ2U++1hAKuOdpdt2gxPKlU1hujt/Im+NPNUKgwYYAWECie+Bfukz4muHXq6Q6 YN9ceJK1n5OTQdg94HRzFdkY7BJ1rnQhY3QwqbqwKM/swJZtKJu7W5X4SXieHQWLV1 gU/ipfiJOi46r2uXnZ9e++DkljU5bWdjsCCqnTlY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Borislav Petkov , Jan Beulich , Boris Ostrovsky Subject: [PATCH 5.18 006/231] x86/xen: Use clear_bss() for Xen PV guests Date: Tue, 19 Jul 2022 13:51:31 +0200 Message-Id: <20220719114714.704934047@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Juergen Gross commit 96e8fc5818686d4a1591bb6907e7fdb64ef29884 upstream. Instead of clearing the bss area in assembly code, use the clear_bss() function. This requires to pass the start_info address as parameter to xen_start_kernel() in order to avoid the xen_start_info being zeroed again. Signed-off-by: Juergen Gross Signed-off-by: Borislav Petkov Reviewed-by: Jan Beulich Reviewed-by: Boris Ostrovsky Link: https://lore.kernel.org/r/20220630071441.28576-2-jgross@suse.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/x86/include/asm/setup.h | 3 +++ arch/x86/kernel/head64.c | 2 +- arch/x86/xen/enlighten_pv.c | 8 ++++++-- arch/x86/xen/xen-head.S | 10 +--------- 4 files changed, 11 insertions(+), 12 deletions(-) --- a/arch/x86/include/asm/setup.h +++ b/arch/x86/include/asm/setup.h @@ -132,6 +132,9 @@ void *extend_brk(size_t size, size_t ali } =20 extern void probe_roms(void); + +void clear_bss(void); + #ifdef __i386__ =20 asmlinkage void __init i386_start_kernel(void); --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -421,7 +421,7 @@ void __init do_early_exception(struct pt =20 /* Don't add a printk in there. printk relies on the PDA which is not init= ialized=20 yet. */ -static void __init clear_bss(void) +void __init clear_bss(void) { memset(__bss_start, 0, (unsigned long) __bss_stop - (unsigned long) __bss_start); --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -1183,15 +1183,19 @@ static void __init xen_domu_set_legacy_f extern void early_xen_iret_patch(void); =20 /* First C function to be called on Xen boot */ -asmlinkage __visible void __init xen_start_kernel(void) +asmlinkage __visible void __init xen_start_kernel(struct start_info *si) { struct physdev_set_iopl set_iopl; unsigned long initrd_start =3D 0; int rc; =20 - if (!xen_start_info) + if (!si) return; =20 + clear_bss(); + + xen_start_info =3D si; + __text_gen_insn(&early_xen_iret_patch, JMP32_INSN_OPCODE, &early_xen_iret_patch, &xen_iret, JMP32_INSN_SIZE); --- a/arch/x86/xen/xen-head.S +++ b/arch/x86/xen/xen-head.S @@ -48,15 +48,6 @@ SYM_CODE_START(startup_xen) ANNOTATE_NOENDBR cld =20 - /* Clear .bss */ - xor %eax,%eax - mov $__bss_start, %rdi - mov $__bss_stop, %rcx - sub %rdi, %rcx - shr $3, %rcx - rep stosq - - mov %rsi, xen_start_info mov initial_stack(%rip), %rsp =20 /* Set up %gs. @@ -71,6 +62,7 @@ SYM_CODE_START(startup_xen) cdq wrmsr =20 + mov %rsi, %rdi call xen_start_kernel SYM_CODE_END(startup_xen) __FINIT From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02388CCA47F for ; Tue, 19 Jul 2022 12:51:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241828AbiGSMvH (ORCPT ); Tue, 19 Jul 2022 08:51:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241964AbiGSMt1 (ORCPT ); Tue, 19 Jul 2022 08:49:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 003CB57239; Tue, 19 Jul 2022 05:19:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E5A5DB81B10; Tue, 19 Jul 2022 12:19:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FC1AC341C6; Tue, 19 Jul 2022 12:19:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233173; bh=pDdl6SrgjTaZos2aFU5eHtS6uXHfP+Tj9so6V++wH9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H1GWhs1Und6XznlEhwm7Ko3eB5SWIY7m0S142fArMYJMxZJWW52TwExofYJDh/VuD LT2tCt6xwSWYHRDMMAyJgpOLki/VXzS321ZqBK6YJi/h+hoEKradh/GAn91sW1+C3p Uj7Rl/CCD6iy5Ofc7kd1p8w6jFt2tzECgvwxVGMQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.18 007/231] ALSA: hda - Add fixup for Dell Latitidue E5430 Date: Tue, 19 Jul 2022 13:51:32 +0200 Message-Id: <20220719114714.775497020@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit 841bdf85c226803a78a9319af9b2caa9bf3e2eda upstream. Another Dell model, another fixup entry: Latitude E5430 needs the same fixup as other Latitude E series as workaround for noise problems. Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220712060005.20176-1-tangmeng@uniontech.c= om Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8947,6 +8947,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_AC= ER_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HE= ADPHONE_AND_MIC), SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), + SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7= X), SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS), SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7= X), SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7= X), From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C730C433EF for ; Tue, 19 Jul 2022 12:51:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241910AbiGSMvL (ORCPT ); Tue, 19 Jul 2022 08:51:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242011AbiGSMtd (ORCPT ); Tue, 19 Jul 2022 08:49:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AFAE57251; Tue, 19 Jul 2022 05:19:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B6D47B81B21; Tue, 19 Jul 2022 12:19:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D7A6C341CB; Tue, 19 Jul 2022 12:19:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233176; bh=sbQIp1iuSqFAx1B/WohVsdh2Cc+XuohFd1zUxHgf1og=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KgLP1gDLId6YDzsNSo9ynAfmwK/+VKFA4Qun4rMdga2shpP6FyPVYnQlWGq7GDdG8 2pCLMiXeDG7JWsaOvxsaDvyTtfsvPbtLy9T8v34R6ashmRQBDFxL+vXRijdr+TVKzY yLbEwrIQzv3gbEmzlJH0FqtA+LF9DVzgJpO4jnn4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.18 008/231] ALSA: hda/conexant: Apply quirk for another HP ProDesk 600 G3 model Date: Tue, 19 Jul 2022 13:51:33 +0200 Message-Id: <20220719114714.845346554@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit d16d69bf5a25d91c6d8f3e29711be12551bf56cd upstream. There is another HP ProDesk 600 G3 model with the PCI SSID 103c:82b4 that requires the quirk HP_MIC_NO_PRESENCE. Add the corresponding entry to the quirk table. Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220711101744.25189-1-tangmeng@uniontech.c= om Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -944,6 +944,7 @@ static const struct snd_pci_quirk cxt506 SND_PCI_QUIRK(0x103c, 0x828c, "HP EliteBook 840 G4", CXT_FIXUP_HP_DOCK), SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESEN= CE), SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENC= E), + SND_PCI_QUIRK(0x103c, 0x82b4, "HP ProDesk 600 G3", CXT_FIXUP_HP_MIC_NO_PR= ESENCE), SND_PCI_QUIRK(0x103c, 0x836e, "HP ProBook 455 G5", CXT_FIXUP_MUTE_LED_GPI= O), SND_PCI_QUIRK(0x103c, 0x837f, "HP ProBook 470 G5", CXT_FIXUP_MUTE_LED_GPI= O), SND_PCI_QUIRK(0x103c, 0x83b2, "HP EliteBook 840 G5", CXT_FIXUP_HP_DOCK), From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27D78C43334 for ; Tue, 19 Jul 2022 12:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241885AbiGSMvP (ORCPT ); Tue, 19 Jul 2022 08:51:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242009AbiGSMtd (ORCPT ); Tue, 19 Jul 2022 08:49:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48EEE57E0A; Tue, 19 Jul 2022 05:19:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 22A2561772; Tue, 19 Jul 2022 12:19:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E83D5C341C6; Tue, 19 Jul 2022 12:19:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233179; bh=ZtuTMOXdGKSBN/V/+9/N8POc6UZtNU7FV97Ie2c+9aw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UOY72UHanwdFx09UarZvYyIQhhc2dwaMiCFNAGybkWyfOq3Ni7optrHEJZz7RGGzi wLXSu6R550kZ262+TQfQvsk8vhSQy/4fK3FjUciZWAje7gIhIzRB/Dbvw+ZzzKPHwv zTh+uFjAqrEGdn3HQQ7O9UnovcZJ7XtTXiYv7dWw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.18 009/231] ALSA: hda/realtek: Fix headset mic for Acer SF313-51 Date: Tue, 19 Jul 2022 13:51:34 +0200 Message-Id: <20220719114714.914212537@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit 5f3fe25e70559fa3b096ab17e13316c93ddb7020 upstream. The issue on Acer SWIFT SF313-51 is that headset microphone doesn't work. The following quirk fixed headset microphone issue. Note that the fixup of SF314-54/55 (ALC256_FIXUP_ACER_HEADSET_MIC) was not successful on my SF313-51. Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220711081527.6254-1-tangmeng@uniontech.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8938,6 +8938,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AI= O_HEADSET_MIC), SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AI= O_HEADSET_MIC), SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HE= ADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AI= O_HEADSET_MIC), SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACE= R_HEADSET_MIC), From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C12FC433EF for ; Tue, 19 Jul 2022 12:48:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241723AbiGSMsG (ORCPT ); Tue, 19 Jul 2022 08:48:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237982AbiGSMqt (ORCPT ); Tue, 19 Jul 2022 08:46:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D6A48BABA; Tue, 19 Jul 2022 05:18:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2F271617D6; Tue, 19 Jul 2022 12:18:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3417C341C6; Tue, 19 Jul 2022 12:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233111; bh=xOYMziX2QG4wm2a/EwKtOEu7/+/i9JFOR3PM4c+yByU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pIzCJNJqwdB1NGExuPoneqmhY+gLesAK4UNfMZ8aCYl/tswqidiHimoj/1PpLC5zm x9RN4i45g9MO2VtjPxLIbmP2ovtqEzY5lC8BYcl4SVwOpo2IX9RgyoqlKBBAJ4U2FJ fEx7HRmgcQui0QtiSY5JMuC1rtr23OA4bm4I2ylY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.18 010/231] ALSA: hda/realtek - Fix headset mic problem for a HP machine with alc671 Date: Tue, 19 Jul 2022 13:51:35 +0200 Message-Id: <20220719114714.983953157@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit dbe75d314748e08fc6e4576d153d8a69621ee5ca upstream. On a HP 288 Pro G6, the front mic could not be detected.In order to get it working, the pin configuration needs to be set correctly, and the ALC671_FIXUP_HP_HEADSET_MIC2 fixup needs to be applied. Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220712092222.21738-1-tangmeng@uniontech.c= om Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -11271,6 +11271,7 @@ static const struct snd_pci_quirk alc662 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB), SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2), + SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MI= C2), SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MI= C2), SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE), SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50), From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64557C43334 for ; Tue, 19 Jul 2022 12:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241754AbiGSMsL (ORCPT ); Tue, 19 Jul 2022 08:48:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241564AbiGSMrB (ORCPT ); Tue, 19 Jul 2022 08:47:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F6468C175; Tue, 19 Jul 2022 05:18:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8868FB81B1C; Tue, 19 Jul 2022 12:18:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7DF6C341C6; Tue, 19 Jul 2022 12:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233114; bh=DWB2cZA/YN6PlgZJ4+edHlXMXYgaHDWmuWA3njegogo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=03Bd/XT1VYe7J6VfXOals98VyJceI7fhnTl96qBGWOaXRstAJCzBYTzy8yxaRaIvF Kj1ueVzx2dKo6S6aEp2o6Cx90SF0NVDD1WtHAoq2qfTqR3P0OwyA7uwI/AuS6A46MN 8au6QAl4rqJwhMwdGUnpT71+q4QCR3WSAYifRMc4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeremy Szu , Takashi Iwai Subject: [PATCH 5.18 011/231] ALSA: hda/realtek: fix mute/micmute LEDs for HP machines Date: Tue, 19 Jul 2022 13:51:36 +0200 Message-Id: <20220719114715.053674705@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeremy Szu commit 61d307855eb1a2ae849da445edd5389db8a58a5c upstream. The HP ProBook 440/450 G9 and EliteBook 640/650 G9 have multiple motherboard design and they are using different subsystem ID of audio codec. Add the same quirk for other MBs. Signed-off-by: Jeremy Szu Cc: Link: https://lore.kernel.org/r/20220713022706.22892-1-jeremy.szu@canonical= .com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/pci/hda/patch_realtek.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9150,6 +9150,10 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SP= I_2_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF= ), SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC= _BOOST), + SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP= _HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP= _HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIX= UP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIX= UP_HP_GPIO_LED), SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BO= OST), From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8679EC433EF for ; Tue, 19 Jul 2022 12:48:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241546AbiGSMsx (ORCPT ); Tue, 19 Jul 2022 08:48:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241478AbiGSMsb (ORCPT ); Tue, 19 Jul 2022 08:48:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96C4A8C77C; Tue, 19 Jul 2022 05:18:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4A37FB81B21; Tue, 19 Jul 2022 12:18:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0D2CC341C6; Tue, 19 Jul 2022 12:18:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233117; bh=nd5XThiMS5bNTrVZ627Uc8nnHQ5njowoSzy1XFgRRFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mGz4QgeYo9WsclsgnEhtPUqcX/+8zshEfdfC/5nlCShnTejUa2n1GjJO/Vgww9hgj GpQ093C8gcdUhqDRsUt4KKJLMFAsMbFP1Zs+irOt1/Uq0N/ipqaG4tI7cIHPvckQdK vuGdkuKYpjDT/G1eJiBwQiiqAL9Gg6iAubJPY/oA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.18 012/231] ALSA: hda/realtek - Fix headset mic problem for a HP machine with alc221 Date: Tue, 19 Jul 2022 13:51:37 +0200 Message-Id: <20220719114715.123281532@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit 4ba5c853d7945b3855c3dcb293f7f9f019db641e upstream. On a HP 288 Pro G2 MT (X9W02AV), the front mic could not be detected. In order to get it working, the pin configuration needs to be set correctly, and the ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE fixup needs to be applied. Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220713063332.30095-1-tangmeng@uniontech.c= om Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/pci/hda/patch_realtek.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6953,6 +6953,7 @@ enum { ALC298_FIXUP_LENOVO_SPK_VOLUME, ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, ALC269_FIXUP_ATIV_BOOK_8, + ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE, ALC221_FIXUP_HP_MIC_NO_PRESENCE, ALC256_FIXUP_ASUS_HEADSET_MODE, ALC256_FIXUP_ASUS_MIC, @@ -7889,6 +7890,16 @@ static const struct hda_fixup alc269_fix .chained =3D true, .chain_id =3D ALC269_FIXUP_NO_SHUTUP }, + [ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] =3D { + .type =3D HDA_FIXUP_PINS, + .v.pins =3D (const struct hda_pintbl[]) { + { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detec= t */ + { 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack det= ect */ + { } + }, + .chained =3D true, + .chain_id =3D ALC269_FIXUP_HEADSET_MODE + }, [ALC221_FIXUP_HP_MIC_NO_PRESENCE] =3D { .type =3D HDA_FIXUP_PINS, .v.pins =3D (const struct hda_pintbl[]) { @@ -9064,6 +9075,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_= MIC_NO_PRESENCE), SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESE= NCE), SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC), From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A602C433EF for ; Tue, 19 Jul 2022 12:48:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241692AbiGSMss (ORCPT ); Tue, 19 Jul 2022 08:48:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241772AbiGSMs3 (ORCPT ); Tue, 19 Jul 2022 08:48:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B95BC8CCA2; Tue, 19 Jul 2022 05:19:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B0B9D6177F; Tue, 19 Jul 2022 12:18:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92823C341C6; Tue, 19 Jul 2022 12:18:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233120; bh=GI93qm+hNCMbPVCaHUDMokRaQgsWxtQUOoMPeSa7lCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZWxxsWCjZUxlwFCne01mJfAe3D1UeKgzCYC7YM3pwNSt8RUMe+3CEd2+2g0RNO1qW kmZkwYbEjXSGvEHQr5ameTSMuOMrDiGjBjcsDDv3JrkLqi46Y6K7GZIudXbIxw4dPk 84xkiQJchf1W0u2odP5Mbj4tj/PnMQSMfV1lW4Jw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.18 013/231] ALSA: hda/realtek - Enable the headset-mic on a Xiaomis laptop Date: Tue, 19 Jul 2022 13:51:38 +0200 Message-Id: <20220719114715.192367792@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit 9b043a8f386485c74c0f8eea2c287d5bdbdf3279 upstream. The headset on this machine is not defined, after applying the quirk ALC256_FIXUP_ASUS_HEADSET_MIC, the headset-mic works well Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220713094133.9894-1-tangmeng@uniontech.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9425,6 +9425,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MI= C), SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_M= IC), + SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC), SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSE= T_MIC), SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC= ), SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NU= C8_RUGGED), From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C0D8CCA47F for ; Tue, 19 Jul 2022 12:49:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241749AbiGSMtA (ORCPT ); Tue, 19 Jul 2022 08:49:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241743AbiGSMsf (ORCPT ); Tue, 19 Jul 2022 08:48:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B93598CCB8; Tue, 19 Jul 2022 05:19:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0A9FAB81B13; Tue, 19 Jul 2022 12:18:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 727B7C341C6; Tue, 19 Jul 2022 12:18:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233122; bh=Xm0MwoDW/hV6tsQcoq3CJwBjGnfYANhsNhn7svWmwSM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dXRK/WK9Rw/RhkKqWul6PK1Qx7dNxGWFpuJDIKNvO3wBELI8s97vHjKP1W+tOkRo6 T47r0BJArKY3E8A1VQoZiTROjz5gbj4xlEqG3VsOP2PCnKThA9TwSZtj0Oe9EqY5Y2 GLfewqrPtjJ9DMWwFk1N5X//PAaZkdsQ4zeKqw4Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Jan Beulich , Paul Durrant , Jakub Kicinski Subject: [PATCH 5.18 014/231] xen/netback: avoid entering xenvif_rx_next_skb() with an empty rx queue Date: Tue, 19 Jul 2022 13:51:39 +0200 Message-Id: <20220719114715.261650516@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Juergen Gross commit 94e8100678889ab428e68acadf042de723f094b9 upstream. xenvif_rx_next_skb() is expecting the rx queue not being empty, but in case the loop in xenvif_rx_action() is doing multiple iterations, the availability of another skb in the rx queue is not being checked. This can lead to crashes: [40072.537261] BUG: unable to handle kernel NULL pointer dereference at 000= 0000000000080 [40072.537407] IP: xenvif_rx_skb+0x23/0x590 [xen_netback] [40072.537534] PGD 0 P4D 0 [40072.537644] Oops: 0000 [#1] SMP NOPTI [40072.537749] CPU: 0 PID: 12505 Comm: v1-c40247-q2-gu Not tainted 4.12.14-= 122.121-default #1 SLE12-SP5 [40072.537867] Hardware name: HP ProLiant DL580 Gen9/ProLiant DL580 Gen9, B= IOS U17 11/23/2021 [40072.537999] task: ffff880433b38100 task.stack: ffffc90043d40000 [40072.538112] RIP: e030:xenvif_rx_skb+0x23/0x590 [xen_netback] [40072.538217] RSP: e02b:ffffc90043d43de0 EFLAGS: 00010246 [40072.538319] RAX: 0000000000000000 RBX: ffffc90043cd7cd0 RCX: 00000000000= 000f7 [40072.538430] RDX: 0000000000000000 RSI: 0000000000000006 RDI: ffffc90043d= 43df8 [40072.538531] RBP: 000000000000003f R08: 000077ff80000000 R09: 00000000000= 00008 [40072.538644] R10: 0000000000007ff0 R11: 00000000000008f6 R12: ffffc90043c= e2708 [40072.538745] R13: 0000000000000000 R14: ffffc90043d43ed0 R15: ffff88043ea= 748c0 [40072.538861] FS: 0000000000000000(0000) GS:ffff880484600000(0000) knlGS:0= 000000000000000 [40072.538988] CS: e033 DS: 0000 ES: 0000 CR0: 0000000080050033 [40072.539088] CR2: 0000000000000080 CR3: 0000000407ac8000 CR4: 00000000000= 40660 [40072.539211] Call Trace: [40072.539319] xenvif_rx_action+0x71/0x90 [xen_netback] [40072.539429] xenvif_kthread_guest_rx+0x14a/0x29c [xen_netback] Fix that by stopping the loop in case the rx queue becomes empty. Cc: stable@vger.kernel.org Fixes: 98f6d57ced73 ("xen-netback: process guest rx packets in batches") Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich Reviewed-by: Paul Durrant Link: https://lore.kernel.org/r/20220713135322.19616-1-jgross@suse.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/xen-netback/rx.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/xen-netback/rx.c +++ b/drivers/net/xen-netback/rx.c @@ -495,6 +495,7 @@ void xenvif_rx_action(struct xenvif_queu queue->rx_copy.completed =3D &completed_skbs; =20 while (xenvif_rx_ring_slots_available(queue) && + !skb_queue_empty(&queue->rx_queue) && work_done < RX_BATCH_SIZE) { xenvif_rx_skb(queue); work_done++; From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B979C433EF for ; Tue, 19 Jul 2022 12:49:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238819AbiGSMtC (ORCPT ); Tue, 19 Jul 2022 08:49:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241748AbiGSMsk (ORCPT ); Tue, 19 Jul 2022 08:48:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 932368D5C2; Tue, 19 Jul 2022 05:19:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7751561772; Tue, 19 Jul 2022 12:18:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43E2FC341C6; Tue, 19 Jul 2022 12:18:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233125; bh=cE9sIt38eBhRfDpYGx4HJdKLYvjDvOLe+ix01eVk/sk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wmbAzlKenua4o5TJdgRIOBbchz6rO3VIDH1GvTuvaNF79LReWBIKi5cC6iKlieuQM kxEaix+muEQlfF79dxWePbuHVchk799Zn/uxP9hhx+ZOwi6u0ots6bD3gy1AQ71yJf 263Hrw5/wFl6bxDgKJdnPE6fqLT8JXCT5yup/GJU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, chris@accessvector.net, Oleg Nesterov , Linus Torvalds Subject: [PATCH 5.18 015/231] fix race between exit_itimers() and /proc/pid/timers Date: Tue, 19 Jul 2022 13:51:40 +0200 Message-Id: <20220719114715.333404242@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oleg Nesterov commit d5b36a4dbd06c5e8e36ca8ccc552f679069e2946 upstream. As Chris explains, the comment above exit_itimers() is not correct, we can race with proc_timers_seq_ops. Change exit_itimers() to clear signal->posix_timers with ->siglock held. Cc: Reported-by: chris@accessvector.net Signed-off-by: Oleg Nesterov Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/exec.c | 2 +- include/linux/sched/task.h | 2 +- kernel/exit.c | 2 +- kernel/time/posix-timers.c | 19 ++++++++++++++----- 4 files changed, 17 insertions(+), 8 deletions(-) --- a/fs/exec.c +++ b/fs/exec.c @@ -1297,7 +1297,7 @@ int begin_new_exec(struct linux_binprm * bprm->mm =3D NULL; =20 #ifdef CONFIG_POSIX_TIMERS - exit_itimers(me->signal); + exit_itimers(me); flush_itimer_signals(); #endif =20 --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h @@ -83,7 +83,7 @@ static inline void exit_thread(struct ta extern __noreturn void do_group_exit(int); =20 extern void exit_files(struct task_struct *); -extern void exit_itimers(struct signal_struct *); +extern void exit_itimers(struct task_struct *); =20 extern pid_t kernel_clone(struct kernel_clone_args *kargs); struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int nod= e); --- a/kernel/exit.c +++ b/kernel/exit.c @@ -766,7 +766,7 @@ void __noreturn do_exit(long code) =20 #ifdef CONFIG_POSIX_TIMERS hrtimer_cancel(&tsk->signal->real_timer); - exit_itimers(tsk->signal); + exit_itimers(tsk); #endif if (tsk->mm) setmax_mm_hiwater_rss(&tsk->signal->maxrss, tsk->mm); --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -1051,15 +1051,24 @@ retry_delete: } =20 /* - * This is called by do_exit or de_thread, only when there are no more - * references to the shared signal_struct. + * This is called by do_exit or de_thread, only when nobody else can + * modify the signal->posix_timers list. Yet we need sighand->siglock + * to prevent the race with /proc/pid/timers. */ -void exit_itimers(struct signal_struct *sig) +void exit_itimers(struct task_struct *tsk) { + struct list_head timers; struct k_itimer *tmr; =20 - while (!list_empty(&sig->posix_timers)) { - tmr =3D list_entry(sig->posix_timers.next, struct k_itimer, list); + if (list_empty(&tsk->signal->posix_timers)) + return; + + spin_lock_irq(&tsk->sighand->siglock); + list_replace_init(&tsk->signal->posix_timers, &timers); + spin_unlock_irq(&tsk->sighand->siglock); + + while (!list_empty(&timers)) { + tmr =3D list_first_entry(&timers, struct k_itimer, list); itimer_delete(tmr); } } From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 025C6C43334 for ; Tue, 19 Jul 2022 12:50:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241776AbiGSMuU (ORCPT ); Tue, 19 Jul 2022 08:50:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241667AbiGSMsm (ORCPT ); Tue, 19 Jul 2022 08:48:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A45D8D5DE; Tue, 19 Jul 2022 05:19:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C87B1B81B10; Tue, 19 Jul 2022 12:18:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2436FC341C6; Tue, 19 Jul 2022 12:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233128; bh=rgXUttIrCJXhvzmAYfs7u6gm3QoGgvQv12sDrFaR+NQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=saoscKWLpcMEYxPjuCCHKFRUasGZNXccDEkqiKKPAR+GTsPRNtXkdYHkNCU1V55kQ zpqZUwsBthor76/OgeA3HC2/EpENZH+nr4Y8ZOT5C8nkrqJtrkfi/B+Gcm6+sJJ5dz ZQ1nnVv/Ml8OVkEs2gr+9zJcNY0KYPJ1lj17Yo1U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Axel Rasmussen , Peter Xu , Hugh Dickins , Andrew Morton Subject: [PATCH 5.18 016/231] mm: userfaultfd: fix UFFDIO_CONTINUE on fallocated shmem pages Date: Tue, 19 Jul 2022 13:51:41 +0200 Message-Id: <20220719114715.404069935@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Axel Rasmussen commit 73f37dbcfe1763ee2294c7717a1f571e27d17fd8 upstream. When fallocate() is used on a shmem file, the pages we allocate can end up with !PageUptodate. Since UFFDIO_CONTINUE tries to find the existing page the user wants to map with SGP_READ, we would fail to find such a page, since shmem_getpage_gfp returns with a "NULL" pagep for SGP_READ if it discovers !PageUptodate. As a result, UFFDIO_CONTINUE returns -EFAULT, as it would do if the page wasn't found in the page cache at all. This isn't the intended behavior. UFFDIO_CONTINUE is just trying to find if a page exists, and doesn't care whether it still needs to be cleared or not. So, instead of SGP_READ, pass in SGP_NOALLOC. This is the same, except for one critical difference: in the !PageUptodate case, SGP_NOALLOC will clear the page and then return it. With this change, UFFDIO_CONTINUE works properly (succeeds) on a shmem file which has been fallocated, but otherwise not modified. Link: https://lkml.kernel.org/r/20220610173812.1768919-1-axelrasmussen@goog= le.com Fixes: 153132571f02 ("userfaultfd/shmem: support UFFDIO_CONTINUE for shmem") Signed-off-by: Axel Rasmussen Acked-by: Peter Xu Cc: Hugh Dickins Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- mm/userfaultfd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -231,7 +231,10 @@ static int mcontinue_atomic_pte(struct m struct page *page; int ret; =20 - ret =3D shmem_getpage(inode, pgoff, &page, SGP_READ); + ret =3D shmem_getpage(inode, pgoff, &page, SGP_NOALLOC); + /* Our caller expects us to return -EFAULT if we failed to find page. */ + if (ret =3D=3D -ENOENT) + ret =3D -EFAULT; if (ret) goto out; if (!page) { From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79610C43334 for ; Tue, 19 Jul 2022 12:48:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241567AbiGSMs4 (ORCPT ); Tue, 19 Jul 2022 08:48:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241488AbiGSMsb (ORCPT ); Tue, 19 Jul 2022 08:48:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F6EE8C761; Tue, 19 Jul 2022 05:18:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 94936B81B1C; Tue, 19 Jul 2022 12:18:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EABCDC341C6; Tue, 19 Jul 2022 12:18:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233131; bh=Xqwg7JtPMDLqWkar0qZiMQvS5epYSo4zrSmrUigssec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qFcrKzzyYaDawnJqi1q2TSp9je9MH2/fqQu4H+leNj79Ew7Rr8FXoCI79cjUvrmmz DhuDUaim3z2RaRCswP6jc8kyXoHnVIWuiEZC6pLUQqPVJO4he74cTFq0ouU9kedpYq JSAQb9doM/3o4U105/hz/ToDzD1THYtHNvLQ8DlU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Muchun Song , Mike Kravetz , Xiongchun Duan , Andrew Morton Subject: [PATCH 5.18 017/231] mm: sparsemem: fix missing higher order allocation splitting Date: Tue, 19 Jul 2022 13:51:42 +0200 Message-Id: <20220719114715.473649310@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Muchun Song commit 39d35edee4537487e5178f258e23518272a66413 upstream. Higher order allocations for vmemmap pages from buddy allocator must be able to be treated as indepdenent small pages as they can be freed individually by the caller. There is no problem for higher order vmemmap pages allocated at boot time since each individual small page will be initialized at boot time. However, it will be an issue for memory hotplug case since those higher order vmemmap pages are allocated from buddy allocator without initializing each individual small page's refcount. The system will panic in put_page_testzero() when CONFIG_DEBUG_VM is enabled if the vmemmap page is freed. Link: https://lkml.kernel.org/r/20220620023019.94257-1-songmuchun@bytedance= .com Fixes: d8d55f5616cf ("mm: sparsemem: use page table lock to protect kernel = pmd operations") Signed-off-by: Muchun Song Reviewed-by: Mike Kravetz Cc: Xiongchun Duan Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- mm/sparse-vmemmap.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c index f4fa61dbbee3..dbbd1a7e65f3 100644 --- a/mm/sparse-vmemmap.c +++ b/mm/sparse-vmemmap.c @@ -78,6 +78,14 @@ static int __split_vmemmap_huge_pmd(pmd_t *pmd, unsigned= long start) =20 spin_lock(&init_mm.page_table_lock); if (likely(pmd_leaf(*pmd))) { + /* + * Higher order allocations from buddy allocator must be able to + * be treated as indepdenent small pages (as they can be freed + * individually). + */ + if (!PageReserved(page)) + split_page(page, get_order(PMD_SIZE)); + /* Make pte visible before pmd. See comment in pmd_install(). */ smp_wmb(); pmd_populate_kernel(&init_mm, pmd, pgtable); --=20 2.37.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04EAEC433EF for ; Tue, 19 Jul 2022 12:50:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238673AbiGSMuM (ORCPT ); Tue, 19 Jul 2022 08:50:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241657AbiGSMsl (ORCPT ); Tue, 19 Jul 2022 08:48:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B2BD8D5E2; Tue, 19 Jul 2022 05:19:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ECAF661828; Tue, 19 Jul 2022 12:18:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAE4DC341CA; Tue, 19 Jul 2022 12:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233134; bh=Py1zK+XLvycwCYOpCmtly3XgkhA2P15zodr8J4XcNqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qYn0sfguiFS1B7wK0OwXWMdud9IMfzSwXL43CL9QJ9QsnnukXGc3WAuE/nhau1vsF E16xHtAtQWAkCMNPJjBoBc3ssUaqe5UR6uHxMq31aeYsKM1+jREfb6NoWc6Kp10kpT UBelWJZhDoaSPwzns3XeeS5a50aPyBpYnfzQQGMY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Gowans , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , =?UTF-8?q?Christian=20K=C3=B6nig?= , "=?UTF-8?q?Jan=20H . =20Sch=C3=B6nherr?=" , Andrew Morton Subject: [PATCH 5.18 018/231] mm: split huge PUD on wp_huge_pud fallback Date: Tue, 19 Jul 2022 13:51:43 +0200 Message-Id: <20220719114715.544709277@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gowans, James commit 14c99d65941538aa33edd8dc7b1bbbb593c324a2 upstream. Currently the implementation will split the PUD when a fallback is taken inside the create_huge_pud function. This isn't where it should be done: the splitting should be done in wp_huge_pud, just like it's done for PMDs. Reason being that if a callback is taken during create, there is no PUD yet so nothing to split, whereas if a fallback is taken when encountering a write protection fault there is something to split. It looks like this was the original intention with the commit where the splitting was introduced, but somehow it got moved to the wrong place between v1 and v2 of the patch series. Rebase mistake perhaps. Link: https://lkml.kernel.org/r/6f48d622eb8bce1ae5dd75327b0b73894a2ec407.ca= mel@amazon.com Fixes: 327e9fd48972 ("mm: Split huge pages on write-notify or COW") Signed-off-by: James Gowans Reviewed-by: Thomas Hellstr=C3=B6m Cc: Christian K=C3=B6nig Cc: Jan H. Sch=C3=B6nherr Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- mm/memory.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) --- a/mm/memory.c +++ b/mm/memory.c @@ -4528,6 +4528,19 @@ static vm_fault_t create_huge_pud(struct defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD) /* No support for anonymous transparent PUD pages yet */ if (vma_is_anonymous(vmf->vma)) + return VM_FAULT_FALLBACK; + if (vmf->vma->vm_ops->huge_fault) + return vmf->vma->vm_ops->huge_fault(vmf, PE_SIZE_PUD); +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ + return VM_FAULT_FALLBACK; +} + +static vm_fault_t wp_huge_pud(struct vm_fault *vmf, pud_t orig_pud) +{ +#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && \ + defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD) + /* No support for anonymous transparent PUD pages yet */ + if (vma_is_anonymous(vmf->vma)) goto split; if (vmf->vma->vm_ops->huge_fault) { vm_fault_t ret =3D vmf->vma->vm_ops->huge_fault(vmf, PE_SIZE_PUD); @@ -4538,19 +4551,7 @@ static vm_fault_t create_huge_pud(struct split: /* COW or write-notify not handled on PUD level: split pud.*/ __split_huge_pud(vmf->vma, vmf->pud, vmf->address); -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ - return VM_FAULT_FALLBACK; -} - -static vm_fault_t wp_huge_pud(struct vm_fault *vmf, pud_t orig_pud) -{ -#ifdef CONFIG_TRANSPARENT_HUGEPAGE - /* No support for anonymous transparent PUD pages yet */ - if (vma_is_anonymous(vmf->vma)) - return VM_FAULT_FALLBACK; - if (vmf->vma->vm_ops->huge_fault) - return vmf->vma->vm_ops->huge_fault(vmf, PE_SIZE_PUD); -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ +#endif /* CONFIG_TRANSPARENT_HUGEPAGE && CONFIG_HAVE_ARCH_TRANSPARENT_HUGE= PAGE_PUD */ return VM_FAULT_FALLBACK; } =20 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34219C433EF for ; Tue, 19 Jul 2022 12:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241815AbiGSMu1 (ORCPT ); Tue, 19 Jul 2022 08:50:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241769AbiGSMss (ORCPT ); Tue, 19 Jul 2022 08:48:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CF898E1C8; Tue, 19 Jul 2022 05:19:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 445D9B81B1A; Tue, 19 Jul 2022 12:18:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9938EC341C6; Tue, 19 Jul 2022 12:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233137; bh=H2Kb4/sN5o+k5/06jEyvGqNLtfKnh+jjfO9cO4iOzDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vlNMb0bcVNFysG+Nfti0FegqZZxgkOxJz83QJDqqRl1B0DEe6tJ5GPmVuKLmoiSma YabW5Pb0RANWNX7xwrA4cwHh5KwD3O+ImmHxSy5JpT8x8wyh0YCgBfYF34AHZFlrY8 B8QKCQUP+Mm8IvbwFfDfvaQZCLJvEtXPPemhhxG0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baolin Wang , SeongJae Park , Mike Kravetz , Muchun Song , Andrew Morton Subject: [PATCH 5.18 019/231] mm/damon: use set_huge_pte_at() to make huge pte old Date: Tue, 19 Jul 2022 13:51:44 +0200 Message-Id: <20220719114715.615690833@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baolin Wang commit ed1523a895ffdabcab6e067af18685ed00f5ce15 upstream. The huge_ptep_set_access_flags() can not make the huge pte old according to the discussion [1], that means we will always mornitor the young state of the hugetlb though we stopped accessing the hugetlb, as a result DAMON will get inaccurate accessing statistics. So changing to use set_huge_pte_at() to make the huge pte old to fix this issue. [1] https://lore.kernel.org/all/Yqy97gXI4Nqb7dYo@arm.com/ Link: https://lkml.kernel.org/r/1655692482-28797-1-git-send-email-baolin.wa= ng@linux.alibaba.com Fixes: 49f4203aae06 ("mm/damon: add access checking for hugetlb pages") Signed-off-by: Baolin Wang Reviewed-by: SeongJae Park Acked-by: Mike Kravetz Reviewed-by: Muchun Song Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- mm/damon/vaddr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/mm/damon/vaddr.c +++ b/mm/damon/vaddr.c @@ -407,8 +407,7 @@ static void damon_hugetlb_mkold(pte_t *p if (pte_young(entry)) { referenced =3D true; entry =3D pte_mkold(entry); - huge_ptep_set_access_flags(vma, addr, pte, entry, - vma->vm_flags & VM_WRITE); + set_huge_pte_at(mm, addr, pte, entry); } =20 #ifdef CONFIG_MMU_NOTIFIER From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EC26C433EF for ; Tue, 19 Jul 2022 12:51:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241628AbiGSMve (ORCPT ); Tue, 19 Jul 2022 08:51:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241820AbiGSMtN (ORCPT ); Tue, 19 Jul 2022 08:49:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56D2F8E4C4; Tue, 19 Jul 2022 05:19:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C265FB81B2C; Tue, 19 Jul 2022 12:19:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36D8FC341C6; Tue, 19 Jul 2022 12:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233142; bh=jEJjkXU1tVZ1qD7RUItAtcWKI2zzxzGOkAyfFQV1Cag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BJkOeTelecJNFbH9Nm/SGDrkJa7ldjEihmCjGRA12ir0z5nd2ookeD+NRPPCkgHLF 7T1tKSJqm8gE5N2T4PVxbrZ7WztmxdMbU+W3CDdm/VzwHjiEelil6u3VQxrFObbGXo OeMoNi4WBgr1CgI8izPIcREYaTAg697zvX63erdg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Steven Rostedt , Tom Zanussi , Zheng Yejian Subject: [PATCH 5.18 020/231] tracing/histograms: Fix memory leak problem Date: Tue, 19 Jul 2022 13:51:45 +0200 Message-Id: <20220719114715.705287437@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheng Yejian commit 7edc3945bdce9c39198a10d6129377a5c53559c2 upstream. This reverts commit 46bbe5c671e06f070428b9be142cc4ee5cedebac. As commit 46bbe5c671e0 ("tracing: fix double free") said, the "double free" problem reported by clang static analyzer is: > In parse_var_defs() if there is a problem allocating > var_defs.expr, the earlier var_defs.name is freed. > This free is duplicated by free_var_defs() which frees > the rest of the list. However, if there is a problem allocating N-th var_defs.expr: + in parse_var_defs(), the freed 'earlier var_defs.name' is actually the N-th var_defs.name; + then in free_var_defs(), the names from 0th to (N-1)-th are freed; IF ALLOCATING PROBLEM HAPPENED HERE!!! -+ \ | 0th 1th (N-1)-th N-th V +-------------+-------------+-----+-------------+----------- var_defs: | name | expr | name | expr | ... | name | expr | name | /// +-------------+-------------+-----+-------------+----------- These two frees don't act on same name, so there was no "double free" problem before. Conversely, after that commit, we get a "memory leak" problem because the above "N-th var_defs.name" is not freed. If enable CONFIG_DEBUG_KMEMLEAK and inject a fault at where the N-th var_defs.expr allocated, then execute on shell like: $ echo 'hist:key=3Dcall_site:val=3D$v1,$v2:v1=3Dbytes_req,v2=3Dbytes_allo= c' > \ /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger Then kmemleak reports: unreferenced object 0xffff8fb100ef3518 (size 8): comm "bash", pid 196, jiffies 4295681690 (age 28.538s) hex dump (first 8 bytes): 76 31 00 00 b1 8f ff ff v1...... backtrace: [<0000000038fe4895>] kstrdup+0x2d/0x60 [<00000000c99c049a>] event_hist_trigger_parse+0x206f/0x20e0 [<00000000ae70d2cc>] trigger_process_regex+0xc0/0x110 [<0000000066737a4c>] event_trigger_write+0x75/0xd0 [<000000007341e40c>] vfs_write+0xbb/0x2a0 [<0000000087fde4c2>] ksys_write+0x59/0xd0 [<00000000581e9cdf>] do_syscall_64+0x3a/0x80 [<00000000cf3b065c>] entry_SYSCALL_64_after_hwframe+0x46/0xb0 Link: https://lkml.kernel.org/r/20220711014731.69520-1-zhengyejian1@huawei.= com Cc: stable@vger.kernel.org Fixes: 46bbe5c671e0 ("tracing: fix double free") Reported-by: Hulk Robot Suggested-by: Steven Rostedt Reviewed-by: Tom Zanussi Signed-off-by: Zheng Yejian Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/trace/trace_events_hist.c | 2 ++ 1 file changed, 2 insertions(+) --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -4429,6 +4429,8 @@ static int parse_var_defs(struct hist_tr =20 s =3D kstrdup(field_str, GFP_KERNEL); if (!s) { + kfree(hist_data->attrs->var_defs.name[n_vars]); + hist_data->attrs->var_defs.name[n_vars] =3D NULL; ret =3D -ENOMEM; goto free; } From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C465CC43334 for ; Tue, 19 Jul 2022 12:50:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241850AbiGSMuf (ORCPT ); Tue, 19 Jul 2022 08:50:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241784AbiGSMs6 (ORCPT ); Tue, 19 Jul 2022 08:48:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB1A18D5F1; Tue, 19 Jul 2022 05:19:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BABE5B81B2B; Tue, 19 Jul 2022 12:19:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19251C341C6; Tue, 19 Jul 2022 12:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233145; bh=kPJAsjLpGBb2Q5ipTE7OnPID7nGe121aKEl9He9CuPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DZBm0kqa4WrlaFDxbiXbCkbwBrs1/58h1p+uKM34pZc2tUD2DdZLi67vvJXGys30A iSwWKkXAugmlNyUMGyx4TKLv2VXJiroIO3EQaByrxwgtEik/6UwB4WJQyxFpUZBjhn E0gNL+oYNPP0pNfeTNPXjetlQVbAa2R8/qBBPlbU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (Google)" , Kuniyuki Iwashima , "David S. Miller" Subject: [PATCH 5.18 021/231] net: sock: tracing: Fix sock_exceed_buf_limit not to dereference stale pointer Date: Tue, 19 Jul 2022 13:51:46 +0200 Message-Id: <20220719114715.780724059@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) commit 820b8963adaea34a87abbecb906d1f54c0aabfb7 upstream. The trace event sock_exceed_buf_limit saves the prot->sysctl_mem pointer and then dereferences it in the TP_printk() portion. This is unsafe as the TP_printk() portion is executed at the time the buffer is read. That is, it can be seconds, minutes, days, months, even years later. If the proto is freed, then this dereference will can also lead to a kernel crash. Instead, save the sysctl_mem array into the ring buffer and have the TP_printk() reference that instead. This is the proper and safe way to read pointers in trace events. Link: https://lore.kernel.org/all/20220706052130.16368-12-kuniyu@amazon.com/ Cc: stable@vger.kernel.org Fixes: 3847ce32aea9f ("core: add tracepoints for queueing skb to rcvbuf") Signed-off-by: Steven Rostedt (Google) Acked-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/trace/events/sock.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/include/trace/events/sock.h +++ b/include/trace/events/sock.h @@ -98,7 +98,7 @@ TRACE_EVENT(sock_exceed_buf_limit, =20 TP_STRUCT__entry( __array(char, name, 32) - __field(long *, sysctl_mem) + __array(long, sysctl_mem, 3) __field(long, allocated) __field(int, sysctl_rmem) __field(int, rmem_alloc) @@ -110,7 +110,9 @@ TRACE_EVENT(sock_exceed_buf_limit, =20 TP_fast_assign( strncpy(__entry->name, prot->name, 32); - __entry->sysctl_mem =3D prot->sysctl_mem; + __entry->sysctl_mem[0] =3D READ_ONCE(prot->sysctl_mem[0]); + __entry->sysctl_mem[1] =3D READ_ONCE(prot->sysctl_mem[1]); + __entry->sysctl_mem[2] =3D READ_ONCE(prot->sysctl_mem[2]); __entry->allocated =3D allocated; __entry->sysctl_rmem =3D sk_get_rmem0(sk, prot); __entry->rmem_alloc =3D atomic_read(&sk->sk_rmem_alloc); From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E13D4C43334 for ; Tue, 19 Jul 2022 12:50:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238100AbiGSMuY (ORCPT ); Tue, 19 Jul 2022 08:50:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237674AbiGSMsl (ORCPT ); Tue, 19 Jul 2022 08:48:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 939B38D5CA; Tue, 19 Jul 2022 05:19:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7BF2DB81B21; Tue, 19 Jul 2022 12:19:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2CF1C341C6; Tue, 19 Jul 2022 12:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233148; bh=o7qzqHx+I24J2T5hE92OpaglvEMG/SRhBOpBoQSsWHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DFQrfIQHQP1z08Tjte6vMAqu9vjpOqFO3oQmd2ZEVk0N4eu6TsHVrN6w0MBqpWf+3 +b4M1LAQQ0bzVaNbYwoeyse7d8IKG/Yca2KCJ7eBcfKsVREbVOrxrS6mMmEV4xTaR+ Z1UCcplxGj6sp/I+LQQUBIntctHVR1eM+XgPbFO0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Edwin Brossette , Nicolas Dichtel , Paolo Abeni Subject: [PATCH 5.18 022/231] ip: fix dflt addr selection for connected nexthop Date: Tue, 19 Jul 2022 13:51:47 +0200 Message-Id: <20220719114715.859200840@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Dichtel commit 747c14307214b55dbd8250e1ab44cad8305756f1 upstream. When a nexthop is added, without a gw address, the default scope was set to 'host'. Thus, when a source address is selected, 127.0.0.1 may be chosen but rejected when the route is used. When using a route without a nexthop id, the scope can be configured in the route, thus the problem doesn't exist. To explain more deeply: when a user creates a nexthop, it cannot specify the scope. To create it, the function nh_create_ipv4() calls fib_check_nh() with scope set to 0. fib_check_nh() calls fib_check_nh_nongw() wich was setting scope to 'host'. Then, nh_create_ipv4() calls fib_info_update_nhc_saddr() with scope set to 'host'. The src addr is chosen before the route is inserted. When a 'standard' route (ie without a reference to a nexthop) is added, fib_create_info() calls fib_info_update_nhc_saddr() with the scope set by the user. iproute2 set the scope to 'link' by default. Here is a way to reproduce the problem: ip netns add foo ip -n foo link set lo up ip netns add bar ip -n bar link set lo up sleep 1 ip -n foo link add name eth0 type dummy ip -n foo link set eth0 up ip -n foo address add 192.168.0.1/24 dev eth0 ip -n foo link add name veth0 type veth peer name veth1 netns bar ip -n foo link set veth0 up ip -n bar link set veth1 up ip -n bar address add 192.168.1.1/32 dev veth1 ip -n bar route add default dev veth1 ip -n foo nexthop add id 1 dev veth0 ip -n foo route add 192.168.1.1 nhid 1 Try to get/use the route: > $ ip -n foo route get 192.168.1.1 > RTNETLINK answers: Invalid argument > $ ip netns exec foo ping -c1 192.168.1.1 > ping: connect: Invalid argument Try without nexthop group (iproute2 sets scope to 'link' by dflt): ip -n foo route del 192.168.1.1 ip -n foo route add 192.168.1.1 dev veth0 Try to get/use the route: > $ ip -n foo route get 192.168.1.1 > 192.168.1.1 dev veth0 src 192.168.0.1 uid 0 > cache > $ ip netns exec foo ping -c1 192.168.1.1 > PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. > 64 bytes from 192.168.1.1: icmp_seq=3D1 ttl=3D64 time=3D0.039 ms > > --- 192.168.1.1 ping statistics --- > 1 packets transmitted, 1 received, 0% packet loss, time 0ms > rtt min/avg/max/mdev =3D 0.039/0.039/0.039/0.000 ms CC: stable@vger.kernel.org Fixes: 597cfe4fc339 ("nexthop: Add support for IPv4 nexthops") Reported-by: Edwin Brossette Signed-off-by: Nicolas Dichtel Link: https://lore.kernel.org/r/20220713114853.29406-1-nicolas.dichtel@6win= d.com Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/fib_semantics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -1230,7 +1230,7 @@ static int fib_check_nh_nongw(struct net =20 nh->fib_nh_dev =3D in_dev->dev; dev_hold_track(nh->fib_nh_dev, &nh->fib_nh_dev_tracker, GFP_ATOMIC); - nh->fib_nh_scope =3D RT_SCOPE_HOST; + nh->fib_nh_scope =3D RT_SCOPE_LINK; if (!netif_carrier_ok(nh->fib_nh_dev)) nh->fib_nh_flags |=3D RTNH_F_LINKDOWN; err =3D 0; From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5BFFC433EF for ; Tue, 19 Jul 2022 12:50:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241735AbiGSMuR (ORCPT ); Tue, 19 Jul 2022 08:50:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241700AbiGSMsm (ORCPT ); Tue, 19 Jul 2022 08:48:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A2188D5DC; Tue, 19 Jul 2022 05:19:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E3DD96177F; Tue, 19 Jul 2022 12:19:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF202C341C6; Tue, 19 Jul 2022 12:19:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233151; bh=PEuV/4o35jeAEzG8xHkh/SJRBVMvdGbRaqzCgxIJ/OY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TBTSmiDGOCBShHVwj2wsV40YBeTo+ggdJODGwV7pEZJt9tOjbOrVjynEtpQzNFRLR G0qM8XwjGV3n5g2lNSSvGDyhV6qZMpFAN7l1S2CqNKH7e2lakJTn+gXG5U+N1T1sNz a1V1/vnAY800v3Np+vzVGEzpoMXxiPBYbF3O0f8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , "Russell King (Oracle)" Subject: [PATCH 5.18 023/231] ARM: 9213/1: Print message about disabled Spectre workarounds only once Date: Tue, 19 Jul 2022 13:51:48 +0200 Message-Id: <20220719114715.954895250@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Osipenko commit e4ced82deb5fb17222fb82e092c3f8311955b585 upstream. Print the message about disabled Spectre workarounds only once. The message is printed each time CPU goes out from idling state on NVIDIA Tegra boards, causing storm in KMSG that makes system unusable. Cc: stable@vger.kernel.org Signed-off-by: Dmitry Osipenko Signed-off-by: Russell King (Oracle) Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/mm/proc-v7-bugs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/arch/arm/mm/proc-v7-bugs.c +++ b/arch/arm/mm/proc-v7-bugs.c @@ -108,8 +108,7 @@ static unsigned int spectre_v2_install_w #else static unsigned int spectre_v2_install_workaround(unsigned int method) { - pr_info("CPU%u: Spectre V2: workarounds disabled by configuration\n", - smp_processor_id()); + pr_info_once("Spectre V2: workarounds disabled by configuration\n"); =20 return SPECTRE_VULNERABLE; } From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB145C433EF for ; Tue, 19 Jul 2022 12:50:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241871AbiGSMus (ORCPT ); Tue, 19 Jul 2022 08:50:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241821AbiGSMtN (ORCPT ); Tue, 19 Jul 2022 08:49:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 260678E1FE; Tue, 19 Jul 2022 05:19:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 249CAB81B2D; Tue, 19 Jul 2022 12:19:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81A2AC341CA; Tue, 19 Jul 2022 12:19:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233153; bh=Rs6tJx4noeNRuRacr17BW7h+FGcVD0qglmkeEcifLKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wAM46tlgjlpm35vLlvOy7qCdIG3apq2EZFT2sCCLbJOFdm8JdjZxAyKcvQgAP28HW Yxcj+VR+Tsl2RDXddS8Q6lPnlnUkS2VidV0muEykaRr4SSYo1LwL7z4K5aOPxkAzXc ziq9fq0soqPp3uYVajTcE3lMa6Um8PysGK2Gd18E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Ard Biesheuvel , "Russell King (Oracle)" Subject: [PATCH 5.18 024/231] ARM: 9214/1: alignment: advance IT state after emulating Thumb instruction Date: Tue, 19 Jul 2022 13:51:49 +0200 Message-Id: <20220719114716.054517358@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel commit e5c46fde75e43c15a29b40e5fc5641727f97ae47 upstream. After emulating a misaligned load or store issued in Thumb mode, we have to advance the IT state by hand, or it will get out of sync with the actual instruction stream, which means we'll end up applying the wrong condition code to subsequent instructions. This might corrupt the program state rather catastrophically. So borrow the it_advance() helper from the probing code, and use it on CPSR if the emulated instruction is Thumb. Cc: Reviewed-by: Linus Walleij Signed-off-by: Ard Biesheuvel Signed-off-by: Russell King (Oracle) Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/include/asm/ptrace.h | 26 ++++++++++++++++++++++++++ arch/arm/mm/alignment.c | 3 +++ arch/arm/probes/decode.h | 26 +------------------------- 3 files changed, 30 insertions(+), 25 deletions(-) --- a/arch/arm/include/asm/ptrace.h +++ b/arch/arm/include/asm/ptrace.h @@ -163,5 +163,31 @@ static inline unsigned long user_stack_p ((current_stack_pointer | (THREAD_SIZE - 1)) - 7) - 1; \ }) =20 + +/* + * Update ITSTATE after normal execution of an IT block instruction. + * + * The 8 IT state bits are split into two parts in CPSR: + * ITSTATE<1:0> are in CPSR<26:25> + * ITSTATE<7:2> are in CPSR<15:10> + */ +static inline unsigned long it_advance(unsigned long cpsr) +{ + if ((cpsr & 0x06000400) =3D=3D 0) { + /* ITSTATE<2:0> =3D=3D 0 means end of IT block, so clear IT state */ + cpsr &=3D ~PSR_IT_MASK; + } else { + /* We need to shift left ITSTATE<4:0> */ + const unsigned long mask =3D 0x06001c00; /* Mask ITSTATE<4:0> */ + unsigned long it =3D cpsr & mask; + it <<=3D 1; + it |=3D it >> (27 - 10); /* Carry ITSTATE<2> to correct place */ + it &=3D mask; + cpsr &=3D ~mask; + cpsr |=3D it; + } + return cpsr; +} + #endif /* __ASSEMBLY__ */ #endif --- a/arch/arm/mm/alignment.c +++ b/arch/arm/mm/alignment.c @@ -935,6 +935,9 @@ do_alignment(unsigned long addr, unsigne if (type =3D=3D TYPE_LDST) do_alignment_finish_ldst(addr, instr, regs, offset); =20 + if (thumb_mode(regs)) + regs->ARM_cpsr =3D it_advance(regs->ARM_cpsr); + return 0; =20 bad_or_fault: --- a/arch/arm/probes/decode.h +++ b/arch/arm/probes/decode.h @@ -14,6 +14,7 @@ #include #include #include +#include #include =20 void __init arm_probes_decode_init(void); @@ -35,31 +36,6 @@ void __init find_str_pc_offset(void); #endif =20 =20 -/* - * Update ITSTATE after normal execution of an IT block instruction. - * - * The 8 IT state bits are split into two parts in CPSR: - * ITSTATE<1:0> are in CPSR<26:25> - * ITSTATE<7:2> are in CPSR<15:10> - */ -static inline unsigned long it_advance(unsigned long cpsr) - { - if ((cpsr & 0x06000400) =3D=3D 0) { - /* ITSTATE<2:0> =3D=3D 0 means end of IT block, so clear IT state */ - cpsr &=3D ~PSR_IT_MASK; - } else { - /* We need to shift left ITSTATE<4:0> */ - const unsigned long mask =3D 0x06001c00; /* Mask ITSTATE<4:0> */ - unsigned long it =3D cpsr & mask; - it <<=3D 1; - it |=3D it >> (27 - 10); /* Carry ITSTATE<2> to correct place */ - it &=3D mask; - cpsr &=3D ~mask; - cpsr |=3D it; - } - return cpsr; -} - static inline void __kprobes bx_write_pc(long pcv, struct pt_regs *regs) { long cpsr =3D regs->ARM_cpsr; From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 429A1C43334 for ; Tue, 19 Jul 2022 12:50:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237557AbiGSMuk (ORCPT ); Tue, 19 Jul 2022 08:50:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240751AbiGSMs6 (ORCPT ); Tue, 19 Jul 2022 08:48:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 794B58E1E1; Tue, 19 Jul 2022 05:19:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E50D0B81B13; Tue, 19 Jul 2022 12:19:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 514DDC341C6; Tue, 19 Jul 2022 12:19:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233156; bh=tN+Yms2lOPAuzEgL9UFe3c+rrRIeWkblCZ6G8JUZFis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RAbSCFpV4VJuLsI6bLFl7CGLm+XQ9sxVBB+9KG/iw4Fh7qNJuClsj75z8HiXPP2W4 jlBs/VIftF6tDON8oPexiufZ2LZU9ax9JfsMhnhDzsBaOhfzvxWr+imhEFWJTc+EKM lwAxKSEsVX6Vl99Qln9YjXU5ehBJ/P9EV+VKcYsY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Johannes Berg Subject: [PATCH 5.18 025/231] wifi: mac80211: fix queue selection for mesh/OCB interfaces Date: Tue, 19 Jul 2022 13:51:50 +0200 Message-Id: <20220719114716.141165300@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Felix Fietkau commit 50e2ab39291947b6c6c7025cf01707c270fcde59 upstream. When using iTXQ, the code assumes that there is only one vif queue for broadcast packets, using the BE queue. Allowing non-BE queue marking violates that assumption and txq->ac =3D=3D skb_queue_mapping is no longer guaranteed. This can cause issues with queue handling in the driver and also causes issues with the recent ATF change, resulting in an AQL underflow warning. Cc: stable@vger.kernel.org Signed-off-by: Felix Fietkau Link: https://lore.kernel.org/r/20220702145227.39356-1-nbd@nbd.name Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/mac80211/wme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/mac80211/wme.c +++ b/net/mac80211/wme.c @@ -147,8 +147,8 @@ u16 __ieee80211_select_queue(struct ieee bool qos; =20 /* all mesh/ocb stations are required to support WME */ - if (sdata->vif.type =3D=3D NL80211_IFTYPE_MESH_POINT || - sdata->vif.type =3D=3D NL80211_IFTYPE_OCB) + if (sta && (sdata->vif.type =3D=3D NL80211_IFTYPE_MESH_POINT || + sdata->vif.type =3D=3D NL80211_IFTYPE_OCB)) qos =3D true; else if (sta) qos =3D sta->sta.wme; From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF14FC433EF for ; Tue, 19 Jul 2022 12:51:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241812AbiGSMvh (ORCPT ); Tue, 19 Jul 2022 08:51:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242007AbiGSMtd (ORCPT ); Tue, 19 Jul 2022 08:49:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B2C0459A7; Tue, 19 Jul 2022 05:19:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 37ED561812; Tue, 19 Jul 2022 12:19:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A9B3C341C6; Tue, 19 Jul 2022 12:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233159; bh=bzBKeMvKtdXzma7ypRbpnVABxZ7hvbY9OMkJfHFVWGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yXye1WGJ3c9WCOatQkbvfKK5Yd8G21CZi9PQoLl+RQmZtBIyfob3YDI6RqcdjN7my 4a6DIw8Vh78mvubck6N90z4CYHI8n7FxOpgZsM1J9VrD6pbpRwa89Gg18KOl0uYI5G XJgA6LvlwTf8VfRT/xGHuc6j73DLluLSfQxccI+g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejun Heo , Mukesh Ojha , shisiyuan Subject: [PATCH 5.18 026/231] cgroup: Use separate src/dst nodes when preloading css_sets for migration Date: Tue, 19 Jul 2022 13:51:51 +0200 Message-Id: <20220719114716.227524922@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tejun Heo commit 07fd5b6cdf3cc30bfde8fe0f644771688be04447 upstream. Each cset (css_set) is pinned by its tasks. When we're moving tasks around across csets for a migration, we need to hold the source and destination csets to ensure that they don't go away while we're moving tasks about. This is done by linking cset->mg_preload_node on either the mgctx->preloaded_src_csets or mgctx->preloaded_dst_csets list. Using the same cset->mg_preload_node for both the src and dst lists was deemed okay as a cset can't be both the source and destination at the same time. Unfortunately, this overloading becomes problematic when multiple tasks are involved in a migration and some of them are identity noop migrations while others are actually moving across cgroups. For example, this can happen with the following sequence on cgroup1: #1> mkdir -p /sys/fs/cgroup/misc/a/b #2> echo $$ > /sys/fs/cgroup/misc/a/cgroup.procs #3> RUN_A_COMMAND_WHICH_CREATES_MULTIPLE_THREADS & #4> PID=3D$! #5> echo $PID > /sys/fs/cgroup/misc/a/b/tasks #6> echo $PID > /sys/fs/cgroup/misc/a/cgroup.procs the process including the group leader back into a. In this final migration, non-leader threads would be doing identity migration while the group leader is doing an actual one. After #3, let's say the whole process was in cset A, and that after #4, the leader moves to cset B. Then, during #6, the following happens: 1. cgroup_migrate_add_src() is called on B for the leader. 2. cgroup_migrate_add_src() is called on A for the other threads. 3. cgroup_migrate_prepare_dst() is called. It scans the src list. 4. It notices that B wants to migrate to A, so it tries to A to the dst list but realizes that its ->mg_preload_node is already busy. 5. and then it notices A wants to migrate to A as it's an identity migration, it culls it by list_del_init()'ing its ->mg_preload_node and putting references accordingly. 6. The rest of migration takes place with B on the src list but nothing on the dst list. This means that A isn't held while migration is in progress. If all tasks leave A before the migration finishes and the incoming task pins it, the cset will be destroyed leading to use-after-free. This is caused by overloading cset->mg_preload_node for both src and dst preload lists. We wanted to exclude the cset from the src list but ended up inadvertently excluding it from the dst list too. This patch fixes the issue by separating out cset->mg_preload_node into ->mg_src_preload_node and ->mg_dst_preload_node, so that the src and dst preloadings don't interfere with each other. Signed-off-by: Tejun Heo Reported-by: Mukesh Ojha Reported-by: shisiyuan Link: http://lkml.kernel.org/r/1654187688-27411-1-git-send-email-shisiyuan@= xiaomi.com Link: https://www.spinics.net/lists/cgroups/msg33313.html Fixes: f817de98513d ("cgroup: prepare migration path for unified hierarchy") Cc: stable@vger.kernel.org # v3.16+ Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/linux/cgroup-defs.h | 3 ++- kernel/cgroup/cgroup.c | 37 +++++++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 15 deletions(-) --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h @@ -264,7 +264,8 @@ struct css_set { * List of csets participating in the on-going migration either as * source or destination. Protected by cgroup_mutex. */ - struct list_head mg_preload_node; + struct list_head mg_src_preload_node; + struct list_head mg_dst_preload_node; struct list_head mg_node; =20 /* --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -765,7 +765,8 @@ struct css_set init_css_set =3D { .task_iters =3D LIST_HEAD_INIT(init_css_set.task_iters), .threaded_csets =3D LIST_HEAD_INIT(init_css_set.threaded_csets), .cgrp_links =3D LIST_HEAD_INIT(init_css_set.cgrp_links), - .mg_preload_node =3D LIST_HEAD_INIT(init_css_set.mg_preload_node), + .mg_src_preload_node =3D LIST_HEAD_INIT(init_css_set.mg_src_preload_node), + .mg_dst_preload_node =3D LIST_HEAD_INIT(init_css_set.mg_dst_preload_node), .mg_node =3D LIST_HEAD_INIT(init_css_set.mg_node), =20 /* @@ -1240,7 +1241,8 @@ static struct css_set *find_css_set(stru INIT_LIST_HEAD(&cset->threaded_csets); INIT_HLIST_NODE(&cset->hlist); INIT_LIST_HEAD(&cset->cgrp_links); - INIT_LIST_HEAD(&cset->mg_preload_node); + INIT_LIST_HEAD(&cset->mg_src_preload_node); + INIT_LIST_HEAD(&cset->mg_dst_preload_node); INIT_LIST_HEAD(&cset->mg_node); =20 /* Copy the set of subsystem state objects generated in @@ -2597,21 +2599,27 @@ int cgroup_migrate_vet_dst(struct cgroup */ void cgroup_migrate_finish(struct cgroup_mgctx *mgctx) { - LIST_HEAD(preloaded); struct css_set *cset, *tmp_cset; =20 lockdep_assert_held(&cgroup_mutex); =20 spin_lock_irq(&css_set_lock); =20 - list_splice_tail_init(&mgctx->preloaded_src_csets, &preloaded); - list_splice_tail_init(&mgctx->preloaded_dst_csets, &preloaded); + list_for_each_entry_safe(cset, tmp_cset, &mgctx->preloaded_src_csets, + mg_src_preload_node) { + cset->mg_src_cgrp =3D NULL; + cset->mg_dst_cgrp =3D NULL; + cset->mg_dst_cset =3D NULL; + list_del_init(&cset->mg_src_preload_node); + put_css_set_locked(cset); + } =20 - list_for_each_entry_safe(cset, tmp_cset, &preloaded, mg_preload_node) { + list_for_each_entry_safe(cset, tmp_cset, &mgctx->preloaded_dst_csets, + mg_dst_preload_node) { cset->mg_src_cgrp =3D NULL; cset->mg_dst_cgrp =3D NULL; cset->mg_dst_cset =3D NULL; - list_del_init(&cset->mg_preload_node); + list_del_init(&cset->mg_dst_preload_node); put_css_set_locked(cset); } =20 @@ -2651,7 +2659,7 @@ void cgroup_migrate_add_src(struct css_s if (src_cset->dead) return; =20 - if (!list_empty(&src_cset->mg_preload_node)) + if (!list_empty(&src_cset->mg_src_preload_node)) return; =20 src_cgrp =3D cset_cgroup_from_root(src_cset, dst_cgrp->root); @@ -2664,7 +2672,7 @@ void cgroup_migrate_add_src(struct css_s src_cset->mg_src_cgrp =3D src_cgrp; src_cset->mg_dst_cgrp =3D dst_cgrp; get_css_set(src_cset); - list_add_tail(&src_cset->mg_preload_node, &mgctx->preloaded_src_csets); + list_add_tail(&src_cset->mg_src_preload_node, &mgctx->preloaded_src_csets= ); } =20 /** @@ -2689,7 +2697,7 @@ int cgroup_migrate_prepare_dst(struct cg =20 /* look up the dst cset for each src cset and link it to src */ list_for_each_entry_safe(src_cset, tmp_cset, &mgctx->preloaded_src_csets, - mg_preload_node) { + mg_src_preload_node) { struct css_set *dst_cset; struct cgroup_subsys *ss; int ssid; @@ -2708,7 +2716,7 @@ int cgroup_migrate_prepare_dst(struct cg if (src_cset =3D=3D dst_cset) { src_cset->mg_src_cgrp =3D NULL; src_cset->mg_dst_cgrp =3D NULL; - list_del_init(&src_cset->mg_preload_node); + list_del_init(&src_cset->mg_src_preload_node); put_css_set(src_cset); put_css_set(dst_cset); continue; @@ -2716,8 +2724,8 @@ int cgroup_migrate_prepare_dst(struct cg =20 src_cset->mg_dst_cset =3D dst_cset; =20 - if (list_empty(&dst_cset->mg_preload_node)) - list_add_tail(&dst_cset->mg_preload_node, + if (list_empty(&dst_cset->mg_dst_preload_node)) + list_add_tail(&dst_cset->mg_dst_preload_node, &mgctx->preloaded_dst_csets); else put_css_set(dst_cset); @@ -2963,7 +2971,8 @@ static int cgroup_update_dfl_csses(struc goto out_finish; =20 spin_lock_irq(&css_set_lock); - list_for_each_entry(src_cset, &mgctx.preloaded_src_csets, mg_preload_node= ) { + list_for_each_entry(src_cset, &mgctx.preloaded_src_csets, + mg_src_preload_node) { struct task_struct *task, *ntask; =20 /* all tasks in src_csets need to be migrated */ From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DDA0C433EF for ; Tue, 19 Jul 2022 12:55:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242197AbiGSMzI (ORCPT ); Tue, 19 Jul 2022 08:55:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242033AbiGSMx5 (ORCPT ); Tue, 19 Jul 2022 08:53:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76924936A2; Tue, 19 Jul 2022 05:21:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9B6D0618E1; Tue, 19 Jul 2022 12:21:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78A3DC341C6; Tue, 19 Jul 2022 12:21:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233271; bh=asjsSO2zcZzRZVLGoFi11Md+k7m0QSJZuMXutkXDvCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NhKkX+PwpUjv91+0XEVTUkBa2hysP6XP/AldcgipMn1E/+jBLYoJCyz7QUziyh7nt jyn6mzMUGpj96gNe0oeL33ePaAYtwGohaIAH3uRsMVHdkb9OTCseowc3VLidNtVylq /GDUo0mLocHxotBuVKunBLA3G8GBsY0noU2//5Rc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dominique MARTINET , Christoph Hellwig , Filipe Manana , David Sterba Subject: [PATCH 5.18 027/231] btrfs: return -EAGAIN for NOWAIT dio reads/writes on compressed and inline extents Date: Tue, 19 Jul 2022 13:51:52 +0200 Message-Id: <20220719114716.330484222@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Filipe Manana commit a4527e1853f8ff6e0b7c2dadad6268bd38427a31 upstream. When doing a direct IO read or write, we always return -ENOTBLK when we find a compressed extent (or an inline extent) so that we fallback to buffered IO. This however is not ideal in case we are in a NOWAIT context (io_uring for example), because buffered IO can block and we currently have no support for NOWAIT semantics for buffered IO, so if we need to fallback to buffered IO we should first signal the caller that we may need to block by returning -EAGAIN instead. This behaviour can also result in short reads being returned to user space, which although it's not incorrect and user space should be able to deal with partial reads, it's somewhat surprising and even some popular applications like QEMU (Link tag #1) and MariaDB (Link tag #2) don't deal with short reads properly (or at all). The short read case happens when we try to read from a range that has a non-compressed and non-inline extent followed by a compressed extent. After having read the first extent, when we find the compressed extent we return -ENOTBLK from btrfs_dio_iomap_begin(), which results in iomap to treat the request as a short read, returning 0 (success) and waiting for previously submitted bios to complete (this happens at fs/iomap/direct-io.c:__iomap_dio_rw()). After that, and while at btrfs_file_read_iter(), we call filemap_read() to use buffered IO to read the remaining data, and pass it the number of bytes we were able to read with direct IO. Than at filemap_read() if we get a page fault error when accessing the read buffer, we return a partial read instead of an -EFAULT error, because the number of bytes previously read is greater than zero. So fix this by returning -EAGAIN for NOWAIT direct IO when we find a compressed or an inline extent. Reported-by: Dominique MARTINET Link: https://lore.kernel.org/linux-btrfs/YrrFGO4A1jS0GI0G@atmark-techno.co= m/ Link: https://jira.mariadb.org/browse/MDEV-27900?focusedCommentId=3D216582&= page=3Dcom.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#c= omment-216582 Tested-by: Dominique MARTINET CC: stable@vger.kernel.org # 5.10+ Reviewed-by: Christoph Hellwig Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/btrfs/inode.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -7639,7 +7639,19 @@ static int btrfs_dio_iomap_begin(struct if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags) || em->block_start =3D=3D EXTENT_MAP_INLINE) { free_extent_map(em); - ret =3D -ENOTBLK; + /* + * If we are in a NOWAIT context, return -EAGAIN in order to + * fallback to buffered IO. This is not only because we can + * block with buffered IO (no support for NOWAIT semantics at + * the moment) but also to avoid returning short reads to user + * space - this happens if we were able to read some data from + * previous non-compressed extents and then when we fallback to + * buffered IO, at btrfs_file_read_iter() by calling + * filemap_read(), we fail to fault in pages for the read buffer, + * in which case filemap_read() returns a short read (the number + * of bytes previously read is > 0, so it does not return -EFAULT). + */ + ret =3D (flags & IOMAP_NOWAIT) ? -EAGAIN : -ENOTBLK; goto unlock_err; } From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB952C433EF for ; Tue, 19 Jul 2022 12:51:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237920AbiGSMvR (ORCPT ); Tue, 19 Jul 2022 08:51:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242175AbiGSMtu (ORCPT ); Tue, 19 Jul 2022 08:49:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80A5A57E1F; Tue, 19 Jul 2022 05:19:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6DD15B81B1C; Tue, 19 Jul 2022 12:19:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9AA2C341C6; Tue, 19 Jul 2022 12:19:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233185; bh=E8DcP3YJAdegwlxCi30cQmG9bc8+tT6ERZNM97yBuEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XteFZrVD0W5Yx7wTN749EKrDcbuw5p3u1AXzZ8ZtYcdUdWDyXJBDOmOd2dlfZy8to zj/o6eFgdSakcm72uN5674ZCJ3NvaaRoLFaVfG4qK12dhJ5xjaeTN1sjvALxen/gaK T1ijgJRkDGHSjI/zbKLAanOPBipzj4fou3nBdVFo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anand Jain , Christoph Hellwig , David Sterba Subject: [PATCH 5.18 028/231] btrfs: zoned: fix a leaked bioc in read_zone_info Date: Tue, 19 Jul 2022 13:51:53 +0200 Message-Id: <20220719114716.423799150@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig commit 2963457829decf0c824a443238d251151ed18ff5 upstream. The bioc would leak on the normal completion path and also on the RAID56 check (but that one won't happen in practice due to the invalid combination with zoned mode). Fixes: 7db1c5d14dcd ("btrfs: zoned: support dev-replace in zoned filesystem= s") CC: stable@vger.kernel.org # 5.16+ Reviewed-by: Anand Jain Signed-off-by: Christoph Hellwig [ update changelog ] Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/btrfs/zoned.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1727,12 +1727,14 @@ static int read_zone_info(struct btrfs_f ret =3D btrfs_map_sblock(fs_info, BTRFS_MAP_GET_READ_MIRRORS, logical, &mapped_length, &bioc); if (ret || !bioc || mapped_length < PAGE_SIZE) { - btrfs_put_bioc(bioc); - return -EIO; + ret =3D -EIO; + goto out_put_bioc; } =20 - if (bioc->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK) - return -EINVAL; + if (bioc->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK) { + ret =3D -EINVAL; + goto out_put_bioc; + } =20 nofs_flag =3D memalloc_nofs_save(); nmirrors =3D (int)bioc->num_stripes; @@ -1751,7 +1753,8 @@ static int read_zone_info(struct btrfs_f break; } memalloc_nofs_restore(nofs_flag); - +out_put_bioc: + btrfs_put_bioc(bioc); return ret; } From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CD14C433EF for ; Tue, 19 Jul 2022 12:52:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242043AbiGSMwc (ORCPT ); Tue, 19 Jul 2022 08:52:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241843AbiGSMvJ (ORCPT ); Tue, 19 Jul 2022 08:51:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B55A819C20; Tue, 19 Jul 2022 05:20:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2A377B81B2B; Tue, 19 Jul 2022 12:20:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89CA4C341C6; Tue, 19 Jul 2022 12:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233216; bh=gAKC4wPqb+HFPL9fJF7AbBtm70KZIt2VEwNXyMyrhn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0RhJ/D8WTay4F6LR1yzNr5hxzwHJEWRbPkqOhUnfmdxUVslyj+dsV8fmVAG3cz3Fb VHX+f4JnVqZ3ZSpn66CNpDdt2D7AbMHhxWX8fkuACTex+QTUzTU8hSNVEEFhUdwmqH /UzykGJWESvwxYDPQt3Bkt8pjxTONEYnGDM6yMKM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steven Price , Dmitry Osipenko Subject: [PATCH 5.18 029/231] drm/panfrost: Put mapping instead of shmem obj on panfrost_mmu_map_fault_addr() error Date: Tue, 19 Jul 2022 13:51:54 +0200 Message-Id: <20220719114716.520551515@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Osipenko commit fb6e0637ab7ebd8e61fe24f4d663c4bae99cfa62 upstream. When panfrost_mmu_map_fault_addr() fails, the BO's mapping should be unreferenced and not the shmem object which backs the mapping. Cc: stable@vger.kernel.org Fixes: bdefca2d8dc0 ("drm/panfrost: Add the panfrost_gem_mapping concept") Reviewed-by: Steven Price Signed-off-by: Dmitry Osipenko Signed-off-by: Steven Price Link: https://patchwork.freedesktop.org/patch/msgid/20220630200601.1884120-= 2-dmitry.osipenko@collabora.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c @@ -518,7 +518,7 @@ err_map: err_pages: drm_gem_shmem_put_pages(&bo->base); err_bo: - drm_gem_object_put(&bo->base.base); + panfrost_gem_mapping_put(bomapping); return ret; } From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4404ECCA47F for ; Tue, 19 Jul 2022 12:53:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241934AbiGSMxo (ORCPT ); Tue, 19 Jul 2022 08:53:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242101AbiGSMxS (ORCPT ); Tue, 19 Jul 2022 08:53:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EBE6904D6; Tue, 19 Jul 2022 05:20:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3BDC6618C1; Tue, 19 Jul 2022 12:20:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3282DC341CA; Tue, 19 Jul 2022 12:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233248; bh=66f3skRYNfi9yrdyObdqkz6c99BBdcZAdjSEBBsMkS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z2AeH4I/Etry+nEvWMTjXR7poYfzUlHtHocSpCD1XVJ2gychR+0xSVprpwtt9W+dS MbbGeNd3BrymojVlfU6WBh/xw48Hy5JOdwhjjJkfRcPJDisCF949JrHGpU7sanH8Md dw/LsoUYhXPVbpajD5m/VAk2M0FKklD7lS0LSfbY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alyssa Rosenzweig , Steven Price , Dmitry Osipenko Subject: [PATCH 5.18 030/231] drm/panfrost: Fix shrinker list corruption by madvise IOCTL Date: Tue, 19 Jul 2022 13:51:55 +0200 Message-Id: <20220719114716.612560197@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Osipenko commit 9fc33eaaa979d112d10fea729edcd2a2e21aa912 upstream. Calling madvise IOCTL twice on BO causes memory shrinker list corruption and crashes kernel because BO is already on the list and it's added to the list again, while BO should be removed from the list before it's re-added. Fix it. Cc: stable@vger.kernel.org Fixes: 013b65101315 ("drm/panfrost: Add madvise and shrinker support") Acked-by: Alyssa Rosenzweig Reviewed-by: Steven Price Signed-off-by: Dmitry Osipenko Signed-off-by: Steven Price Link: https://patchwork.freedesktop.org/patch/msgid/20220630200601.1884120-= 3-dmitry.osipenko@collabora.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/panfrost/panfrost_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -432,8 +432,8 @@ static int panfrost_ioctl_madvise(struct =20 if (args->retained) { if (args->madv =3D=3D PANFROST_MADV_DONTNEED) - list_add_tail(&bo->base.madv_list, - &pfdev->shrinker_list); + list_move_tail(&bo->base.madv_list, + &pfdev->shrinker_list); else if (args->madv =3D=3D PANFROST_MADV_WILLNEED) list_del_init(&bo->base.madv_list); } From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 598B8C43334 for ; Tue, 19 Jul 2022 12:53:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241897AbiGSMxv (ORCPT ); Tue, 19 Jul 2022 08:53:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242086AbiGSMx2 (ORCPT ); Tue, 19 Jul 2022 08:53:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FE6F91CC5; Tue, 19 Jul 2022 05:20:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8735EB81B21; Tue, 19 Jul 2022 12:20:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF5ACC341C6; Tue, 19 Jul 2022 12:20:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233254; bh=LImAdXCTNx1YClH8FEaycD4Q8yoRVyjvoe4rawmcKfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=REEk/r4D2hkiFT9BgWBeR+iWbj5bCQhNcjhZqBszKPVOYwqfMTNYHRE/12RCH+fDb uuUFnABzFx5rKW6qMw6EPtNcCrTk8hFJOoxFOyeuWY/DaPt7GrWH1nfOXOVDDhfJOZ 4f36zC3ztuQmMW6AFp9hnCIJtxHT8q93L4vvAL8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ansgar=20L=C3=B6=C3=9Fer?= , Dave Chinner , Linus Torvalds Subject: [PATCH 5.18 031/231] fs/remap: constrain dedupe of EOF blocks Date: Tue, 19 Jul 2022 13:51:56 +0200 Message-Id: <20220719114716.714237869@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Chinner commit 5750676b64a561f7ec920d7c6ba130fc9c7378f3 upstream. If dedupe of an EOF block is not constrainted to match against only other EOF blocks with the same EOF offset into the block, it can match against any other block that has the same matching initial bytes in it, even if the bytes beyond EOF in the source file do not match. Fix this by constraining the EOF block matching to only match against other EOF blocks that have identical EOF offsets and data. This allows "whole file dedupe" to continue to work without allowing eof blocks to randomly match against partial full blocks with the same data. Reported-by: Ansgar L=C3=B6=C3=9Fer Fixes: 1383a7ed6749 ("vfs: check file ranges before cloning files") Link: https://lore.kernel.org/linux-fsdevel/a7c93559-4ba1-df2f-7a85-55a1436= 96405@tu-darmstadt.de/ Signed-off-by: Dave Chinner Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/remap_range.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/remap_range.c +++ b/fs/remap_range.c @@ -71,7 +71,8 @@ static int generic_remap_checks(struct f * Otherwise, make sure the count is also block-aligned, having * already confirmed the starting offsets' block alignment. */ - if (pos_in + count =3D=3D size_in) { + if (pos_in + count =3D=3D size_in && + (!(remap_flags & REMAP_FILE_DEDUP) || pos_out + count =3D=3D size_out= )) { bcount =3D ALIGN(size_in, bs) - pos_in; } else { if (!IS_ALIGNED(count, bs)) From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6DC8C433EF for ; Tue, 19 Jul 2022 12:53:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242157AbiGSMxx (ORCPT ); Tue, 19 Jul 2022 08:53:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241569AbiGSMxb (ORCPT ); Tue, 19 Jul 2022 08:53:31 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E14991CEF; Tue, 19 Jul 2022 05:21:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C7C94CE1BE6; Tue, 19 Jul 2022 12:20:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7EBEC341C6; Tue, 19 Jul 2022 12:20:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233257; bh=7ZYWiRyY+pdBvXiE3F4IZL5+o6eMslmSkCprIoHSkHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UOEfQDM+BxtRLR058Ho3aumfaiin3saR9uXzexQyByrquNSHw41jyR1QF6E28b2rw /nMbldtiiAPYWaZEP/cWeGA9S9RsDzAtr4XAG+zK8nrnfts642N7MiiIsaXxI+JuSh rMZvTFB8ASAKRlWtAzMnzCSDovWl4m7zcDXNkpmc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , Tommy Pettersson , Ciprian Craciun , Andrew Morton Subject: [PATCH 5.18 032/231] nilfs2: fix incorrect masking of permission flags for symlinks Date: Tue, 19 Jul 2022 13:51:57 +0200 Message-Id: <20220719114716.801823071@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ryusuke Konishi commit 5924e6ec1585445f251ea92713eb15beb732622a upstream. The permission flags of newly created symlinks are wrongly dropped on nilfs2 with the current umask value even though symlinks should have 777 (rwxrwxrwx) permissions: $ umask 0022 $ touch file && ln -s file symlink; ls -l file symlink -rw-r--r--. 1 root root 0 Jun 23 16:29 file lrwxr-xr-x. 1 root root 4 Jun 23 16:29 symlink -> file This fixes the bug by inserting a missing check that excludes symlinks. Link: https://lkml.kernel.org/r/1655974441-5612-1-git-send-email-konishi.ry= usuke@gmail.com Signed-off-by: Ryusuke Konishi Reported-by: Tommy Pettersson Reported-by: Ciprian Craciun Tested-by: Ryusuke Konishi Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/nilfs2/nilfs.h | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h @@ -198,6 +198,9 @@ static inline int nilfs_acl_chmod(struct =20 static inline int nilfs_init_acl(struct inode *inode, struct inode *dir) { + if (S_ISLNK(inode->i_mode)) + return 0; + inode->i_mode &=3D ~current_umask(); return 0; } From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 678FEC43334 for ; Tue, 19 Jul 2022 12:54:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237988AbiGSMyy (ORCPT ); Tue, 19 Jul 2022 08:54:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242057AbiGSMxj (ORCPT ); Tue, 19 Jul 2022 08:53:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C47AD91CF5; Tue, 19 Jul 2022 05:21:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C58E86183D; Tue, 19 Jul 2022 12:21:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6070C341C6; Tue, 19 Jul 2022 12:20:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233260; bh=YiegBnLb7fzcdAG/9lSyNYztOpy0PPrHib+C+dJG+4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GjQkwO8sLoCAlIw1paD6lj9l4+rdfpin+FAT/aw+8NmIGuQsb4Xyujj9qti25xQMl GLQ0IX7Q0H/V7RVLnueORGuBUil9cFy0N6w8a3iI5XsrqmOO0mYxJlfEU9Y+zaLrHR RDdasUdAujp0LaHs9MlHJ2VgP7UBfkoYPY53Dc3o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , kernel test robot , Jonathan Cameron , Christoph Hellwig , Andrew Morton Subject: [PATCH 5.18 033/231] sh: convert nommu io{re,un}map() to static inline functions Date: Tue, 19 Jul 2022 13:51:58 +0200 Message-Id: <20220719114716.896280861@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven commit d684e0a52d36f8939eda30a0f31ee235ee4ee741 upstream. Recently, nommu iounmap() was converted from a static inline function to a macro again, basically reverting commit 4580ba4ad2e6b8dd ("sh: Convert iounmap() macros to inline functions"). With -Werror, this leads to build failures like: drivers/iio/adc/xilinx-ams.c: In function `ams_iounmap_ps': drivers/iio/adc/xilinx-ams.c:1195:14: error: unused variable `ams' [-We= rror=3Dunused-variable] 1195 | struct ams *ams =3D data; | ^~~ Fix this by replacing the macros for ioremap() and iounmap() by static inline functions, based on . Link: https://lkml.kernel.org/r/8d1b1766260961799b04035e7bc39a7f59729f72.16= 55708312.git.geert+renesas@glider.be Fixes: 13f1fc870dd74713 ("sh: move the ioremap implementation out of line") Signed-off-by: Geert Uytterhoeven Reported-by: kernel test robot Reported-by: Jonathan Cameron Acked-by: Jonathan Cameron Reviewed-by: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/sh/include/asm/io.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h @@ -271,8 +271,12 @@ static inline void __iomem *ioremap_prot #endif /* CONFIG_HAVE_IOREMAP_PROT */ =20 #else /* CONFIG_MMU */ -#define iounmap(addr) do { } while (0) -#define ioremap(offset, size) ((void __iomem *)(unsigned long)(offset)) +static inline void __iomem *ioremap(phys_addr_t offset, size_t size) +{ + return (void __iomem *)(unsigned long)offset; +} + +static inline void iounmap(volatile void __iomem *addr) { } #endif /* CONFIG_MMU */ =20 #define ioremap_uc ioremap From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31670C43334 for ; Tue, 19 Jul 2022 12:54:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242181AbiGSMyG (ORCPT ); Tue, 19 Jul 2022 08:54:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241964AbiGSMxj (ORCPT ); Tue, 19 Jul 2022 08:53:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E517F9284A; Tue, 19 Jul 2022 05:21:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B6B826177D; Tue, 19 Jul 2022 12:21:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8888DC341C6; Tue, 19 Jul 2022 12:21:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233262; bh=Z1JtSfxrx09o6ta6fOCcZnqAzuj3UPKp2mD7YWnzRFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yWLWNjw7ms7rE4jJ6AdMvPd9dWG513XSKcjSl0vpUvpOnWN0kLyL4ZoVdXhC7+7+D 9wKdsNdjL2Oe0PWB5xzs+A1bKPKftLMjPGRxGARBZCq3rd8tZXMkzAeS209HpC+CBA TdX264M8dsGiY2FFSFpfIufQJqoYnMqaOroEUYF4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Guozihua (Scott)" , Xiu Jianfeng , Mimi Zohar Subject: [PATCH 5.18 034/231] Revert "evm: Fix memleak in init_desc" Date: Tue, 19 Jul 2022 13:51:59 +0200 Message-Id: <20220719114717.008558923@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiu Jianfeng commit 51dd64bb99e4478fc5280171acd8e1b529eadaf7 upstream. This reverts commit ccf11dbaa07b328fa469415c362d33459c140a37. Commit ccf11dbaa07b ("evm: Fix memleak in init_desc") said there is memleak in init_desc. That may be incorrect, as we can see, tmp_tfm is saved in one of the two global variables hmac_tfm or evm_tfm[hash_algo], then if init_desc is called next time, there is no need to alloc tfm again, so in the error path of kmalloc desc or crypto_shash_init(desc), It is not a problem without freeing tmp_tfm. And also that commit did not reset the global variable to NULL after freeing tmp_tfm and this makes *tfm a dangling pointer which may cause a UAF issue. Reported-by: Guozihua (Scott) Signed-off-by: Xiu Jianfeng Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- security/integrity/evm/evm_crypto.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) --- a/security/integrity/evm/evm_crypto.c +++ b/security/integrity/evm/evm_crypto.c @@ -75,7 +75,7 @@ static struct shash_desc *init_desc(char { long rc; const char *algo; - struct crypto_shash **tfm, *tmp_tfm =3D NULL; + struct crypto_shash **tfm, *tmp_tfm; struct shash_desc *desc; =20 if (type =3D=3D EVM_XATTR_HMAC) { @@ -120,16 +120,13 @@ unlock: alloc: desc =3D kmalloc(sizeof(*desc) + crypto_shash_descsize(*tfm), GFP_KERNEL); - if (!desc) { - crypto_free_shash(tmp_tfm); + if (!desc) return ERR_PTR(-ENOMEM); - } =20 desc->tfm =3D *tfm; =20 rc =3D crypto_shash_init(desc); if (rc) { - crypto_free_shash(tmp_tfm); kfree(desc); return ERR_PTR(rc); } From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96EE4CCA481 for ; Tue, 19 Jul 2022 12:54:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242137AbiGSMy5 (ORCPT ); Tue, 19 Jul 2022 08:54:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242085AbiGSMxo (ORCPT ); Tue, 19 Jul 2022 08:53:44 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64F244D818; Tue, 19 Jul 2022 05:21:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id B18C5CE1BE6; Tue, 19 Jul 2022 12:21:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71CF2C341C6; Tue, 19 Jul 2022 12:21:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233266; bh=YQIHXmKH+az7sis9wuVVKnBmB7cfCuc3yl8zuNYlzrc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lWFeGcmr1rjViBvfdCtkn/wuasm1uFb0zZL98MUnF4Jqaep49NMTY3xyib/VAQCAh zjn/qIvxjMIX/lFxMZhsMhEzSxYb4rzG5IurDWOOFvOlPPnw7IZCpN9V9bTY0TEO/9 mWidC19hvgfjBT/Ae5M3kyK3vROiOmzZ3lpvsfT0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Dmitry Osipenko , Philipp Zabel , Sasha Levin Subject: [PATCH 5.18 035/231] reset: Fix devm bulk optional exclusive control getter Date: Tue, 19 Jul 2022 13:52:00 +0200 Message-Id: <20220719114717.105423059@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit a57f68ddc8865d59a19783080cc52fb4a11dc209 ] Most likely due to copy-paste mistake the device managed version of the denoted reset control getter has been implemented with invalid semantic, which can be immediately spotted by having "WARN_ON(shared && acquired)" warning in the system log as soon as the method is called. Anyway let's fix it by altering the boolean arguments passed to the __devm_reset_control_bulk_get() method from - shared =3D true, optional =3D false, acquired =3D true to + shared =3D false, optional =3D true, acquired =3D true That's what they were supposed to be in the first place (see the non-devm version of the same method: reset_control_bulk_get_optional_exclusive()). Fixes: 48d71395896d ("reset: Add reset_control_bulk API") Signed-off-by: Serge Semin Reviewed-by: Dmitry Osipenko Signed-off-by: Philipp Zabel Link: https://lore.kernel.org/r/20220624141853.7417-2-Sergey.Semin@baikalel= ectronics.ru Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/linux/reset.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/reset.h b/include/linux/reset.h index 8a21b5756c3e..514ddf003efc 100644 --- a/include/linux/reset.h +++ b/include/linux/reset.h @@ -731,7 +731,7 @@ static inline int __must_check devm_reset_control_bulk_get_optional_exclusive(struct device *dev, int num= _rstcs, struct reset_control_bulk_data *rstcs) { - return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, true, false, = true); + return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, false, true, = true); } =20 /** --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 584F2C433EF for ; Tue, 19 Jul 2022 12:55:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242187AbiGSMzC (ORCPT ); Tue, 19 Jul 2022 08:55:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242139AbiGSMxo (ORCPT ); Tue, 19 Jul 2022 08:53:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC71C93683; Tue, 19 Jul 2022 05:21:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B6BDC61632; Tue, 19 Jul 2022 12:21:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83B0AC36AE2; Tue, 19 Jul 2022 12:21:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233269; bh=XqUar53X0WCUploVd2601cBTpJUGeQ7FOY/0679aZwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DM9Me7CEye8Rg99MCNNyog+UQZNISqY+1HIOPtMwqAdo5nvlteKTRudx2UxvsEaiO htarHBHTDO/BZ6zPJ3E0roqkaX+VTBiuuPdmXM3iEIdIdul4kRjdT16YIeAam5YIYZ 8bvFDFazNP2H1Hxphh/7NQYgs7313vp6ybB9qNG0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Anderson , Michael Walle , Shawn Guo , Sasha Levin Subject: [PATCH 5.18 036/231] arm64: dts: ls1028a: Update SFP node to include clock Date: Tue, 19 Jul 2022 13:52:01 +0200 Message-Id: <20220719114717.191147860@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Anderson [ Upstream commit 3c12e9da3098a30fc82dea01768d355c28e3692d ] The clocks property is now mandatory. Add it to avoid warning message. Signed-off-by: Sean Anderson Reviewed-by: Michael Walle Fixes: eba5bea8f37f ("arm64: dts: ls1028a: add efuse node") Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/bo= ot/dts/freescale/fsl-ls1028a.dtsi index 088271d49139..59b289b52a28 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi @@ -224,9 +224,12 @@ rst: syscon@1e60000 { little-endian; }; =20 - efuse@1e80000 { + sfp: efuse@1e80000 { compatible =3D "fsl,ls1028a-sfp"; reg =3D <0x0 0x1e80000 0x0 0x10000>; + clocks =3D <&clockgen QORIQ_CLK_PLATFORM_PLL + QORIQ_CLK_PLL_DIV(4)>; + clock-names =3D "sfp"; #address-cells =3D <1>; #size-cells =3D <1>; =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 756B3C433EF for ; Tue, 19 Jul 2022 12:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241908AbiGSMv2 (ORCPT ); Tue, 19 Jul 2022 08:51:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242244AbiGSMt5 (ORCPT ); Tue, 19 Jul 2022 08:49:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF8CB57258; Tue, 19 Jul 2022 05:19:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 638F9B81B2D; Tue, 19 Jul 2022 12:19:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DB51C341C6; Tue, 19 Jul 2022 12:19:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233188; bh=8HMYi2EllsBRqBevCrSHuIbvxXPKyVJozZ70rU+aggg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CyQIA/tDZRxACrlt7fNh+PMuzbfvFhOW4KJyGICzMHnfKzaauaJhUCMCLUI0+uyJt DHwkPcDgz6vos1UC/ZfyZPQijQH/0UaLX41Hp58nmpwha7LEtEZlFCuL8gU42xU+Wc U9gVkB/tApm5iKBFD8CfRFVl9u9chF4hTkMV9g0c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kris Bahnsen , Fabio Estevam , Shawn Guo , Sasha Levin Subject: [PATCH 5.18 037/231] ARM: dts: imx6qdl-ts7970: Fix ngpio typo and count Date: Tue, 19 Jul 2022 13:52:02 +0200 Message-Id: <20220719114717.277066323@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kris Bahnsen [ Upstream commit e95ea0f687e679fcb0a3a67d0755b81ee7d60db0 ] Device-tree incorrectly used "ngpio" which caused the driver to fallback to 32 ngpios. This platform has 62 GPIO registers. Fixes: 9ff8e9fccef9 ("ARM: dts: TS-7970: add basic device tree") Signed-off-by: Kris Bahnsen Reviewed-by: Fabio Estevam Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/boot/dts/imx6qdl-ts7970.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6qdl-ts7970.dtsi b/arch/arm/boot/dts/imx6= qdl-ts7970.dtsi index fded07f370b3..d6ba4b2a60f6 100644 --- a/arch/arm/boot/dts/imx6qdl-ts7970.dtsi +++ b/arch/arm/boot/dts/imx6qdl-ts7970.dtsi @@ -226,7 +226,7 @@ gpio8: gpio@28 { reg =3D <0x28>; #gpio-cells =3D <2>; gpio-controller; - ngpio =3D <32>; + ngpios =3D <62>; }; =20 sgtl5000: codec@a { --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21C75C43334 for ; Tue, 19 Jul 2022 12:51:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238373AbiGSMvY (ORCPT ); Tue, 19 Jul 2022 08:51:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242225AbiGSMtz (ORCPT ); Tue, 19 Jul 2022 08:49:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C91CE43315; Tue, 19 Jul 2022 05:19:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1502EB81B10; Tue, 19 Jul 2022 12:19:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 753D7C341C6; Tue, 19 Jul 2022 12:19:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233190; bh=svGjCciLe2V3mMCFmTerpL7i6k7+OeAHHrb161NsqsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1h6r78PNyQytGLOGvwQpIOqmNmkejbnP0tABapufkYHKhAvRa2UPKflXajJCZU+SZ jzMH2a0Taje1ufQVZzbSt8MHtF2AzTWDxSHzKxIUnJ4VslhA7VJQdAkfLE2e6C7v+j 5gxLh/8aCCaTe0m55X9rgOu0T/g2/S4MNcqOYz3A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sudeep Holla , Daire McNamara , Conor Dooley , Sasha Levin Subject: [PATCH 5.18 038/231] riscv: dts: microchip: hook up the mpfs l2cache Date: Tue, 19 Jul 2022 13:52:03 +0200 Message-Id: <20220719114717.386407986@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Conor Dooley [ Upstream commit efa310ba00716d7a872bdc5fa1f5545edc9efd69 ] The initial PolarFire SoC devicetree must have been forked off from the fu540 one prior to the addition of l2cache controller support being added there. When the controller node was added to mpfs.dtsi, it was not hooked up to the CPUs & thus sysfs reports an incorrect cache configuration. Hook it up. Fixes: 0fa6107eca41 ("RISC-V: Initial DTS for Microchip ICICLE board") Reviewed-by: Sudeep Holla Reviewed-by: Daire McNamara Signed-off-by: Conor Dooley Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi b/arch/riscv= /boot/dts/microchip/microchip-mpfs.dtsi index f44fce1fe080..2f75e39d2fdd 100644 --- a/arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi +++ b/arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi @@ -51,6 +51,7 @@ cpu1: cpu@1 { riscv,isa =3D "rv64imafdc"; clocks =3D <&clkcfg CLK_CPU>; tlb-split; + next-level-cache =3D <&cctrllr>; status =3D "okay"; =20 cpu1_intc: interrupt-controller { @@ -78,6 +79,7 @@ cpu2: cpu@2 { riscv,isa =3D "rv64imafdc"; clocks =3D <&clkcfg CLK_CPU>; tlb-split; + next-level-cache =3D <&cctrllr>; status =3D "okay"; =20 cpu2_intc: interrupt-controller { @@ -105,6 +107,7 @@ cpu3: cpu@3 { riscv,isa =3D "rv64imafdc"; clocks =3D <&clkcfg CLK_CPU>; tlb-split; + next-level-cache =3D <&cctrllr>; status =3D "okay"; =20 cpu3_intc: interrupt-controller { @@ -132,6 +135,7 @@ cpu4: cpu@4 { riscv,isa =3D "rv64imafdc"; clocks =3D <&clkcfg CLK_CPU>; tlb-split; + next-level-cache =3D <&cctrllr>; status =3D "okay"; cpu4_intc: interrupt-controller { #interrupt-cells =3D <1>; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7C74CCA481 for ; Tue, 19 Jul 2022 12:51:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239414AbiGSMvb (ORCPT ); Tue, 19 Jul 2022 08:51:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242252AbiGSMt6 (ORCPT ); Tue, 19 Jul 2022 08:49:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F31BE59254; Tue, 19 Jul 2022 05:19:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 228CFB81B2C; Tue, 19 Jul 2022 12:19:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B642C341C6; Tue, 19 Jul 2022 12:19:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233193; bh=yHoAhGSzQVhcwIArIP2AxbzqpTlGQtXQw1uz9/g2c+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MhgpnETywlEDY7VqMtEZhzvS8iDEH8HVXUGwDLui7CH1vdcULevJlmjG3memq2Ld7 fJuywl3HkFzEHchT7Ib3Rpa6X7jAlOEUWpsBStEtdjqytNrIpLEYuWx8G9YiPJErX8 PM9kJz9HKOnj1YiYdrMCRFMb1ftEeav7NlSIXfXQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anastasios Vacharakis , Cristian Ciocaltea , Mark Brown , Sasha Levin Subject: [PATCH 5.18 039/231] spi: amd: Limit max transfer and message size Date: Tue, 19 Jul 2022 13:52:04 +0200 Message-Id: <20220719114717.498118965@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cristian Ciocaltea [ Upstream commit 6ece49c56965544262523dae4a071ace3db63507 ] Enabling the SPI CS35L41 audio codec driver for Steam Deck [1] revealed a problem with the current AMD SPI controller driver implementation, consisting of an unrecoverable system hang. The issue can be prevented if we ensure the max transfer size and the max message size do not exceed the FIFO buffer size. According to the implementation of the downstream driver, the AMD SPI controller is not able to handle more than 70 bytes per transfer, which corresponds to the size of the FIFO buffer. Hence, let's fix this by setting the SPI limits mentioned above. [1] https://lore.kernel.org/r/20220621213819.262537-1-cristian.ciocaltea@co= llabora.com Reported-by: Anastasios Vacharakis Fixes: bbb336f39efc ("spi: spi-amd: Add AMD SPI controller driver support") Signed-off-by: Cristian Ciocaltea Link: https://lore.kernel.org/r/20220706100626.1234731-2-cristian.ciocaltea= @collabora.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/spi/spi-amd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index cba6a4486c24..efdcbe6c4c26 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -33,6 +33,7 @@ #define AMD_SPI_RX_COUNT_REG 0x4B #define AMD_SPI_STATUS_REG 0x4C =20 +#define AMD_SPI_FIFO_SIZE 70 #define AMD_SPI_MEM_SIZE 200 =20 /* M_CMD OP codes for SPI */ @@ -270,6 +271,11 @@ static int amd_spi_master_transfer(struct spi_master *= master, return 0; } =20 +static size_t amd_spi_max_transfer_size(struct spi_device *spi) +{ + return AMD_SPI_FIFO_SIZE; +} + static int amd_spi_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -302,6 +308,8 @@ static int amd_spi_probe(struct platform_device *pdev) master->flags =3D SPI_MASTER_HALF_DUPLEX; master->setup =3D amd_spi_master_setup; master->transfer_one_message =3D amd_spi_master_transfer; + master->max_transfer_size =3D amd_spi_max_transfer_size; + master->max_message_size =3D amd_spi_max_transfer_size; =20 /* Register the controller with SPI framework */ err =3D devm_spi_register_master(dev, master); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ECF4C43334 for ; Tue, 19 Jul 2022 12:52:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241874AbiGSMv6 (ORCPT ); Tue, 19 Jul 2022 08:51:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242254AbiGSMt6 (ORCPT ); Tue, 19 Jul 2022 08:49:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44E4959258; Tue, 19 Jul 2022 05:19:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7AD7A6187F; Tue, 19 Jul 2022 12:19:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 474EDC341C6; Tue, 19 Jul 2022 12:19:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233196; bh=fOlF4eY+hzJn4YXVxFeaaXj09DXc9UVTfIYTLEV6CfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1YiWtWVQueZqgQBjYSRNovevV9OUJwCTtSXPiWozCUfM/2YFZ9BXBej8mxioAc3Ba 9262uC3WYPkXnP8k+wGZYS91/LUCB6x4CPTOYZ9PoinrA6jiigSB/v8Rjict0Amboq Mnanc3VtvcmTRbhfFldjSkaStEjrEwteUU7WWFTg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jon Hunter , Ard Biesheuvel , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.18 040/231] ARM: 9209/1: Spectre-BHB: avoid pr_info() every time a CPU comes out of idle Date: Tue, 19 Jul 2022 13:52:05 +0200 Message-Id: <20220719114717.617309685@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel [ Upstream commit 0609e200246bfd3b7516091c491bec4308349055 ] Jon reports that the Spectre-BHB init code is filling up the kernel log with spurious notifications about which mitigation has been enabled, every time any CPU comes out of a low power state. Given that Spectre-BHB mitigations are system wide, only a single mitigation can be enabled, and we already print an error if two types of CPUs coexist in a single system that require different Spectre-BHB mitigations. This means that the pr_info() that describes the selected mitigation does not need to be emitted for each CPU anyway, and so we can simply emit it only once. In order to clarify the above in the log message, update it to describe that the selected mitigation will be enabled on all CPUs, including ones that are unaffected. If another CPU comes up later that is affected and requires a different mitigation, we report an error as before. Fixes: b9baf5c8c5c3 ("ARM: Spectre-BHB workaround") Tested-by: Jon Hunter Signed-off-by: Ard Biesheuvel Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/mm/proc-v7-bugs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/mm/proc-v7-bugs.c b/arch/arm/mm/proc-v7-bugs.c index f9730eba0632..8bc7a2d6d6c7 100644 --- a/arch/arm/mm/proc-v7-bugs.c +++ b/arch/arm/mm/proc-v7-bugs.c @@ -208,10 +208,10 @@ static int spectre_bhb_install_workaround(int method) return SPECTRE_VULNERABLE; =20 spectre_bhb_method =3D method; - } =20 - pr_info("CPU%u: Spectre BHB: using %s workaround\n", - smp_processor_id(), spectre_bhb_method_name(method)); + pr_info("CPU%u: Spectre BHB: enabling %s workaround for all CPUs\n", + smp_processor_id(), spectre_bhb_method_name(method)); + } =20 return SPECTRE_MITIGATED; } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A916DC433EF for ; Tue, 19 Jul 2022 12:52:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241980AbiGSMwB (ORCPT ); Tue, 19 Jul 2022 08:52:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241586AbiGSMuM (ORCPT ); Tue, 19 Jul 2022 08:50:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 211388FD75; Tue, 19 Jul 2022 05:20:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 56A6C617D6; Tue, 19 Jul 2022 12:20:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 265D3C341C6; Tue, 19 Jul 2022 12:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233199; bh=8EB3mZIPTJPEgtKe/x6D9UDXwwwtQ9arLPzarEMA6fw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2FqVRDo9D60CQtvfuY4ti+ovVbeufYHGzsjo1CQLIeHOG4ui8VCqkqM4msRjyl9Lx 1Web0OJKw/5PX0mb0Hk2BU1AEjKfNj1iO6b1pge+ir41VcHcrSdBEfmo5n3hEAk9CY Fmm/JIE4bH804WwEw3sUTFBIY8l4p7ngWGjaT3+0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Zhen Lei , Kefeng Wang , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.18 041/231] ARM: 9210/1: Mark the FDT_FIXED sections as shareable Date: Tue, 19 Jul 2022 13:52:06 +0200 Message-Id: <20220719114717.716559534@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhen Lei [ Upstream commit 598f0a99fa8a35be44b27106b43ddc66417af3b1 ] commit 7a1be318f579 ("ARM: 9012/1: move device tree mapping out of linear region") use FDT_FIXED_BASE to map the whole FDT_FIXED_SIZE memory area which contains fdt. But it only reserves the exact physical memory that fdt occupied. Unfortunately, this mapping is non-shareable. An illegal or speculative read access can bring the RAM content from non-fdt zone into cache, PIPT makes it to be hit by subsequently read access through shareable mapping(such as linear mapping), and the cache consistency between cores is lost due to non-shareable property. |<---------FDT_FIXED_SIZE------>| | | ------------------------------- | | | | ------------------------------- 1. CoreA read through MT_ROM mapping, the old data is loaded into the cache. 2. CoreB write to update data through linear mapping. CoreA received the notification to invalid the corresponding cachelines, but the property non-shareable makes it to be ignored. 3. CoreA read through linear mapping, cache hit, the old data is read. To eliminate this risk, add a new memory type MT_MEMORY_RO. Compared to MT_ROM, it is shareable and non-executable. Here's an example: list_del corruption. prev->next should be c0ecbf74, but was c08410dc kernel BUG at lib/list_debug.c:53! ... ... PC is at __list_del_entry_valid+0x58/0x98 LR is at __list_del_entry_valid+0x58/0x98 psr: 60000093 sp : c0ecbf30 ip : 00000000 fp : 00000001 r10: c08410d0 r9 : 00000001 r8 : c0825e0c r7 : 20000013 r6 : c08410d0 r5 : c0ecbf74 r4 : c0ecbf74 r3 : c0825d08 r2 : 00000000 r1 : df7ce6f4 r0 : 00000044 ... ... Stack: (0xc0ecbf30 to 0xc0ecc000) bf20: c0ecbf74 c0164fd0 c0ecbf70 c016= 5170 bf40: c0eca000 c0840c00 c0840c00 c0824500 c0825e0c c0189bbc c088f404 6000= 0013 bf60: 60000013 c0e85100 000004ec 00000000 c0ebcdc0 c0ecbf74 c0ecbf74 c082= 5d08 ... ... < next prev > (__list_del_entry_valid) from (__list_del_entry+0xc/0x20) (__list_del_entry) from (finish_swait+0x60/0x7c) (finish_swait) from (rcu_gp_kthread+0x560/0xa20) (rcu_gp_kthread) from (kthread+0x14c/0x15c) (kthread) from (ret_from_fork+0x14/0x24) The faulty list node to be deleted is a local variable, its address is c0ecbf74. The dumped stack shows that 'prev' =3D c0ecbf74, but its value before lib/list_debug.c:53 is c08410dc. A large amount of printing results in swapping out the cacheline containing the old data(MT_ROM mapping is read only, so the cacheline cannot be dirty), and the subsequent dump operation obtains new data from the DDR. Fixes: 7a1be318f579 ("ARM: 9012/1: move device tree mapping out of linear r= egion") Suggested-by: Ard Biesheuvel Signed-off-by: Zhen Lei Reviewed-by: Ard Biesheuvel Reviewed-by: Kefeng Wang Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/include/asm/mach/map.h | 1 + arch/arm/mm/mmu.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/ma= p.h index 92282558caf7..2b8970d8e5a2 100644 --- a/arch/arm/include/asm/mach/map.h +++ b/arch/arm/include/asm/mach/map.h @@ -27,6 +27,7 @@ enum { MT_HIGH_VECTORS, MT_MEMORY_RWX, MT_MEMORY_RW, + MT_MEMORY_RO, MT_ROM, MT_MEMORY_RWX_NONCACHED, MT_MEMORY_RW_DTCM, diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 5e2be37a198e..cd17e324aa51 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -296,6 +296,13 @@ static struct mem_type mem_types[] __ro_after_init =3D= { .prot_sect =3D PMD_TYPE_SECT | PMD_SECT_AP_WRITE, .domain =3D DOMAIN_KERNEL, }, + [MT_MEMORY_RO] =3D { + .prot_pte =3D L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | + L_PTE_XN | L_PTE_RDONLY, + .prot_l1 =3D PMD_TYPE_TABLE, + .prot_sect =3D PMD_TYPE_SECT, + .domain =3D DOMAIN_KERNEL, + }, [MT_ROM] =3D { .prot_sect =3D PMD_TYPE_SECT, .domain =3D DOMAIN_KERNEL, @@ -489,6 +496,7 @@ static void __init build_mem_type_table(void) =20 /* Also setup NX memory mapping */ mem_types[MT_MEMORY_RW].prot_sect |=3D PMD_SECT_XN; + mem_types[MT_MEMORY_RO].prot_sect |=3D PMD_SECT_XN; } if (cpu_arch >=3D CPU_ARCH_ARMv7 && (cr & CR_TRE)) { /* @@ -568,6 +576,7 @@ static void __init build_mem_type_table(void) mem_types[MT_ROM].prot_sect |=3D PMD_SECT_APX|PMD_SECT_AP_WRITE; mem_types[MT_MINICLEAN].prot_sect |=3D PMD_SECT_APX|PMD_SECT_AP_WRITE; mem_types[MT_CACHECLEAN].prot_sect |=3D PMD_SECT_APX|PMD_SECT_AP_WRITE; + mem_types[MT_MEMORY_RO].prot_sect |=3D PMD_SECT_APX|PMD_SECT_AP_WRITE; #endif =20 /* @@ -587,6 +596,8 @@ static void __init build_mem_type_table(void) mem_types[MT_MEMORY_RWX].prot_pte |=3D L_PTE_SHARED; mem_types[MT_MEMORY_RW].prot_sect |=3D PMD_SECT_S; mem_types[MT_MEMORY_RW].prot_pte |=3D L_PTE_SHARED; + mem_types[MT_MEMORY_RO].prot_sect |=3D PMD_SECT_S; + mem_types[MT_MEMORY_RO].prot_pte |=3D L_PTE_SHARED; mem_types[MT_MEMORY_DMA_READY].prot_pte |=3D L_PTE_SHARED; mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |=3D PMD_SECT_S; mem_types[MT_MEMORY_RWX_NONCACHED].prot_pte |=3D L_PTE_SHARED; @@ -647,6 +658,8 @@ static void __init build_mem_type_table(void) mem_types[MT_MEMORY_RWX].prot_pte |=3D kern_pgprot; mem_types[MT_MEMORY_RW].prot_sect |=3D ecc_mask | cp->pmd; mem_types[MT_MEMORY_RW].prot_pte |=3D kern_pgprot; + mem_types[MT_MEMORY_RO].prot_sect |=3D ecc_mask | cp->pmd; + mem_types[MT_MEMORY_RO].prot_pte |=3D kern_pgprot; mem_types[MT_MEMORY_DMA_READY].prot_pte |=3D kern_pgprot; mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |=3D ecc_mask; mem_types[MT_ROM].prot_sect |=3D cp->pmd; @@ -1360,7 +1373,7 @@ static void __init devicemaps_init(const struct machi= ne_desc *mdesc) map.pfn =3D __phys_to_pfn(__atags_pointer & SECTION_MASK); map.virtual =3D FDT_FIXED_BASE; map.length =3D FDT_FIXED_SIZE; - map.type =3D MT_ROM; + map.type =3D MT_MEMORY_RO; create_mapping(&map); } =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 631EDC43334 for ; Tue, 19 Jul 2022 12:52:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241995AbiGSMwI (ORCPT ); Tue, 19 Jul 2022 08:52:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241865AbiGSMuo (ORCPT ); Tue, 19 Jul 2022 08:50:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4991FE3F; Tue, 19 Jul 2022 05:20:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CBDAEB81B10; Tue, 19 Jul 2022 12:20:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BD6DC341C6; Tue, 19 Jul 2022 12:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233202; bh=EGrQT0mVn4ASmMZ1VwlUuqottBeCgxiUZIxd64etzh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kdBSpDAoAMsKykXNMsj0q34JSG9BTSePjAUgZeXnAcmuI0VdSQVxUhbSu92hKm48C pXqnlgx70pDceQ5wBe3Z2f34ODbTmpffItPWr0uhiW/0CjUVX2aM2VyUD7LwccU8+L n/jft3CGkOkwmFUD8+Qjypy3CZHo8hG8a0iANU5o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tariq Toukan , Maxim Mikityanskiy , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 042/231] net/mlx5e: kTLS, Fix build time constant test in TX Date: Tue, 19 Jul 2022 13:52:07 +0200 Message-Id: <20220719114717.814160893@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tariq Toukan [ Upstream commit 6cc2714e85754a621219693ea8aa3077d6fca0cb ] Use the correct constant (TLS_DRIVER_STATE_SIZE_TX) in the comparison against the size of the private TX TLS driver context. Fixes: df8d866770f9 ("net/mlx5e: kTLS, Use kernel API to extract private of= fload context") Signed-off-by: Tariq Toukan Reviewed-by: Maxim Mikityanskiy Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c b/d= rivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c index aaf11c66bf4c..6f12764d8880 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c @@ -68,8 +68,7 @@ mlx5e_set_ktls_tx_priv_ctx(struct tls_context *tls_ctx, struct mlx5e_ktls_offload_context_tx **ctx =3D __tls_driver_ctx(tls_ctx, TLS_OFFLOAD_CTX_DIR_TX); =20 - BUILD_BUG_ON(sizeof(struct mlx5e_ktls_offload_context_tx *) > - TLS_OFFLOAD_CONTEXT_SIZE_TX); + BUILD_BUG_ON(sizeof(priv_tx) > TLS_DRIVER_STATE_SIZE_TX); =20 *ctx =3D priv_tx; } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DA0FC433EF for ; Tue, 19 Jul 2022 12:52:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242006AbiGSMwP (ORCPT ); Tue, 19 Jul 2022 08:52:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241884AbiGSMuu (ORCPT ); Tue, 19 Jul 2022 08:50:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56F2538B2; Tue, 19 Jul 2022 05:20:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 396B561632; Tue, 19 Jul 2022 12:20:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBE00C341C6; Tue, 19 Jul 2022 12:20:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233205; bh=RWkPFg8iPnAEXeqTb59I7ltWN+uZfUb1z3BOSRgLz8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wsdf2jxl6LgbF+9n3OrtE38+FqE/54tJF020zJbOgBuKbT3PLrM2vFRqnaWyWhhF2 pGqdPq4L+mMTcVQQcaAUoS4jpiWydyJ6o+FE4+52wCSqnxp6xuDKGjUfHuFJ6Qjimo nC6AQbYDdvmsDYU5+ODdFCOjey0CMB8Yi8B1aPcw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tariq Toukan , Maxim Mikityanskiy , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 043/231] net/mlx5e: kTLS, Fix build time constant test in RX Date: Tue, 19 Jul 2022 13:52:08 +0200 Message-Id: <20220719114717.904906292@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tariq Toukan [ Upstream commit 2ec6cf9b742a5c18982861322fa5de6510f8f57e ] Use the correct constant (TLS_DRIVER_STATE_SIZE_RX) in the comparison against the size of the private RX TLS driver context. Fixes: 1182f3659357 ("net/mlx5e: kTLS, Add kTLS RX HW offload support") Signed-off-by: Tariq Toukan Reviewed-by: Maxim Mikityanskiy Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c b/d= rivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c index 96064a2033f7..f3f2aeb1bc21 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c @@ -231,8 +231,7 @@ mlx5e_set_ktls_rx_priv_ctx(struct tls_context *tls_ctx, struct mlx5e_ktls_offload_context_rx **ctx =3D __tls_driver_ctx(tls_ctx, TLS_OFFLOAD_CTX_DIR_RX); =20 - BUILD_BUG_ON(sizeof(struct mlx5e_ktls_offload_context_rx *) > - TLS_OFFLOAD_CONTEXT_SIZE_RX); + BUILD_BUG_ON(sizeof(priv_rx) > TLS_DRIVER_STATE_SIZE_RX); =20 *ctx =3D priv_rx; } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CF8FCCA47F for ; Tue, 19 Jul 2022 12:52:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241712AbiGSMwW (ORCPT ); Tue, 19 Jul 2022 08:52:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241914AbiGSMu7 (ORCPT ); Tue, 19 Jul 2022 08:50:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB3891008; Tue, 19 Jul 2022 05:20:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8E755B81B1C; Tue, 19 Jul 2022 12:20:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D66E1C341C6; Tue, 19 Jul 2022 12:20:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233208; bh=azKN/lQhuoQ3QByzhB8al9jkBGIbiOynNLq1GuN0ZSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qLQAGevjOpBWc1JED0RjWUKqpkhBAYKKBpM0sxrN8ngsVgxd5FE1s5EY4y2J4zQbv EADDwQk7SM0lBiHUAIfXYQbdT8aUZ4FEYbHkZ/J+I+nPOcuO4P/Tgj2q5nrC19Pl72 JojHqmdvbl73tOwU5fIC8ILvLOh5dchYGTa8Uz5Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Blakey , Roi Dayan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 044/231] net/mlx5e: Fix enabling sriov while tc nic rules are offloaded Date: Tue, 19 Jul 2022 13:52:09 +0200 Message-Id: <20220719114717.998845152@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Blakey [ Upstream commit 0c9d876545a56aebed30fa306d0460a4d28d271a ] There is a total of four 4M entries flow tables. In sriov disabled mode, ct, ct_nat and post_act take three of them. When adding the first tc nic rule in this mode, it will take another 4M table for the tc table. If user then enables sriov, the legacy flow table tries to take another 4M and fails, and so enablement fails. To fix that, have legacy fdb take the next available maximum size from the fs ft pool. Fixes: 4a98544d1827 ("net/mlx5: Move chains ft pool to be used by all firmw= are steering") Signed-off-by: Paul Blakey Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c b/drivers= /net/ethernet/mellanox/mlx5/core/esw/legacy.c index 9d17206d1625..fabe49a35a5c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c @@ -11,6 +11,7 @@ #include "mlx5_core.h" #include "eswitch.h" #include "fs_core.h" +#include "fs_ft_pool.h" #include "esw/qos.h" =20 enum { @@ -95,8 +96,7 @@ static int esw_create_legacy_fdb_table(struct mlx5_eswitc= h *esw) if (!flow_group_in) return -ENOMEM; =20 - table_size =3D BIT(MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size)); - ft_attr.max_fte =3D table_size; + ft_attr.max_fte =3D POOL_NEXT_SIZE; ft_attr.prio =3D LEGACY_FDB_PRIO; fdb =3D mlx5_create_flow_table(root_ns, &ft_attr); if (IS_ERR(fdb)) { @@ -105,6 +105,7 @@ static int esw_create_legacy_fdb_table(struct mlx5_eswi= tch *esw) goto out; } esw->fdb_table.legacy.fdb =3D fdb; + table_size =3D fdb->max_fte; =20 /* Addresses group : Full match unicast/multicast addresses */ MLX5_SET(create_flow_group_in, flow_group_in, match_criteria_enable, --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F4172C433EF for ; Tue, 19 Jul 2022 12:52:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242029AbiGSMw0 (ORCPT ); Tue, 19 Jul 2022 08:52:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241919AbiGSMu7 (ORCPT ); Tue, 19 Jul 2022 08:50:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8098AB86E; Tue, 19 Jul 2022 05:20:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 03F7B6177D; Tue, 19 Jul 2022 12:20:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1573C341C6; Tue, 19 Jul 2022 12:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233211; bh=JHvkOaikfq7lVP2FgXzAZJuffmnjOBt/h6hBSSmaQ9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l0wZdZ70LdKJ0eW2aKtBqfbHkmoGmoyYQh2Ic9gVvzGTbk9bMR/+GAPf5q3F2MQeZ lyb0NQ+hOxxvmd16slkbxj01tusbA7KAaAJSmUX0ju4eARvcPNKXqT/nW3Iz0pLwd0 BZeYi8TFyjdcsTcj6svG9rIjatFGoUg+QGFwLN+0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roi Dayan , Oz Shlomo , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 045/231] net/mlx5e: CT: Use own workqueue instead of mlx5e priv Date: Tue, 19 Jul 2022 13:52:10 +0200 Message-Id: <20220719114718.092751571@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Roi Dayan [ Upstream commit 6c4e8fa03fde7e5b304594294e397a9ba92feaf6 ] Allocate a ct priv workqueue instead of using mlx5e priv one so flushing will only be of related CT entries. Also move flushing of the workqueue before rhashtable destroy otherwise entries won't be valid. Fixes: b069e14fff46 ("net/mlx5e: CT: Fix queued up restore put() executing = after relevant ft release") Signed-off-by: Roi Dayan Reviewed-by: Oz Shlomo Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- .../ethernet/mellanox/mlx5/core/en/tc_ct.c | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/n= et/ethernet/mellanox/mlx5/core/en/tc_ct.c index 1ff7a07bcd06..fbcce63e5b80 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c @@ -66,6 +66,7 @@ struct mlx5_tc_ct_priv { struct mlx5_ct_fs *fs; struct mlx5_ct_fs_ops *fs_ops; spinlock_t ht_lock; /* protects ft entries */ + struct workqueue_struct *wq; }; =20 struct mlx5_ct_flow { @@ -927,14 +928,11 @@ static void mlx5_tc_ct_entry_del_work(struct work_str= uct *work) static void __mlx5_tc_ct_entry_put(struct mlx5_ct_entry *entry) { - struct mlx5e_priv *priv; - if (!refcount_dec_and_test(&entry->refcnt)) return; =20 - priv =3D netdev_priv(entry->ct_priv->netdev); INIT_WORK(&entry->work, mlx5_tc_ct_entry_del_work); - queue_work(priv->wq, &entry->work); + queue_work(entry->ct_priv->wq, &entry->work); } =20 static struct mlx5_ct_counter * @@ -1744,19 +1742,16 @@ mlx5_tc_ct_flush_ft_entry(void *ptr, void *arg) static void mlx5_tc_ct_del_ft_cb(struct mlx5_tc_ct_priv *ct_priv, struct mlx5_ct_ft *f= t) { - struct mlx5e_priv *priv; - if (!refcount_dec_and_test(&ft->refcount)) return; =20 + flush_workqueue(ct_priv->wq); nf_flow_table_offload_del_cb(ft->nf_ft, mlx5_tc_ct_block_flow_offload, ft); rhashtable_remove_fast(&ct_priv->zone_ht, &ft->node, zone_params); rhashtable_free_and_destroy(&ft->ct_entries_ht, mlx5_tc_ct_flush_ft_entry, ct_priv); - priv =3D netdev_priv(ct_priv->netdev); - flush_workqueue(priv->wq); mlx5_tc_ct_free_pre_ct_tables(ft); mapping_remove(ct_priv->zone_mapping, ft->zone_restore_id); kfree(ft); @@ -2139,6 +2134,12 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5= _fs_chains *chains, if (rhashtable_init(&ct_priv->ct_tuples_nat_ht, &tuples_nat_ht_params)) goto err_ct_tuples_nat_ht; =20 + ct_priv->wq =3D alloc_ordered_workqueue("mlx5e_ct_priv_wq", 0); + if (!ct_priv->wq) { + err =3D -ENOMEM; + goto err_wq; + } + err =3D mlx5_tc_ct_fs_init(ct_priv); if (err) goto err_init_fs; @@ -2146,6 +2147,8 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_= fs_chains *chains, return ct_priv; =20 err_init_fs: + destroy_workqueue(ct_priv->wq); +err_wq: rhashtable_destroy(&ct_priv->ct_tuples_nat_ht); err_ct_tuples_nat_ht: rhashtable_destroy(&ct_priv->ct_tuples_ht); @@ -2175,6 +2178,7 @@ mlx5_tc_ct_clean(struct mlx5_tc_ct_priv *ct_priv) if (!ct_priv) return; =20 + destroy_workqueue(ct_priv->wq); chains =3D ct_priv->chains; =20 ct_priv->fs_ops->destroy(ct_priv->fs); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12981C43334 for ; Tue, 19 Jul 2022 12:52:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242038AbiGSMwa (ORCPT ); Tue, 19 Jul 2022 08:52:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241935AbiGSMvF (ORCPT ); Tue, 19 Jul 2022 08:51:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FF82140B3; Tue, 19 Jul 2022 05:20:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 41BB6B81B10; Tue, 19 Jul 2022 12:20:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D91BC341C6; Tue, 19 Jul 2022 12:20:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233214; bh=a1+ZBTpT+ZdrHS3GrZhyAj3P83hhhru4zCKtcV/i6r0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LZo90M7ryW3Otkr2IUPgkRJi0QVmAppNRfqYOqL2kvqjLd2EdgXjFLNIBgIx1nh+O z/y9seixzxgaE7TJpwVYMPFxxnkR/alRO/PXYcJw2EpeEG2BhxdxeNUPreBobnheGt exms2waqciVaKaWceS+GGYi6kWaGyBH1fCGetigg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gal Pressman , Tariq Toukan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 046/231] net/mlx5e: Fix capability check for updating vnic env counters Date: Tue, 19 Jul 2022 13:52:11 +0200 Message-Id: <20220719114718.171333236@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gal Pressman [ Upstream commit 452133dd580811f184e76b1402983182ee425298 ] The existing capability check for vnic env counters only checks for receive steering discards, although we need the counters update for the exposed internal queue oob counter as well. This could result in the latter counter not being updated correctly when the receive steering discards counter is not supported. Fix that by checking whether any counter is supported instead of only the steering counter capability. Fixes: 0cfafd4b4ddf ("net/mlx5e: Add device out of buffer counter") Signed-off-by: Gal Pressman Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/n= et/ethernet/mellanox/mlx5/core/en_stats.c index bdc870f9c2f3..4429c848d4c4 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c @@ -688,7 +688,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(vnic_env) u32 in[MLX5_ST_SZ_DW(query_vnic_env_in)] =3D {}; struct mlx5_core_dev *mdev =3D priv->mdev; =20 - if (!MLX5_CAP_GEN(priv->mdev, nic_receive_steering_discard)) + if (!mlx5e_stats_grp_vnic_env_num_stats(priv)) return; =20 MLX5_SET(query_vnic_env_in, in, opcode, MLX5_CMD_OP_QUERY_VNIC_ENV); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F415CCA47F for ; Tue, 19 Jul 2022 12:52:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241954AbiGSMwk (ORCPT ); Tue, 19 Jul 2022 08:52:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241868AbiGSMvZ (ORCPT ); Tue, 19 Jul 2022 08:51:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C6FA4D169; Tue, 19 Jul 2022 05:20:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F3868B81B10; Tue, 19 Jul 2022 12:20:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59985C341C6; Tue, 19 Jul 2022 12:20:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233219; bh=bTkkIXzneF1RDD/g2yv2RW/fihKxB03Ej39B8/1bJdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=noHJYnQy+f+clQ724e3rl1/SARtD49DQWQUlPog1CB7eRBbHLMwRC0T64sf3m7W0X 6YMnhfTW4M+Xzn9iMdYRFTiPCfxnSOyDnIS305VVKjfB6nRQ7LkyEQVtu86W3KXRfQ ddsbvN1G7sV6wMUQH81mp+/Wp4jpIR5FJ/Hnh1uc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 047/231] net/mlx5e: Ring the TX doorbell on DMA errors Date: Tue, 19 Jul 2022 13:52:12 +0200 Message-Id: <20220719114718.247131201@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxim Mikityanskiy [ Upstream commit 5b759bf2f9d73db05369aef2344502095c4e5e73 ] TX doorbells may be postponed, because sometimes the driver knows that another packet follows (for example, when xmit_more is true, or when a MPWQE session is closed before transmitting a packet). However, the DMA mapping may fail for the next packet, in which case a new WQE is not posted, the doorbell isn't updated either, and the transmission of the previous packet will be delayed indefinitely. This commit fixes the described rare error flow by posting a NOP and ringing the doorbell on errors to flush all the previous packets. The MPWQE session is closed before that. DMA mapping in the MPWQE flow is moved to the beginning of mlx5e_sq_xmit_mpwqe, because empty sessions are not allowed. Stop room always has enough space for a NOP, because the actual TX WQE is not posted. Fixes: e586b3b0baee ("net/mlx5: Ethernet Datapath files") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- .../net/ethernet/mellanox/mlx5/core/en_tx.c | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/= ethernet/mellanox/mlx5/core/en_tx.c index 2dc48406cd08..54a3f866a345 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c @@ -318,6 +318,26 @@ static void mlx5e_tx_check_stop(struct mlx5e_txqsq *sq) } } =20 +static void mlx5e_tx_flush(struct mlx5e_txqsq *sq) +{ + struct mlx5e_tx_wqe_info *wi; + struct mlx5e_tx_wqe *wqe; + u16 pi; + + /* Must not be called when a MPWQE session is active but empty. */ + mlx5e_tx_mpwqe_ensure_complete(sq); + + pi =3D mlx5_wq_cyc_ctr2ix(&sq->wq, sq->pc); + wi =3D &sq->db.wqe_info[pi]; + + *wi =3D (struct mlx5e_tx_wqe_info) { + .num_wqebbs =3D 1, + }; + + wqe =3D mlx5e_post_nop(&sq->wq, sq->sqn, &sq->pc); + mlx5e_notify_hw(&sq->wq, sq->pc, sq->uar_map, &wqe->ctrl); +} + static inline void mlx5e_txwqe_complete(struct mlx5e_txqsq *sq, struct sk_buff *skb, const struct mlx5e_tx_attr *attr, @@ -410,6 +430,7 @@ mlx5e_sq_xmit_wqe(struct mlx5e_txqsq *sq, struct sk_buf= f *skb, err_drop: stats->dropped++; dev_kfree_skb_any(skb); + mlx5e_tx_flush(sq); } =20 static bool mlx5e_tx_skb_supports_mpwqe(struct sk_buff *skb, struct mlx5e_= tx_attr *attr) @@ -511,6 +532,13 @@ mlx5e_sq_xmit_mpwqe(struct mlx5e_txqsq *sq, struct sk_= buff *skb, struct mlx5_wqe_ctrl_seg *cseg; struct mlx5e_xmit_data txd; =20 + txd.data =3D skb->data; + txd.len =3D skb->len; + + txd.dma_addr =3D dma_map_single(sq->pdev, txd.data, txd.len, DMA_TO_DEVIC= E); + if (unlikely(dma_mapping_error(sq->pdev, txd.dma_addr))) + goto err_unmap; + if (!mlx5e_tx_mpwqe_session_is_active(sq)) { mlx5e_tx_mpwqe_session_start(sq, eseg); } else if (!mlx5e_tx_mpwqe_same_eseg(sq, eseg)) { @@ -520,18 +548,9 @@ mlx5e_sq_xmit_mpwqe(struct mlx5e_txqsq *sq, struct sk_= buff *skb, =20 sq->stats->xmit_more +=3D xmit_more; =20 - txd.data =3D skb->data; - txd.len =3D skb->len; - - txd.dma_addr =3D dma_map_single(sq->pdev, txd.data, txd.len, DMA_TO_DEVIC= E); - if (unlikely(dma_mapping_error(sq->pdev, txd.dma_addr))) - goto err_unmap; mlx5e_dma_push(sq, txd.dma_addr, txd.len, MLX5E_DMA_MAP_SINGLE); - mlx5e_skb_fifo_push(&sq->db.skb_fifo, skb); - mlx5e_tx_mpwqe_add_dseg(sq, &txd); - mlx5e_tx_skb_update_hwts_flags(skb); =20 if (unlikely(mlx5e_tx_mpwqe_is_full(&sq->mpwqe, sq->max_sq_mpw_wqebbs))) { @@ -553,6 +572,7 @@ mlx5e_sq_xmit_mpwqe(struct mlx5e_txqsq *sq, struct sk_b= uff *skb, mlx5e_dma_unmap_wqe_err(sq, 1); sq->stats->dropped++; dev_kfree_skb_any(skb); + mlx5e_tx_flush(sq); } =20 void mlx5e_tx_mpwqe_ensure_complete(struct mlx5e_txqsq *sq) @@ -935,5 +955,6 @@ void mlx5i_sq_xmit(struct mlx5e_txqsq *sq, struct sk_bu= ff *skb, err_drop: stats->dropped++; dev_kfree_skb_any(skb); + mlx5e_tx_flush(sq); } #endif --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D41FCCA47F for ; Tue, 19 Jul 2022 12:52:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241608AbiGSMwn (ORCPT ); Tue, 19 Jul 2022 08:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241827AbiGSMvb (ORCPT ); Tue, 19 Jul 2022 08:51:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DAD5528A8; Tue, 19 Jul 2022 05:20:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A3FDD6177D; Tue, 19 Jul 2022 12:20:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40B58C341C6; Tue, 19 Jul 2022 12:20:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233222; bh=cey1oaBxcEhch8J5lfJN4U0SmBTjN4OUZg8Q9ANH8E0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yZBhXkTVkkOq4eW6ka6HUuGjmU69QxdUTAH5yH/zmz8UPCtwt76SIL5/z9ZL2c/kV 2APih/5Jq9kHyTMy5138p1pugk8MimA+bY+cS6wXsKjdyLr9eby8fpiFjcO+X7rpA9 U0tPemeokOXSjrkqJpiOlJOHUlK4GcEN2fuqstbs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 048/231] drm/amdgpu: keep fbdev buffers pinned during suspend Date: Tue, 19 Jul 2022 13:52:13 +0200 Message-Id: <20220719114718.322469240@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alex Deucher [ Upstream commit f9a89117fbdc63c0d4ab63a8f3596a72c245bcfe ] Was dropped when we converted to the generic helpers. Fixes: 087451f372bf ("drm/amdgpu: use generic fb helpers instead of setting= up AMD own's.") Acked-by: Evan Quan Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 25 +++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/= amd/amdgpu/amdgpu_display.c index fae5c1debfad..ffb3702745a5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -1547,6 +1547,21 @@ bool amdgpu_crtc_get_scanout_position(struct drm_crt= c *crtc, stime, etime, mode); } =20 +static bool +amdgpu_display_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *ro= bj) +{ + struct drm_device *dev =3D adev_to_drm(adev); + struct drm_fb_helper *fb_helper =3D dev->fb_helper; + + if (!fb_helper || !fb_helper->buffer) + return false; + + if (gem_to_amdgpu_bo(fb_helper->buffer->gem) !=3D robj) + return false; + + return true; +} + int amdgpu_display_suspend_helper(struct amdgpu_device *adev) { struct drm_device *dev =3D adev_to_drm(adev); @@ -1582,10 +1597,12 @@ int amdgpu_display_suspend_helper(struct amdgpu_dev= ice *adev) continue; } robj =3D gem_to_amdgpu_bo(fb->obj[0]); - r =3D amdgpu_bo_reserve(robj, true); - if (r =3D=3D 0) { - amdgpu_bo_unpin(robj); - amdgpu_bo_unreserve(robj); + if (!amdgpu_display_robj_is_fb(adev, robj)) { + r =3D amdgpu_bo_reserve(robj, true); + if (r =3D=3D 0) { + amdgpu_bo_unpin(robj); + amdgpu_bo_unreserve(robj); + } } } return 0; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16C62C433EF for ; Tue, 19 Jul 2022 12:52:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242067AbiGSMwq (ORCPT ); Tue, 19 Jul 2022 08:52:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241964AbiGSMvo (ORCPT ); Tue, 19 Jul 2022 08:51:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B8F852E5B; Tue, 19 Jul 2022 05:20:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5C563618C1; Tue, 19 Jul 2022 12:20:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C368C341C6; Tue, 19 Jul 2022 12:20:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233225; bh=AwrNUyJ+gTyGLLuHMZvIklSgNiAJstrEsmVJBq3MzzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hpNLE3rzcYajz/8Rj+/OXJ2IQO9NOm+B4XyB9+6BDnt0LMGv9HPR6PQE7RqwwoEV/ 4xuS0pFtTXn8MvcPaxF6E81IMDQaghcFmFHF5YYXDY5cduXInD9SJXUUVAuK4SuwDb UTTNtKlK90+62boFhj3SZH9P0ffnpOItLSRZVwfI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 049/231] drm/amdgpu/display: disable prefer_shadow for generic fb helpers Date: Tue, 19 Jul 2022 13:52:14 +0200 Message-Id: <20220719114718.397171732@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alex Deucher [ Upstream commit 3a4b1cc28fbdc2325b3e3ed7d8024995a75f9216 ] Seems to break hibernation. Disable for now until we can root cause it. Fixes: 087451f372bf ("drm/amdgpu: use generic fb helpers instead of setting= up AMD own's.") Bug: https://bugzilla.kernel.org/show_bug.cgi?id=3D216119 Acked-by: Evan Quan Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 3 ++- drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 3 ++- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c b/drivers/gpu/drm/amd= /amdgpu/amdgpu_vkms.c index 5224d9a39737..842670d4a12e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c @@ -494,7 +494,8 @@ static int amdgpu_vkms_sw_init(void *handle) adev_to_drm(adev)->mode_config.max_height =3D YRES_MAX; =20 adev_to_drm(adev)->mode_config.preferred_depth =3D 24; - adev_to_drm(adev)->mode_config.prefer_shadow =3D 1; + /* disable prefer shadow for now due to hibernation issues */ + adev_to_drm(adev)->mode_config.prefer_shadow =3D 0; =20 adev_to_drm(adev)->mode_config.fb_base =3D adev->gmc.aper_base; =20 diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/a= mdgpu/dce_v10_0.c index 288fce7dc0ed..9c964cd3b5d4 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c @@ -2796,7 +2796,8 @@ static int dce_v10_0_sw_init(void *handle) adev_to_drm(adev)->mode_config.max_height =3D 16384; =20 adev_to_drm(adev)->mode_config.preferred_depth =3D 24; - adev_to_drm(adev)->mode_config.prefer_shadow =3D 1; + /* disable prefer shadow for now due to hibernation issues */ + adev_to_drm(adev)->mode_config.prefer_shadow =3D 0; =20 adev_to_drm(adev)->mode_config.fb_modifiers_not_supported =3D true; =20 diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/a= mdgpu/dce_v11_0.c index cbe5250b31cb..e0ad9f27dc3f 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c @@ -2914,7 +2914,8 @@ static int dce_v11_0_sw_init(void *handle) adev_to_drm(adev)->mode_config.max_height =3D 16384; =20 adev_to_drm(adev)->mode_config.preferred_depth =3D 24; - adev_to_drm(adev)->mode_config.prefer_shadow =3D 1; + /* disable prefer shadow for now due to hibernation issues */ + adev_to_drm(adev)->mode_config.prefer_shadow =3D 0; =20 adev_to_drm(adev)->mode_config.fb_modifiers_not_supported =3D true; =20 diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/am= dgpu/dce_v6_0.c index 982855e6cf52..3caf6f386042 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c @@ -2673,7 +2673,8 @@ static int dce_v6_0_sw_init(void *handle) adev_to_drm(adev)->mode_config.max_width =3D 16384; adev_to_drm(adev)->mode_config.max_height =3D 16384; adev_to_drm(adev)->mode_config.preferred_depth =3D 24; - adev_to_drm(adev)->mode_config.prefer_shadow =3D 1; + /* disable prefer shadow for now due to hibernation issues */ + adev_to_drm(adev)->mode_config.prefer_shadow =3D 0; adev_to_drm(adev)->mode_config.fb_modifiers_not_supported =3D true; adev_to_drm(adev)->mode_config.fb_base =3D adev->gmc.aper_base; =20 diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/am= dgpu/dce_v8_0.c index 84440741c60b..7c75df5bffed 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c @@ -2693,7 +2693,8 @@ static int dce_v8_0_sw_init(void *handle) adev_to_drm(adev)->mode_config.max_height =3D 16384; =20 adev_to_drm(adev)->mode_config.preferred_depth =3D 24; - adev_to_drm(adev)->mode_config.prefer_shadow =3D 1; + /* disable prefer shadow for now due to hibernation issues */ + adev_to_drm(adev)->mode_config.prefer_shadow =3D 0; =20 adev_to_drm(adev)->mode_config.fb_modifiers_not_supported =3D true; =20 diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gp= u/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 6dc9808760fc..b55a433e829e 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -3847,7 +3847,8 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_d= evice *adev) adev_to_drm(adev)->mode_config.max_height =3D 16384; =20 adev_to_drm(adev)->mode_config.preferred_depth =3D 24; - adev_to_drm(adev)->mode_config.prefer_shadow =3D 1; + /* disable prefer shadow for now due to hibernation issues */ + adev_to_drm(adev)->mode_config.prefer_shadow =3D 0; /* indicates support for immediate flip */ adev_to_drm(adev)->mode_config.async_page_flip =3D true; =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90321C433EF for ; Tue, 19 Jul 2022 12:52:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241972AbiGSMws (ORCPT ); Tue, 19 Jul 2022 08:52:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241662AbiGSMvp (ORCPT ); Tue, 19 Jul 2022 08:51:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B58D59269; Tue, 19 Jul 2022 05:20:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 778276158C; Tue, 19 Jul 2022 12:20:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1793EC341C6; Tue, 19 Jul 2022 12:20:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233228; bh=9TA+RxkrpKyWsfoojvH5u63WM+TcAilnppvGCW8mEu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qZB7+gb7FiDEuxz8AT3+u5+TqiGdx40+TbAMBbeVWFRrvvcDqQywcTCdcG+npbMYP ksyzGBF0rJQNMOw2IXXb0YUzY20J3lyH6ffrhD4oZX+WhYwYQKtiuvDJTpGDyXQec9 Z/93Lh4q1FbO4ztV/k5etJ/87OA+skptO3DXiUfw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.18 050/231] drm/i915: fix a possible refcount leak in intel_dp_add_mst_connector() Date: Tue, 19 Jul 2022 13:52:15 +0200 Message-Id: <20220719114718.471876890@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hangyu Hua [ Upstream commit 85144df9ff4652816448369de76897c57cbb1b93 ] If drm_connector_init fails, intel_connector_free will be called to take care of proper free. So it is necessary to drop the refcount of port before intel_connector_free. Fixes: 091a4f91942a ("drm/i915: Handle drm-layer errors in intel_dp_add_mst= _connector") Signed-off-by: Hangyu Hua Reviewed-by: Jos=C3=A9 Roberto de Souza Link: https://patchwork.freedesktop.org/patch/msgid/20220624130406.17996-1-= jose.souza@intel.com Signed-off-by: Jos=C3=A9 Roberto de Souza (cherry picked from commit cea9ed611e85d36a05db52b6457bf584b7d969e2) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/display/intel_dp_mst.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/= i915/display/intel_dp_mst.c index e30e698aa684..f7d46ea3afb9 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -841,6 +841,7 @@ static struct drm_connector *intel_dp_add_mst_connector= (struct drm_dp_mst_topolo ret =3D drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort); if (ret) { + drm_dp_mst_put_port_malloc(port); intel_connector_free(intel_connector); return NULL; } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F712C43334 for ; Tue, 19 Jul 2022 12:53:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241931AbiGSMxA (ORCPT ); Tue, 19 Jul 2022 08:53:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242012AbiGSMwS (ORCPT ); Tue, 19 Jul 2022 08:52:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68B956390F; Tue, 19 Jul 2022 05:20:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 30D7161772; Tue, 19 Jul 2022 12:20:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7801C341C6; Tue, 19 Jul 2022 12:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233231; bh=ASsZ87Qcp96nGVuUoINaJyFZXCA14MyEoFJuMLRfDAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HbzulWQKUt+fGsyx5e7LXDw8aAwS45oEHBkABZ8+oy5JpQpxJo0w/0YTK1a1zXs2E C8MzquWtpAc8GAzldQydFPBsLRX6hUhxeCYWRKMTTDS3XJToFQrhA2o15A7yUNvmv0 VQbQTMT8Hp1VFNJGoqd2His+Gw9VPccQyHNzB6sE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Harrison , Tejas Upadhyay , Anusha Srivatsa , Jani Nikula , Daniele Ceraolo Spurio , Matt Roper , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.18 051/231] drm/i915/guc: ADL-N should use the same GuC FW as ADL-S Date: Tue, 19 Jul 2022 13:52:16 +0200 Message-Id: <20220719114718.544993954@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniele Ceraolo Spurio [ Upstream commit 25c95bf494067f7bd1dfa8064ef964abe88cafc2 ] The only difference between the ADL S and P GuC FWs is the HWConfig support. ADL-N does not support HWConfig, so we should use the same binary as ADL-S, otherwise the GuC might attempt to fetch a config table that does not exist. ADL-N is internally identified as an ADL-P, so we need to special-case it in the FW selection code. Fixes: 7e28d0b26759 ("drm/i915/adl-n: Enable ADL-N platform") Cc: John Harrison Cc: Tejas Upadhyay Cc: Anusha Srivatsa Cc: Jani Nikula Signed-off-by: Daniele Ceraolo Spurio Reviewed-by: Matt Roper Link: https://patchwork.freedesktop.org/patch/msgid/20220621233005.3952293-= 1-daniele.ceraolospurio@intel.com (cherry picked from commit 971e4a9781742aaad1587e25fd5582b2dd595ef8) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c b/drivers/gpu/drm/i91= 5/gt/uc/intel_uc_fw.c index 9b6fbad47646..097b0c8b8531 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c @@ -160,6 +160,15 @@ __uc_fw_auto_select(struct drm_i915_private *i915, str= uct intel_uc_fw *uc_fw) u8 rev =3D INTEL_REVID(i915); int i; =20 + /* + * The only difference between the ADL GuC FWs is the HWConfig support. + * ADL-N does not support HWConfig, so we should use the same binary as + * ADL-S, otherwise the GuC might attempt to fetch a config table that + * does not exist. + */ + if (IS_ADLP_N(i915)) + p =3D INTEL_ALDERLAKE_S; + GEM_BUG_ON(uc_fw->type >=3D ARRAY_SIZE(blobs_all)); fw_blobs =3D blobs_all[uc_fw->type].blobs; fw_count =3D blobs_all[uc_fw->type].count; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D5A1C43334 for ; Tue, 19 Jul 2022 12:53:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241968AbiGSMxP (ORCPT ); Tue, 19 Jul 2022 08:53:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242059AbiGSMwm (ORCPT ); Tue, 19 Jul 2022 08:52:42 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8AFA72EF5; Tue, 19 Jul 2022 05:20:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 1895ACE1BE6; Tue, 19 Jul 2022 12:20:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEB1AC341C6; Tue, 19 Jul 2022 12:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233234; bh=f0M9aqqpW+97sTV/KqJnQee26qxFp/Abb01l+0qEen8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rQpR0XK4AeBrxcRCPiX7tLAwtDWhvzGasE6kY/Tq0flDbcrTLZ9VlE3t74CbDc5eM 0FYgRTxGDNZI/YFmAAQJUM8tlO+aU7WjhlV34kZQMXwvq36panN8llKqlvmR5fR+q4 yGoqLlhXXTQn6vABU8HSujGiZZCLnRuMt/yiIQMs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huaxin Lu , Mimi Zohar , Sasha Levin Subject: [PATCH 5.18 052/231] ima: Fix a potential integer overflow in ima_appraise_measurement Date: Tue, 19 Jul 2022 13:52:17 +0200 Message-Id: <20220719114718.617284731@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Huaxin Lu [ Upstream commit d2ee2cfc4aa85ff6a2a3b198a3a524ec54e3d999 ] When the ima-modsig is enabled, the rc passed to evm_verifyxattr() may be negative, which may cause the integer overflow problem. Fixes: 39b07096364a ("ima: Implement support for module-style appended sign= atures") Signed-off-by: Huaxin Lu Signed-off-by: Mimi Zohar Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- security/integrity/ima/ima_appraise.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima= /ima_appraise.c index 17232bbfb9f9..ee6a0f8879e4 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -408,7 +408,8 @@ int ima_appraise_measurement(enum ima_hooks func, goto out; } =20 - status =3D evm_verifyxattr(dentry, XATTR_NAME_IMA, xattr_value, rc, iint); + status =3D evm_verifyxattr(dentry, XATTR_NAME_IMA, xattr_value, + rc < 0 ? 0 : rc, iint); switch (status) { case INTEGRITY_PASS: case INTEGRITY_PASS_IMMUTABLE: --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D926DC433EF for ; Tue, 19 Jul 2022 12:53:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242096AbiGSMxR (ORCPT ); Tue, 19 Jul 2022 08:53:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241981AbiGSMwz (ORCPT ); Tue, 19 Jul 2022 08:52:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E20587A500; Tue, 19 Jul 2022 05:20:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 64F7FB81B10; Tue, 19 Jul 2022 12:20:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA103C341C6; Tue, 19 Jul 2022 12:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233237; bh=TGsNsQnMlo5du7OLHMSjWoQLP8xixQyo59lbJqkW84A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FsiAlTtRpUYMVZYWyPdFsISoGN8i03PPIVX8pHb38m1btUwpzGcElXgxCZTzBCYz8 nYX3Ir/u0dDwKRcqg0lJMuYhfhTOtB9olHvkfaom1xbuAkeiLqCK4NCQutVBlOnqJQ 7xQy7+mBtAv6NXjqokQG0N4OdyGNI7ixHyUU3Yj4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Francesco Dolcini , Fabio Estevam , Mark Brown , Sasha Levin Subject: [PATCH 5.18 053/231] ASoC: sgtl5000: Fix noise on shutdown/remove Date: Tue, 19 Jul 2022 13:52:18 +0200 Message-Id: <20220719114718.688923229@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Francesco Dolcini [ Upstream commit 040e3360af3736348112d29425bf5d0be5b93115 ] Put the SGTL5000 in a silent/safe state on shutdown/remove, this is required since the SGTL5000 produces a constant noise on its output after it is configured and its clock is removed. Without this change this is happening every time the module is unbound/removed or from reboot till the clock is enabled again. The issue was experienced on both a Toradex Colibri/Apalis iMX6, but can be easily reproduced everywhere just playing something on the codec and after that removing/unbinding the driver. Fixes: 9b34e6cc3bc2 ("ASoC: Add Freescale SGTL5000 codec support") Signed-off-by: Francesco Dolcini Reviewed-by: Fabio Estevam Link: https://lore.kernel.org/r/20220624101301.441314-1-francesco.dolcini@t= oradex.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/sgtl5000.c | 9 +++++++++ sound/soc/codecs/sgtl5000.h | 1 + 2 files changed, 10 insertions(+) diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 8eebf27d0ea2..281785a9301b 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -1796,6 +1796,9 @@ static int sgtl5000_i2c_remove(struct i2c_client *cli= ent) { struct sgtl5000_priv *sgtl5000 =3D i2c_get_clientdata(client); =20 + regmap_write(sgtl5000->regmap, SGTL5000_CHIP_DIG_POWER, SGTL5000_DIG_POWE= R_DEFAULT); + regmap_write(sgtl5000->regmap, SGTL5000_CHIP_ANA_POWER, SGTL5000_ANA_POWE= R_DEFAULT); + clk_disable_unprepare(sgtl5000->mclk); regulator_bulk_disable(sgtl5000->num_supplies, sgtl5000->supplies); regulator_bulk_free(sgtl5000->num_supplies, sgtl5000->supplies); @@ -1803,6 +1806,11 @@ static int sgtl5000_i2c_remove(struct i2c_client *cl= ient) return 0; } =20 +static void sgtl5000_i2c_shutdown(struct i2c_client *client) +{ + sgtl5000_i2c_remove(client); +} + static const struct i2c_device_id sgtl5000_id[] =3D { {"sgtl5000", 0}, {}, @@ -1823,6 +1831,7 @@ static struct i2c_driver sgtl5000_i2c_driver =3D { }, .probe =3D sgtl5000_i2c_probe, .remove =3D sgtl5000_i2c_remove, + .shutdown =3D sgtl5000_i2c_shutdown, .id_table =3D sgtl5000_id, }; =20 diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h index 56ec5863f250..3a808c762299 100644 --- a/sound/soc/codecs/sgtl5000.h +++ b/sound/soc/codecs/sgtl5000.h @@ -80,6 +80,7 @@ /* * SGTL5000_CHIP_DIG_POWER */ +#define SGTL5000_DIG_POWER_DEFAULT 0x0000 #define SGTL5000_ADC_EN 0x0040 #define SGTL5000_DAC_EN 0x0020 #define SGTL5000_DAP_POWERUP 0x0010 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E189C43334 for ; Tue, 19 Jul 2022 12:53:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242082AbiGSMxY (ORCPT ); Tue, 19 Jul 2022 08:53:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241907AbiGSMw5 (ORCPT ); Tue, 19 Jul 2022 08:52:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 267E48FD79; Tue, 19 Jul 2022 05:20:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 45DB0B81B2C; Tue, 19 Jul 2022 12:20:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B04DC36AF6; Tue, 19 Jul 2022 12:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233240; bh=112p4IasrsPbPAFxru+Qf08e6ZUpipmetpaKg9UAZAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jt2afqfJG5aHKjv0q++LfTFbX1KrnwORZryxOVphNXMsL/a1pZCCfAoa/NtNlFlPU OObIezYTD8sqZ7GGtn5d3oAVuDUZ8r8zX93tyb7GRcC/pKSWDOFtriG6lCGOa+V82V khD9krkOYF3IW56w0g4Pqzvd2lVISHfQPzcWPRI8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.18 054/231] ASoC: tas2764: Add post reset delays Date: Tue, 19 Jul 2022 13:52:19 +0200 Message-Id: <20220719114718.761224517@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Povi=C5=A1er [ Upstream commit cd10bb89b0d57bca98eb75e0444854a1c129a14e ] Make sure there is at least 1 ms delay from reset to first command as is specified in the datasheet. This is a fix similar to commit 307f31452078 ("ASoC: tas2770: Insert post reset delay"). Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povi=C5=A1er Link: https://lore.kernel.org/r/20220630075135.2221-1-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/tas2764.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 9265af41c235..edc66ff6dc49 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -42,10 +42,12 @@ static void tas2764_reset(struct tas2764_priv *tas2764) gpiod_set_value_cansleep(tas2764->reset_gpio, 0); msleep(20); gpiod_set_value_cansleep(tas2764->reset_gpio, 1); + usleep_range(1000, 2000); } =20 snd_soc_component_write(tas2764->component, TAS2764_SW_RST, TAS2764_RST); + usleep_range(1000, 2000); } =20 static int tas2764_set_bias_level(struct snd_soc_component *component, @@ -107,8 +109,10 @@ static int tas2764_codec_resume(struct snd_soc_compone= nt *component) struct tas2764_priv *tas2764 =3D snd_soc_component_get_drvdata(component); int ret; =20 - if (tas2764->sdz_gpio) + if (tas2764->sdz_gpio) { gpiod_set_value_cansleep(tas2764->sdz_gpio, 1); + usleep_range(1000, 2000); + } =20 ret =3D snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, TAS2764_PWR_CTRL_MASK, @@ -501,8 +505,10 @@ static int tas2764_codec_probe(struct snd_soc_componen= t *component) =20 tas2764->component =3D component; =20 - if (tas2764->sdz_gpio) + if (tas2764->sdz_gpio) { gpiod_set_value_cansleep(tas2764->sdz_gpio, 1); + usleep_range(1000, 2000); + } =20 tas2764_reset(tas2764); =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8C9DC433EF for ; Tue, 19 Jul 2022 12:53:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242103AbiGSMxV (ORCPT ); Tue, 19 Jul 2022 08:53:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242002AbiGSMw4 (ORCPT ); Tue, 19 Jul 2022 08:52:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96809904CF; Tue, 19 Jul 2022 05:20:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 93653618D1; Tue, 19 Jul 2022 12:20:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C83DC341CA; Tue, 19 Jul 2022 12:20:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233242; bh=ZG3776QSZuja70voJ1g0ymRaEyAfYER6qQIvzhPcQ40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TSzyhA2/h4nhmqOKArABMeuis4nv/yQaqlX3BbfpeqwP6ERmDiRzUxiVS6hr8FxF0 hdpPARw1qc18wsD/HmFtDOPxCEhGp3WEpNZ8nwrQqxuVQrE4oa4S6cXyuuhM1jS4iD e5zyGN+i7WQcjICdbmoHOLHSythi7Ms6IymskUXI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.18 055/231] ASoC: tas2764: Fix and extend FSYNC polarity handling Date: Tue, 19 Jul 2022 13:52:20 +0200 Message-Id: <20220719114718.833333062@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Povi=C5=A1er [ Upstream commit d1a10f1b48202e2d183cce144c218a211e98d906 ] Fix setting of FSYNC polarity in case of LEFT_J and DSP_A/B formats. Do NOT set the SCFG field as was previously done, because that is not correct and is also in conflict with the "ASI1 Source" control which sets the same SCFG field! Also add support for explicit polarity inversion. Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povi=C5=A1er Link: https://lore.kernel.org/r/20220630075135.2221-2-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/tas2764.c | 30 +++++++++++++++++------------- sound/soc/codecs/tas2764.h | 6 ++---- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index edc66ff6dc49..46c815650b2c 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -135,7 +135,8 @@ static const char * const tas2764_ASI1_src[] =3D { }; =20 static SOC_ENUM_SINGLE_DECL( - tas2764_ASI1_src_enum, TAS2764_TDM_CFG2, 4, tas2764_ASI1_src); + tas2764_ASI1_src_enum, TAS2764_TDM_CFG2, TAS2764_TDM_CFG2_SCFG_SHIFT, + tas2764_ASI1_src); =20 static const struct snd_kcontrol_new tas2764_asi1_mux =3D SOC_DAPM_ENUM("ASI1 Source", tas2764_ASI1_src_enum); @@ -333,20 +334,22 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, u= nsigned int fmt) { struct snd_soc_component *component =3D dai->component; struct tas2764_priv *tas2764 =3D snd_soc_component_get_drvdata(component); - u8 tdm_rx_start_slot =3D 0, asi_cfg_1 =3D 0; - int iface; + u8 tdm_rx_start_slot =3D 0, asi_cfg_0 =3D 0, asi_cfg_1 =3D 0; int ret; =20 switch (fmt & SND_SOC_DAIFMT_INV_MASK) { + case SND_SOC_DAIFMT_NB_IF: + asi_cfg_0 ^=3D TAS2764_TDM_CFG0_FRAME_START; + fallthrough; case SND_SOC_DAIFMT_NB_NF: asi_cfg_1 =3D TAS2764_TDM_CFG1_RX_RISING; break; + case SND_SOC_DAIFMT_IB_IF: + asi_cfg_0 ^=3D TAS2764_TDM_CFG0_FRAME_START; + fallthrough; case SND_SOC_DAIFMT_IB_NF: asi_cfg_1 =3D TAS2764_TDM_CFG1_RX_FALLING; break; - default: - dev_err(tas2764->dev, "ASI format Inverse is not found\n"); - return -EINVAL; } =20 ret =3D snd_soc_component_update_bits(component, TAS2764_TDM_CFG1, @@ -357,13 +360,13 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, u= nsigned int fmt) =20 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: + asi_cfg_0 ^=3D TAS2764_TDM_CFG0_FRAME_START; + fallthrough; case SND_SOC_DAIFMT_DSP_A: - iface =3D TAS2764_TDM_CFG2_SCFG_I2S; tdm_rx_start_slot =3D 1; break; case SND_SOC_DAIFMT_DSP_B: case SND_SOC_DAIFMT_LEFT_J: - iface =3D TAS2764_TDM_CFG2_SCFG_LEFT_J; tdm_rx_start_slot =3D 0; break; default: @@ -372,14 +375,15 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, u= nsigned int fmt) return -EINVAL; } =20 - ret =3D snd_soc_component_update_bits(component, TAS2764_TDM_CFG1, - TAS2764_TDM_CFG1_MASK, - (tdm_rx_start_slot << TAS2764_TDM_CFG1_51_SHIFT)); + ret =3D snd_soc_component_update_bits(component, TAS2764_TDM_CFG0, + TAS2764_TDM_CFG0_FRAME_START, + asi_cfg_0); if (ret < 0) return ret; =20 - ret =3D snd_soc_component_update_bits(component, TAS2764_TDM_CFG2, - TAS2764_TDM_CFG2_SCFG_MASK, iface); + ret =3D snd_soc_component_update_bits(component, TAS2764_TDM_CFG1, + TAS2764_TDM_CFG1_MASK, + (tdm_rx_start_slot << TAS2764_TDM_CFG1_51_SHIFT)); if (ret < 0) return ret; =20 diff --git a/sound/soc/codecs/tas2764.h b/sound/soc/codecs/tas2764.h index 67d6fd903c42..f015f22a083b 100644 --- a/sound/soc/codecs/tas2764.h +++ b/sound/soc/codecs/tas2764.h @@ -47,6 +47,7 @@ #define TAS2764_TDM_CFG0_MASK GENMASK(3, 1) #define TAS2764_TDM_CFG0_44_1_48KHZ BIT(3) #define TAS2764_TDM_CFG0_88_2_96KHZ (BIT(3) | BIT(1)) +#define TAS2764_TDM_CFG0_FRAME_START BIT(0) =20 /* TDM Configuration Reg1 */ #define TAS2764_TDM_CFG1 TAS2764_REG(0X0, 0x09) @@ -66,10 +67,7 @@ #define TAS2764_TDM_CFG2_RXS_16BITS 0x0 #define TAS2764_TDM_CFG2_RXS_24BITS BIT(0) #define TAS2764_TDM_CFG2_RXS_32BITS BIT(1) -#define TAS2764_TDM_CFG2_SCFG_MASK GENMASK(5, 4) -#define TAS2764_TDM_CFG2_SCFG_I2S 0x0 -#define TAS2764_TDM_CFG2_SCFG_LEFT_J BIT(4) -#define TAS2764_TDM_CFG2_SCFG_RIGHT_J BIT(5) +#define TAS2764_TDM_CFG2_SCFG_SHIFT 4 =20 /* TDM Configuration Reg3 */ #define TAS2764_TDM_CFG3 TAS2764_REG(0X0, 0x0c) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38CC3C43334 for ; Tue, 19 Jul 2022 12:53:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242128AbiGSMxc (ORCPT ); Tue, 19 Jul 2022 08:53:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239020AbiGSMxB (ORCPT ); Tue, 19 Jul 2022 08:53:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D71F590D84; Tue, 19 Jul 2022 05:20:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 031D5B81B13; Tue, 19 Jul 2022 12:20:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E52BC341CA; Tue, 19 Jul 2022 12:20:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233245; bh=wrmeyo29Y2fleQVwAXQJxUKLpQE8RgfOI0r4Ukl5Vbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1w9rF7FFlTUV7rMB74We08MVicPolOhm9YA1bUTIcUUn5At/KF2Ztn2JjP7fh8xld AGA9m7wzStEV03S9iHAL8ww4fjc041w4x0FYsvOeKAF5gmqSQW6LtlsBOgNRVp6gWi 72tuxhyWhDTaYps7MgYYpF7Z60aKJ46DOdq3HRas= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hector Martin , =?UTF-8?q?Martin=20Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.18 056/231] ASoC: tas2764: Correct playback volume range Date: Tue, 19 Jul 2022 13:52:21 +0200 Message-Id: <20220719114718.919093926@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hector Martin [ Upstream commit 3e99e5697e1f7120b5abc755e8a560b22612d6ed ] DVC value 0xc8 is -100dB and 0xc9 is mute; this needs to map to -100.5dB as far as the dB scale is concerned. Fix that and enable the mute flag, so alsamixer correctly shows the control as <0 dB .. -100 dB, mute>. Signed-off-by: Hector Martin Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povi=C5=A1er Link: https://lore.kernel.org/r/20220630075135.2221-3-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/tas2764.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 46c815650b2c..bd79bc7ecf6b 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -536,7 +536,7 @@ static int tas2764_codec_probe(struct snd_soc_component= *component) } =20 static DECLARE_TLV_DB_SCALE(tas2764_digital_tlv, 1100, 50, 0); -static DECLARE_TLV_DB_SCALE(tas2764_playback_volume, -10000, 50, 0); +static DECLARE_TLV_DB_SCALE(tas2764_playback_volume, -10050, 50, 1); =20 static const struct snd_kcontrol_new tas2764_snd_controls[] =3D { SOC_SINGLE_TLV("Speaker Volume", TAS2764_DVC, 0, --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B32FC433EF for ; Tue, 19 Jul 2022 12:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242123AbiGSMxs (ORCPT ); Tue, 19 Jul 2022 08:53:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242108AbiGSMxW (ORCPT ); Tue, 19 Jul 2022 08:53:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAF1790DB0; Tue, 19 Jul 2022 05:20:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 26B08618E1; Tue, 19 Jul 2022 12:20:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0874FC341C6; Tue, 19 Jul 2022 12:20:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233251; bh=krPBsNYKPzoOFgBFy5vJEFUAPdi761bW4QBFCNBjFy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ekbpt2pIBR/B690uz/+uBmUQClgExp2b2TTiGtznAC1XkSHJTvZM74vwQMqhkfohQ MNHs6/U4bmhTgNGee4rPsp3qvR/JTqTQnw8UczFyl1LZbhS7RH2rgClgph+M8t/A7c yJCfNH1f3i+LWT6NOsHNjMbbAFS+YtJHcdb/ypoU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hector Martin , =?UTF-8?q?Martin=20Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.18 057/231] ASoC: tas2764: Fix amp gain register offset & default Date: Tue, 19 Jul 2022 13:52:22 +0200 Message-Id: <20220719114718.988385994@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hector Martin [ Upstream commit 1c4f29ec878bbf1cc0a1eb54ae7da5ff98e19641 ] The register default is 0x28 per the datasheet, and the amp gain field is supposed to be shifted left by one. With the wrong default, the ALSA controls lie about the power-up state. With the wrong shift, we get only half the gain we expect. Signed-off-by: Hector Martin Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povi=C5=A1er Link: https://lore.kernel.org/r/20220630075135.2221-4-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/tas2764.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index bd79bc7ecf6b..ec13ba01e522 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -541,7 +541,7 @@ static DECLARE_TLV_DB_SCALE(tas2764_playback_volume, -1= 0050, 50, 1); static const struct snd_kcontrol_new tas2764_snd_controls[] =3D { SOC_SINGLE_TLV("Speaker Volume", TAS2764_DVC, 0, TAS2764_DVC_MAX, 1, tas2764_playback_volume), - SOC_SINGLE_TLV("Amp Gain Volume", TAS2764_CHNL_0, 0, 0x14, 0, + SOC_SINGLE_TLV("Amp Gain Volume", TAS2764_CHNL_0, 1, 0x14, 0, tas2764_digital_tlv), }; =20 @@ -566,7 +566,7 @@ static const struct reg_default tas2764_reg_defaults[] = =3D { { TAS2764_SW_RST, 0x00 }, { TAS2764_PWR_CTRL, 0x1a }, { TAS2764_DVC, 0x00 }, - { TAS2764_CHNL_0, 0x00 }, + { TAS2764_CHNL_0, 0x28 }, { TAS2764_TDM_CFG0, 0x09 }, { TAS2764_TDM_CFG1, 0x02 }, { TAS2764_TDM_CFG2, 0x0a }, --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E86FC43334 for ; Tue, 19 Jul 2022 12:57:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242370AbiGSM5S (ORCPT ); Tue, 19 Jul 2022 08:57:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242361AbiGSM4i (ORCPT ); Tue, 19 Jul 2022 08:56:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F0A95C945; Tue, 19 Jul 2022 05:22:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 73D1DB81B10; Tue, 19 Jul 2022 12:22:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C20BFC341C6; Tue, 19 Jul 2022 12:22:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233356; bh=hA1qIK0DBCrwchGNAPuuqfIrR5e5Gk370lNmeck5ih8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fxXmWR8BgRZU1X7cp8QU1RqmtMd9jCd8HQa1VrPUcu8sZadGgLe26w1QKWVx30GQ0 RzNIVj4Mn/sX+WLkbNWuMS7JBmk0HhEM6MmDRu0McDhlep2tYRYX26mMK0UL2TVVhE mvcIItcop0L7t39M5AGpPy1zUgHDPSRLzkYb3aFo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Cezary Rojewski , Mark Brown , Sasha Levin Subject: [PATCH 5.18 058/231] ASoC: Intel: Skylake: Correct the ssp rate discovery in skl_get_ssp_clks() Date: Tue, 19 Jul 2022 13:52:23 +0200 Message-Id: <20220719114719.058311756@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Ujfalusi [ Upstream commit 219af251bd1694bce1f627d238347d2eaf13de61 ] The present flag is only set once when one rate has been found to be saved. This will effectively going to ignore any rate discovered at later time and based on the code, this is not the intention. Fixes: bc2bd45b1f7f3 ("ASoC: Intel: Skylake: Parse nhlt and register clock = device") Signed-off-by: Peter Ujfalusi Reviewed-by: Cezary Rojewski Link: https://lore.kernel.org/r/20220630065638.11183-2-peter.ujfalusi@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/intel/skylake/skl-nhlt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/s= kl-nhlt.c index 2439a574ac2f..366f7bd9bc02 100644 --- a/sound/soc/intel/skylake/skl-nhlt.c +++ b/sound/soc/intel/skylake/skl-nhlt.c @@ -99,7 +99,6 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct = skl_ssp_clk *ssp_clks, struct nhlt_fmt_cfg *fmt_cfg; struct wav_fmt_ext *wav_fmt; unsigned long rate; - bool present =3D false; int rate_index =3D 0; u16 channels, bps; u8 clk_src; @@ -113,6 +112,8 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struc= t skl_ssp_clk *ssp_clks, return; =20 for (i =3D 0; i < fmt->fmt_count; i++) { + bool present =3D false; + fmt_cfg =3D &fmt->fmt_config[i]; wav_fmt =3D &fmt_cfg->fmt_ext; =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65434C43334 for ; Tue, 19 Jul 2022 12:55:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242088AbiGSMzN (ORCPT ); Tue, 19 Jul 2022 08:55:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242037AbiGSMx7 (ORCPT ); Tue, 19 Jul 2022 08:53:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E0D3936B1; Tue, 19 Jul 2022 05:21:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 964246177D; Tue, 19 Jul 2022 12:21:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6111BC36AEF; Tue, 19 Jul 2022 12:21:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233274; bh=ASndOkuuuaWHwQJWwIUvQAr0o/kQ4UHxMrFqEXaLhew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kEHlkmLlhpXzuSIDmjrrLQvNSjnFy0h+2Lw1m1rAQsWTIh9i3htZVdbj+TJlRO6Zz IwtOgqmd/v/GgOHT2akGyOwA5oYz+9QcwYUHA45OCXsd7GFBbYiU/CqStnMs9tbEph A6Z5LF0kPeUXGLTQnFQh9Mug2aVkDA+It23YUbEc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Cezary Rojewski , Mark Brown , Sasha Levin Subject: [PATCH 5.18 059/231] ASoC: Intel: Skylake: Correct the handling of fmt_config flexible array Date: Tue, 19 Jul 2022 13:52:24 +0200 Message-Id: <20220719114719.128741063@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Ujfalusi [ Upstream commit fc976f5629afb4160ee77798b14a693eac903ffd ] The struct nhlt_format's fmt_config is a flexible array, it must not be used as normal array. When moving to the next nhlt_fmt_cfg we need to take into account the data behind the ->config.caps (indicated by ->config.size). The logic of the code also changed: it is no longer saves the _last_ fmt_cfg for all found rates. Fixes: bc2bd45b1f7f3 ("ASoC: Intel: Skylake: Parse nhlt and register clock = device") Signed-off-by: Peter Ujfalusi Reviewed-by: Cezary Rojewski Link: https://lore.kernel.org/r/20220630065638.11183-3-peter.ujfalusi@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/intel/skylake/skl-nhlt.c | 37 ++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/s= kl-nhlt.c index 366f7bd9bc02..deb7b820325e 100644 --- a/sound/soc/intel/skylake/skl-nhlt.c +++ b/sound/soc/intel/skylake/skl-nhlt.c @@ -111,11 +111,12 @@ static void skl_get_ssp_clks(struct skl_dev *skl, str= uct skl_ssp_clk *ssp_clks, if (fmt->fmt_count =3D=3D 0) return; =20 + fmt_cfg =3D (struct nhlt_fmt_cfg *)fmt->fmt_config; for (i =3D 0; i < fmt->fmt_count; i++) { + struct nhlt_fmt_cfg *saved_fmt_cfg =3D fmt_cfg; bool present =3D false; =20 - fmt_cfg =3D &fmt->fmt_config[i]; - wav_fmt =3D &fmt_cfg->fmt_ext; + wav_fmt =3D &saved_fmt_cfg->fmt_ext; =20 channels =3D wav_fmt->fmt.channels; bps =3D wav_fmt->fmt.bits_per_sample; @@ -133,12 +134,18 @@ static void skl_get_ssp_clks(struct skl_dev *skl, str= uct skl_ssp_clk *ssp_clks, * derive the rate. */ for (j =3D i; j < fmt->fmt_count; j++) { - fmt_cfg =3D &fmt->fmt_config[j]; - wav_fmt =3D &fmt_cfg->fmt_ext; + struct nhlt_fmt_cfg *tmp_fmt_cfg =3D fmt_cfg; + + wav_fmt =3D &tmp_fmt_cfg->fmt_ext; if ((fs =3D=3D wav_fmt->fmt.samples_per_sec) && - (bps =3D=3D wav_fmt->fmt.bits_per_sample)) + (bps =3D=3D wav_fmt->fmt.bits_per_sample)) { channels =3D max_t(u16, channels, wav_fmt->fmt.channels); + saved_fmt_cfg =3D tmp_fmt_cfg; + } + /* Move to the next nhlt_fmt_cfg */ + tmp_fmt_cfg =3D (struct nhlt_fmt_cfg *)(tmp_fmt_cfg->config.caps + + tmp_fmt_cfg->config.size); } =20 rate =3D channels * bps * fs; @@ -154,8 +161,11 @@ static void skl_get_ssp_clks(struct skl_dev *skl, stru= ct skl_ssp_clk *ssp_clks, =20 /* Fill rate and parent for sclk/sclkfs */ if (!present) { + struct nhlt_fmt_cfg *first_fmt_cfg; + + first_fmt_cfg =3D (struct nhlt_fmt_cfg *)fmt->fmt_config; i2s_config_ext =3D (struct skl_i2s_config_blob_ext *) - fmt->fmt_config[0].config.caps; + first_fmt_cfg->config.caps; =20 /* MCLK Divider Source Select */ if (is_legacy_blob(i2s_config_ext->hdr.sig)) { @@ -169,6 +179,9 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struc= t skl_ssp_clk *ssp_clks, =20 parent =3D skl_get_parent_clk(clk_src); =20 + /* Move to the next nhlt_fmt_cfg */ + fmt_cfg =3D (struct nhlt_fmt_cfg *)(fmt_cfg->config.caps + + fmt_cfg->config.size); /* * Do not copy the config data if there is no parent * clock available for this clock source select @@ -177,9 +190,9 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struc= t skl_ssp_clk *ssp_clks, continue; =20 sclk[id].rate_cfg[rate_index].rate =3D rate; - sclk[id].rate_cfg[rate_index].config =3D fmt_cfg; + sclk[id].rate_cfg[rate_index].config =3D saved_fmt_cfg; sclkfs[id].rate_cfg[rate_index].rate =3D rate; - sclkfs[id].rate_cfg[rate_index].config =3D fmt_cfg; + sclkfs[id].rate_cfg[rate_index].config =3D saved_fmt_cfg; sclk[id].parent_name =3D parent->name; sclkfs[id].parent_name =3D parent->name; =20 @@ -193,13 +206,13 @@ static void skl_get_mclk(struct skl_dev *skl, struct = skl_ssp_clk *mclk, { struct skl_i2s_config_blob_ext *i2s_config_ext; struct skl_i2s_config_blob_legacy *i2s_config; - struct nhlt_specific_cfg *fmt_cfg; + struct nhlt_fmt_cfg *fmt_cfg; struct skl_clk_parent_src *parent; u32 clkdiv, div_ratio; u8 clk_src; =20 - fmt_cfg =3D &fmt->fmt_config[0].config; - i2s_config_ext =3D (struct skl_i2s_config_blob_ext *)fmt_cfg->caps; + fmt_cfg =3D (struct nhlt_fmt_cfg *)fmt->fmt_config; + i2s_config_ext =3D (struct skl_i2s_config_blob_ext *)fmt_cfg->config.caps; =20 /* MCLK Divider Source Select and divider */ if (is_legacy_blob(i2s_config_ext->hdr.sig)) { @@ -228,7 +241,7 @@ static void skl_get_mclk(struct skl_dev *skl, struct sk= l_ssp_clk *mclk, return; =20 mclk[id].rate_cfg[0].rate =3D parent->rate/div_ratio; - mclk[id].rate_cfg[0].config =3D &fmt->fmt_config[0]; + mclk[id].rate_cfg[0].config =3D fmt_cfg; mclk[id].parent_name =3D parent->name; } =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68926C43334 for ; Tue, 19 Jul 2022 12:55:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242130AbiGSMzt (ORCPT ); Tue, 19 Jul 2022 08:55:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242545AbiGSMyp (ORCPT ); Tue, 19 Jul 2022 08:54:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A169097D74; Tue, 19 Jul 2022 05:21:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 03D35B81B2C; Tue, 19 Jul 2022 12:21:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DF50C341C6; Tue, 19 Jul 2022 12:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233306; bh=AGVlhapnJHOEqrr6lBO8D1LBDrm6Jidzcfdm+f6X8pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N+mv5P8FZCD3HKBf1eY2ZRiYRCHTR6KY/Kfc5DIoA2OcNcNqsSTKuMcvAiaxisVEf d8N+qBmI6ZHbbVuh2GUwwz/eP3DCCI6IRH3lUthPQ5RMyNCF4DqTHDTMot4TNVjd2B n9BRdNhafCqXZWr1FCX6ne4AICsMa0JDRCkaCLkE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.18 060/231] netfilter: ecache: move to separate structure Date: Tue, 19 Jul 2022 13:52:25 +0200 Message-Id: <20220719114719.210273645@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit 9027ce0b071a1bbd046682907fc2e23ca3592883 ] This makes it easier for a followup patch to only expose ecache related parts of nf_conntrack_net structure. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/net/netfilter/nf_conntrack.h | 8 ++++++-- net/netfilter/nf_conntrack_ecache.c | 19 ++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/n= f_conntrack.h index b08b70989d2c..69e6c6a218be 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -43,6 +43,11 @@ union nf_conntrack_expect_proto { /* insert expect proto private data here */ }; =20 +struct nf_conntrack_net_ecache { + struct delayed_work dwork; + struct netns_ct *ct_net; +}; + struct nf_conntrack_net { /* only used when new connection is allocated: */ atomic_t count; @@ -58,8 +63,7 @@ struct nf_conntrack_net { struct ctl_table_header *sysctl_header; #endif #ifdef CONFIG_NF_CONNTRACK_EVENTS - struct delayed_work ecache_dwork; - struct netns_ct *ct_net; + struct nf_conntrack_net_ecache ecache; #endif }; =20 diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntra= ck_ecache.c index 07e65b4e92f8..0cb2da0a759a 100644 --- a/net/netfilter/nf_conntrack_ecache.c +++ b/net/netfilter/nf_conntrack_ecache.c @@ -96,8 +96,8 @@ static enum retry_state ecache_work_evict_list(struct ct_= pcpu *pcpu) =20 static void ecache_work(struct work_struct *work) { - struct nf_conntrack_net *cnet =3D container_of(work, struct nf_conntrack_= net, ecache_dwork.work); - struct netns_ct *ctnet =3D cnet->ct_net; + struct nf_conntrack_net *cnet =3D container_of(work, struct nf_conntrack_= net, ecache.dwork.work); + struct netns_ct *ctnet =3D cnet->ecache.ct_net; int cpu, delay =3D -1; struct ct_pcpu *pcpu; =20 @@ -127,7 +127,7 @@ static void ecache_work(struct work_struct *work) =20 ctnet->ecache_dwork_pending =3D delay > 0; if (delay >=3D 0) - schedule_delayed_work(&cnet->ecache_dwork, delay); + schedule_delayed_work(&cnet->ecache.dwork, delay); } =20 static int __nf_conntrack_eventmask_report(struct nf_conntrack_ecache *e, @@ -293,12 +293,12 @@ void nf_conntrack_ecache_work(struct net *net, enum n= f_ct_ecache_state state) struct nf_conntrack_net *cnet =3D nf_ct_pernet(net); =20 if (state =3D=3D NFCT_ECACHE_DESTROY_FAIL && - !delayed_work_pending(&cnet->ecache_dwork)) { - schedule_delayed_work(&cnet->ecache_dwork, HZ); + !delayed_work_pending(&cnet->ecache.dwork)) { + schedule_delayed_work(&cnet->ecache.dwork, HZ); net->ct.ecache_dwork_pending =3D true; } else if (state =3D=3D NFCT_ECACHE_DESTROY_SENT) { net->ct.ecache_dwork_pending =3D false; - mod_delayed_work(system_wq, &cnet->ecache_dwork, 0); + mod_delayed_work(system_wq, &cnet->ecache.dwork, 0); } } =20 @@ -310,8 +310,9 @@ void nf_conntrack_ecache_pernet_init(struct net *net) struct nf_conntrack_net *cnet =3D nf_ct_pernet(net); =20 net->ct.sysctl_events =3D nf_ct_events; - cnet->ct_net =3D &net->ct; - INIT_DELAYED_WORK(&cnet->ecache_dwork, ecache_work); + + cnet->ecache.ct_net =3D &net->ct; + INIT_DELAYED_WORK(&cnet->ecache.dwork, ecache_work); =20 BUILD_BUG_ON(__IPCT_MAX >=3D 16); /* e->ctmask is u16 */ } @@ -320,5 +321,5 @@ void nf_conntrack_ecache_pernet_fini(struct net *net) { struct nf_conntrack_net *cnet =3D nf_ct_pernet(net); =20 - cancel_delayed_work_sync(&cnet->ecache_dwork); + cancel_delayed_work_sync(&cnet->ecache.dwork); } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23E0AC433EF for ; Tue, 19 Jul 2022 12:56:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242372AbiGSM4p (ORCPT ); Tue, 19 Jul 2022 08:56:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242330AbiGSM4A (ORCPT ); Tue, 19 Jul 2022 08:56:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F27F75A457; Tue, 19 Jul 2022 05:22:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5DEF7B81B1A; Tue, 19 Jul 2022 12:22:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9408CC341C6; Tue, 19 Jul 2022 12:22:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233336; bh=tzshCxwzXuBU3xSWhussqWtJL4nPf/azbQZqFal6iSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bkDMjG1xLB9h7WYZ4g3d1MEgwlFVBN50ZVTNt2trebD/e5ed9cZzC/4RywoerY4wV mkgf2XPpGDBzWMCHjG9g9bhpezx6hqgNOhEUu6IjQmGu5SraogqHIhVPwx7jf6zKo1 Rjm0OcJVd4adgOoqZVlYNcybv/LZL+4pDkzqrSxE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.18 061/231] netfilter: conntrack: split inner loop of list dumping to own function Date: Tue, 19 Jul 2022 13:52:26 +0200 Message-Id: <20220719114719.297878934@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit 49001a2e83a80f6d9c4287c46ffa41a03667bbd1 ] This allows code re-use in the followup patch. No functional changes intended. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/netfilter/nf_conntrack_netlink.c | 68 ++++++++++++++++++---------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntr= ack_netlink.c index 1ea2ad732d57..924d766e6c53 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c @@ -1708,6 +1708,47 @@ static int ctnetlink_done_list(struct netlink_callba= ck *cb) return 0; } =20 +static int ctnetlink_dump_one_entry(struct sk_buff *skb, + struct netlink_callback *cb, + struct nf_conn *ct, + bool dying) +{ + struct ctnetlink_list_dump_ctx *ctx =3D (void *)cb->ctx; + struct nfgenmsg *nfmsg =3D nlmsg_data(cb->nlh); + u8 l3proto =3D nfmsg->nfgen_family; + int res; + + if (l3proto && nf_ct_l3num(ct) !=3D l3proto) + return 0; + + if (ctx->last) { + if (ct !=3D ctx->last) + return 0; + + ctx->last =3D NULL; + } + + /* We can't dump extension info for the unconfirmed + * list because unconfirmed conntracks can have + * ct->ext reallocated (and thus freed). + * + * In the dying list case ct->ext can't be free'd + * until after we drop pcpu->lock. + */ + res =3D ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).portid, + cb->nlh->nlmsg_seq, + NFNL_MSG_TYPE(cb->nlh->nlmsg_type), + ct, dying, 0); + if (res < 0) { + if (!refcount_inc_not_zero(&ct->ct_general.use)) + return 0; + + ctx->last =3D ct; + } + + return res; +} + static int ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool= dying) { @@ -1715,12 +1756,9 @@ ctnetlink_dump_list(struct sk_buff *skb, struct netl= ink_callback *cb, bool dying struct nf_conn *ct, *last; struct nf_conntrack_tuple_hash *h; struct hlist_nulls_node *n; - struct nfgenmsg *nfmsg =3D nlmsg_data(cb->nlh); - u_int8_t l3proto =3D nfmsg->nfgen_family; - int res; - int cpu; struct hlist_nulls_head *list; struct net *net =3D sock_net(skb->sk); + int res, cpu; =20 if (ctx->done) return 0; @@ -1739,30 +1777,10 @@ ctnetlink_dump_list(struct sk_buff *skb, struct net= link_callback *cb, bool dying restart: hlist_nulls_for_each_entry(h, n, list, hnnode) { ct =3D nf_ct_tuplehash_to_ctrack(h); - if (l3proto && nf_ct_l3num(ct) !=3D l3proto) - continue; - if (ctx->last) { - if (ct !=3D last) - continue; - ctx->last =3D NULL; - } =20 - /* We can't dump extension info for the unconfirmed - * list because unconfirmed conntracks can have - * ct->ext reallocated (and thus freed). - * - * In the dying list case ct->ext can't be free'd - * until after we drop pcpu->lock. - */ - res =3D ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).portid, - cb->nlh->nlmsg_seq, - NFNL_MSG_TYPE(cb->nlh->nlmsg_type), - ct, dying, 0); + res =3D ctnetlink_dump_one_entry(skb, cb, ct, dying); if (res < 0) { - if (!refcount_inc_not_zero(&ct->ct_general.use)) - continue; ctx->cpu =3D cpu; - ctx->last =3D ct; spin_unlock_bh(&pcpu->lock); goto out; } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62E38C43334 for ; Tue, 19 Jul 2022 12:56:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242379AbiGSM4v (ORCPT ); Tue, 19 Jul 2022 08:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242225AbiGSM4R (ORCPT ); Tue, 19 Jul 2022 08:56:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2C339A5E6; Tue, 19 Jul 2022 05:22:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5E54CB81B21; Tue, 19 Jul 2022 12:22:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83AF9C341C6; Tue, 19 Jul 2022 12:22:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233339; bh=1LjhgkDeS4tZxzepd9SNmX+3UlHPlrsFyglNx5odCfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c8Atj5K24pnZxidrCIOUKRqJj01v6tO1roMIeJL5NjOvAwhH9laSy2+RpkV/ZjwX0 ANMxcFlxSyMQuenqAMHwHyYhMNUG3MnBAmHfnv0dD0Y14KlEqgW32pkyTLIk+uLX+5 FSsSrsIx2o5eX6wZyyUj6kqUZDScMWnoFAj3sHr4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.18 062/231] netfilter: ecache: use dedicated list for event redelivery Date: Tue, 19 Jul 2022 13:52:27 +0200 Message-Id: <20220719114719.393791108@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit 2ed3bf188b33630cf9d93b996ebf001847a00b5a ] This disentangles event redelivery and the percpu dying list. Because entries are now stored on a dedicated list, all entries are in NFCT_ECACHE_DESTROY_FAIL state and all entries still have confirmed bit set -- the reference count is at least 1. The 'struct net' back-pointer can be removed as well. The pcpu dying list will be removed eventually, it has no functionality. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/net/netfilter/nf_conntrack.h | 3 +- include/net/netfilter/nf_conntrack_ecache.h | 2 - net/netfilter/nf_conntrack_core.c | 33 +++++- net/netfilter/nf_conntrack_ecache.c | 117 +++++++++----------- 4 files changed, 82 insertions(+), 73 deletions(-) diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/n= f_conntrack.h index 69e6c6a218be..28672a944499 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -45,7 +45,8 @@ union nf_conntrack_expect_proto { =20 struct nf_conntrack_net_ecache { struct delayed_work dwork; - struct netns_ct *ct_net; + spinlock_t dying_lock; + struct hlist_nulls_head dying_list; }; =20 struct nf_conntrack_net { diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netf= ilter/nf_conntrack_ecache.h index 6c4c490a3e34..a6135b5030dd 100644 --- a/include/net/netfilter/nf_conntrack_ecache.h +++ b/include/net/netfilter/nf_conntrack_ecache.h @@ -14,7 +14,6 @@ #include =20 enum nf_ct_ecache_state { - NFCT_ECACHE_UNKNOWN, /* destroy event not sent */ NFCT_ECACHE_DESTROY_FAIL, /* tried but failed to send destroy event */ NFCT_ECACHE_DESTROY_SENT, /* sent destroy event after failure */ }; @@ -23,7 +22,6 @@ struct nf_conntrack_ecache { unsigned long cache; /* bitops want long */ u16 ctmask; /* bitmask of ct events to be delivered */ u16 expmask; /* bitmask of expect events to be delivered */ - enum nf_ct_ecache_state state:8;/* ecache state */ u32 missed; /* missed events */ u32 portid; /* netlink portid of destroyer */ }; diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack= _core.c index 0164e5f522e8..ca1d1d105163 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -660,15 +660,12 @@ void nf_ct_destroy(struct nf_conntrack *nfct) } EXPORT_SYMBOL(nf_ct_destroy); =20 -static void nf_ct_delete_from_lists(struct nf_conn *ct) +static void __nf_ct_delete_from_lists(struct nf_conn *ct) { struct net *net =3D nf_ct_net(ct); unsigned int hash, reply_hash; unsigned int sequence; =20 - nf_ct_helper_destroy(ct); - - local_bh_disable(); do { sequence =3D read_seqcount_begin(&nf_conntrack_generation); hash =3D hash_conntrack(net, @@ -681,12 +678,33 @@ static void nf_ct_delete_from_lists(struct nf_conn *c= t) =20 clean_from_lists(ct); nf_conntrack_double_unlock(hash, reply_hash); +} =20 +static void nf_ct_delete_from_lists(struct nf_conn *ct) +{ + nf_ct_helper_destroy(ct); + local_bh_disable(); + + __nf_ct_delete_from_lists(ct); nf_ct_add_to_dying_list(ct); =20 local_bh_enable(); } =20 +static void nf_ct_add_to_ecache_list(struct nf_conn *ct) +{ +#ifdef CONFIG_NF_CONNTRACK_EVENTS + struct nf_conntrack_net *cnet =3D nf_ct_pernet(nf_ct_net(ct)); + + spin_lock(&cnet->ecache.dying_lock); + hlist_nulls_add_head_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode, + &cnet->ecache.dying_list); + spin_unlock(&cnet->ecache.dying_lock); +#else + nf_ct_add_to_dying_list(ct); +#endif +} + bool nf_ct_delete(struct nf_conn *ct, u32 portid, int report) { struct nf_conn_tstamp *tstamp; @@ -709,7 +727,12 @@ bool nf_ct_delete(struct nf_conn *ct, u32 portid, int = report) /* destroy event was not delivered. nf_ct_put will * be done by event cache worker on redelivery. */ - nf_ct_delete_from_lists(ct); + nf_ct_helper_destroy(ct); + local_bh_disable(); + __nf_ct_delete_from_lists(ct); + nf_ct_add_to_ecache_list(ct); + local_bh_enable(); + nf_conntrack_ecache_work(nf_ct_net(ct), NFCT_ECACHE_DESTROY_FAIL); return false; } diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntra= ck_ecache.c index 0cb2da0a759a..2752859479b2 100644 --- a/net/netfilter/nf_conntrack_ecache.c +++ b/net/netfilter/nf_conntrack_ecache.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -29,8 +28,9 @@ =20 static DEFINE_MUTEX(nf_ct_ecache_mutex); =20 -#define ECACHE_RETRY_WAIT (HZ/10) -#define ECACHE_STACK_ALLOC (256 / sizeof(void *)) +#define DYING_NULLS_VAL ((1 << 30) + 1) +#define ECACHE_MAX_JIFFIES msecs_to_jiffies(10) +#define ECACHE_RETRY_JIFFIES msecs_to_jiffies(10) =20 enum retry_state { STATE_CONGESTED, @@ -38,58 +38,58 @@ enum retry_state { STATE_DONE, }; =20 -static enum retry_state ecache_work_evict_list(struct ct_pcpu *pcpu) +static enum retry_state ecache_work_evict_list(struct nf_conntrack_net *cn= et) { - struct nf_conn *refs[ECACHE_STACK_ALLOC]; + unsigned long stop =3D jiffies + ECACHE_MAX_JIFFIES; + struct hlist_nulls_head evicted_list; enum retry_state ret =3D STATE_DONE; struct nf_conntrack_tuple_hash *h; struct hlist_nulls_node *n; - unsigned int evicted =3D 0; + unsigned int sent; =20 - spin_lock(&pcpu->lock); + INIT_HLIST_NULLS_HEAD(&evicted_list, DYING_NULLS_VAL); =20 - hlist_nulls_for_each_entry(h, n, &pcpu->dying, hnnode) { +next: + sent =3D 0; + spin_lock_bh(&cnet->ecache.dying_lock); + + hlist_nulls_for_each_entry_safe(h, n, &cnet->ecache.dying_list, hnnode) { struct nf_conn *ct =3D nf_ct_tuplehash_to_ctrack(h); - struct nf_conntrack_ecache *e; - - if (!nf_ct_is_confirmed(ct)) - continue; - - /* This ecache access is safe because the ct is on the - * pcpu dying list and we hold the spinlock -- the entry - * cannot be free'd until after the lock is released. - * - * This is true even if ct has a refcount of 0: the - * cpu that is about to free the entry must remove it - * from the dying list and needs the lock to do so. - */ - e =3D nf_ct_ecache_find(ct); - if (!e || e->state !=3D NFCT_ECACHE_DESTROY_FAIL) - continue; =20 - /* ct is in NFCT_ECACHE_DESTROY_FAIL state, this means - * the worker owns this entry: the ct will remain valid - * until the worker puts its ct reference. + /* The worker owns all entries, ct remains valid until nf_ct_put + * in the loop below. */ if (nf_conntrack_event(IPCT_DESTROY, ct)) { ret =3D STATE_CONGESTED; break; } =20 - e->state =3D NFCT_ECACHE_DESTROY_SENT; - refs[evicted] =3D ct; + hlist_nulls_del_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode); + hlist_nulls_add_head(&ct->tuplehash[IP_CT_DIR_REPLY].hnnode, &evicted_li= st); =20 - if (++evicted >=3D ARRAY_SIZE(refs)) { + if (time_after(stop, jiffies)) { ret =3D STATE_RESTART; break; } + + if (sent++ > 16) { + spin_unlock_bh(&cnet->ecache.dying_lock); + cond_resched(); + goto next; + } } =20 - spin_unlock(&pcpu->lock); + spin_unlock_bh(&cnet->ecache.dying_lock); =20 - /* can't _put while holding lock */ - while (evicted) - nf_ct_put(refs[--evicted]); + hlist_nulls_for_each_entry_safe(h, n, &evicted_list, hnnode) { + struct nf_conn *ct =3D nf_ct_tuplehash_to_ctrack(h); + + hlist_nulls_add_fake(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode); + hlist_nulls_del_rcu(&ct->tuplehash[IP_CT_DIR_REPLY].hnnode); + nf_ct_put(ct); + + cond_resched(); + } =20 return ret; } @@ -97,35 +97,20 @@ static enum retry_state ecache_work_evict_list(struct c= t_pcpu *pcpu) static void ecache_work(struct work_struct *work) { struct nf_conntrack_net *cnet =3D container_of(work, struct nf_conntrack_= net, ecache.dwork.work); - struct netns_ct *ctnet =3D cnet->ecache.ct_net; - int cpu, delay =3D -1; - struct ct_pcpu *pcpu; - - local_bh_disable(); - - for_each_possible_cpu(cpu) { - enum retry_state ret; - - pcpu =3D per_cpu_ptr(ctnet->pcpu_lists, cpu); - - ret =3D ecache_work_evict_list(pcpu); - - switch (ret) { - case STATE_CONGESTED: - delay =3D ECACHE_RETRY_WAIT; - goto out; - case STATE_RESTART: - delay =3D 0; - break; - case STATE_DONE: - break; - } + int ret, delay =3D -1; + + ret =3D ecache_work_evict_list(cnet); + switch (ret) { + case STATE_CONGESTED: + delay =3D ECACHE_RETRY_JIFFIES; + break; + case STATE_RESTART: + delay =3D 0; + break; + case STATE_DONE: + break; } =20 - out: - local_bh_enable(); - - ctnet->ecache_dwork_pending =3D delay > 0; if (delay >=3D 0) schedule_delayed_work(&cnet->ecache.dwork, delay); } @@ -199,7 +184,6 @@ int nf_conntrack_eventmask_report(unsigned int events, = struct nf_conn *ct, */ if (e->portid =3D=3D 0 && portid !=3D 0) e->portid =3D portid; - e->state =3D NFCT_ECACHE_DESTROY_FAIL; } =20 return ret; @@ -297,8 +281,10 @@ void nf_conntrack_ecache_work(struct net *net, enum nf= _ct_ecache_state state) schedule_delayed_work(&cnet->ecache.dwork, HZ); net->ct.ecache_dwork_pending =3D true; } else if (state =3D=3D NFCT_ECACHE_DESTROY_SENT) { - net->ct.ecache_dwork_pending =3D false; - mod_delayed_work(system_wq, &cnet->ecache.dwork, 0); + if (!hlist_nulls_empty(&cnet->ecache.dying_list)) + mod_delayed_work(system_wq, &cnet->ecache.dwork, 0); + else + net->ct.ecache_dwork_pending =3D false; } } =20 @@ -311,8 +297,9 @@ void nf_conntrack_ecache_pernet_init(struct net *net) =20 net->ct.sysctl_events =3D nf_ct_events; =20 - cnet->ecache.ct_net =3D &net->ct; INIT_DELAYED_WORK(&cnet->ecache.dwork, ecache_work); + INIT_HLIST_NULLS_HEAD(&cnet->ecache.dying_list, DYING_NULLS_VAL); + spin_lock_init(&cnet->ecache.dying_lock); =20 BUILD_BUG_ON(__IPCT_MAX >=3D 16); /* e->ctmask is u16 */ } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51C92C43334 for ; Tue, 19 Jul 2022 12:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238084AbiGSM44 (ORCPT ); Tue, 19 Jul 2022 08:56:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242229AbiGSM4R (ORCPT ); Tue, 19 Jul 2022 08:56:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 820175B787; Tue, 19 Jul 2022 05:22:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B507C6177D; Tue, 19 Jul 2022 12:22:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 972B1C341C6; Tue, 19 Jul 2022 12:22:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233342; bh=Nf4t3W8Y5OtNITd3bs5jprA180YUIhX2K1C40cMbr3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xTB8Kay1aRumf4+nFjgQL5iu1Im54GbVl89vmgmWX5hFDHBEvuXYZ0p+bqjNjoMvJ uhc/sxMMUDBDSv20oaAC8iAFkDycdgT0c73Wxq/8spEPqq7kj9xbjEcqzS1Km7O2qv howOQ3C3i1ji+q8yhCIavB4LcR7SB8qyfICLJvV4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.18 063/231] netfilter: conntrack: include ecache dying list in dumps Date: Tue, 19 Jul 2022 13:52:28 +0200 Message-Id: <20220719114719.478483842@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit 0d3cc504ba9cdcff76346306c37eb1ea01e60a86 ] The new pernet dying list includes conntrack entries that await delivery of the 'destroy' event via ctnetlink. The old percpu dying list will be removed soon. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/net/netfilter/nf_conntrack_ecache.h | 2 + net/netfilter/nf_conntrack_ecache.c | 10 +++++ net/netfilter/nf_conntrack_netlink.c | 43 +++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netf= ilter/nf_conntrack_ecache.h index a6135b5030dd..b57d73785e4d 100644 --- a/include/net/netfilter/nf_conntrack_ecache.h +++ b/include/net/netfilter/nf_conntrack_ecache.h @@ -164,6 +164,8 @@ void nf_conntrack_ecache_work(struct net *net, enum nf_= ct_ecache_state state); void nf_conntrack_ecache_pernet_init(struct net *net); void nf_conntrack_ecache_pernet_fini(struct net *net); =20 +struct nf_conntrack_net_ecache *nf_conn_pernet_ecache(const struct net *ne= t); + static inline bool nf_conntrack_ecache_dwork_pending(const struct net *net) { return net->ct.ecache_dwork_pending; diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntra= ck_ecache.c index 2752859479b2..334b2b4e5e8b 100644 --- a/net/netfilter/nf_conntrack_ecache.c +++ b/net/netfilter/nf_conntrack_ecache.c @@ -38,6 +38,16 @@ enum retry_state { STATE_DONE, }; =20 +struct nf_conntrack_net_ecache *nf_conn_pernet_ecache(const struct net *ne= t) +{ + struct nf_conntrack_net *cnet =3D nf_ct_pernet(net); + + return &cnet->ecache; +} +#if IS_MODULE(CONFIG_NF_CT_NETLINK) +EXPORT_SYMBOL_GPL(nf_conn_pernet_ecache); +#endif + static enum retry_state ecache_work_evict_list(struct nf_conntrack_net *cn= et) { unsigned long stop =3D jiffies + ECACHE_MAX_JIFFIES; diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntr= ack_netlink.c index 924d766e6c53..a4ec2aad2187 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c @@ -62,6 +62,7 @@ struct ctnetlink_list_dump_ctx { struct nf_conn *last; unsigned int cpu; bool done; + bool retrans_done; }; =20 static int ctnetlink_dump_tuples_proto(struct sk_buff *skb, @@ -1802,6 +1803,48 @@ ctnetlink_dump_list(struct sk_buff *skb, struct netl= ink_callback *cb, bool dying static int ctnetlink_dump_dying(struct sk_buff *skb, struct netlink_callback *cb) { + struct ctnetlink_list_dump_ctx *ctx =3D (void *)cb->ctx; + struct nf_conn *last =3D ctx->last; +#ifdef CONFIG_NF_CONNTRACK_EVENTS + const struct net *net =3D sock_net(skb->sk); + struct nf_conntrack_net_ecache *ecache_net; + struct nf_conntrack_tuple_hash *h; + struct hlist_nulls_node *n; +#endif + + if (ctx->retrans_done) + return ctnetlink_dump_list(skb, cb, true); + + ctx->last =3D NULL; + +#ifdef CONFIG_NF_CONNTRACK_EVENTS + ecache_net =3D nf_conn_pernet_ecache(net); + spin_lock_bh(&ecache_net->dying_lock); + + hlist_nulls_for_each_entry(h, n, &ecache_net->dying_list, hnnode) { + struct nf_conn *ct; + int res; + + ct =3D nf_ct_tuplehash_to_ctrack(h); + if (last && last !=3D ct) + continue; + + res =3D ctnetlink_dump_one_entry(skb, cb, ct, true); + if (res < 0) { + spin_unlock_bh(&ecache_net->dying_lock); + nf_ct_put(last); + return skb->len; + } + + nf_ct_put(last); + last =3D NULL; + } + + spin_unlock_bh(&ecache_net->dying_lock); +#endif + nf_ct_put(last); + ctx->retrans_done =3D true; + return ctnetlink_dump_list(skb, cb, true); } =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DE9EC43334 for ; Tue, 19 Jul 2022 12:57:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242393AbiGSM5A (ORCPT ); Tue, 19 Jul 2022 08:57:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242348AbiGSM4T (ORCPT ); Tue, 19 Jul 2022 08:56:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 386019A5EE; Tue, 19 Jul 2022 05:22:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 92C3E61632; Tue, 19 Jul 2022 12:22:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FB59C341C6; Tue, 19 Jul 2022 12:22:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233344; bh=NV/iYrQCFOZgumCdSuOCefhbP7ab3riduxtKlHHxEA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xXbQ7l55Hq31uEqi49cmXANnZvWcIjdRDRerXG/GvAp3Mfp+dalBtyDd048s2frK4 irX3wsmZyhdtPIo/bTXjVCsvZDBtW0mnEO5/jNcyjqUF7cZw3TMcOvJB0jlWsQSN4g FbufYJQHyjpIrZkBRjXzhUfOwFBZ/1b4uD4SvRnA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.18 064/231] netfilter: conntrack: remove the percpu dying list Date: Tue, 19 Jul 2022 13:52:29 +0200 Message-Id: <20220719114719.576342637@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit 1397af5bfd7d32b0cf2adb70a78c9a9e8f11d912 ] Its no longer needed. Entries that need event redelivery are placed on the new pernet dying list. The advantage is that there is no need to take additional spinlock on conntrack removal unless event redelivery failed or the conntrack entry was never added to the table in the first place (confirmed bit not set). The IPS_CONFIRMED bit now needs to be set as soon as the entry has been unlinked from the unconfirmed list, else the destroy function may attempt to unlink it a second time. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/net/netns/conntrack.h | 1 - net/netfilter/nf_conntrack_core.c | 35 +++++----------------------- net/netfilter/nf_conntrack_ecache.c | 1 - net/netfilter/nf_conntrack_netlink.c | 23 ++++++------------ 4 files changed, 13 insertions(+), 47 deletions(-) diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h index 0294f3d473af..e985a3010b89 100644 --- a/include/net/netns/conntrack.h +++ b/include/net/netns/conntrack.h @@ -96,7 +96,6 @@ struct nf_ip_net { struct ct_pcpu { spinlock_t lock; struct hlist_nulls_head unconfirmed; - struct hlist_nulls_head dying; }; =20 struct netns_ct { diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack= _core.c index ca1d1d105163..9010b6e5a072 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -525,21 +525,6 @@ clean_from_lists(struct nf_conn *ct) nf_ct_remove_expectations(ct); } =20 -/* must be called with local_bh_disable */ -static void nf_ct_add_to_dying_list(struct nf_conn *ct) -{ - struct ct_pcpu *pcpu; - - /* add this conntrack to the (per cpu) dying list */ - ct->cpu =3D smp_processor_id(); - pcpu =3D per_cpu_ptr(nf_ct_net(ct)->ct.pcpu_lists, ct->cpu); - - spin_lock(&pcpu->lock); - hlist_nulls_add_head(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode, - &pcpu->dying); - spin_unlock(&pcpu->lock); -} - /* must be called with local_bh_disable */ static void nf_ct_add_to_unconfirmed_list(struct nf_conn *ct) { @@ -556,11 +541,11 @@ static void nf_ct_add_to_unconfirmed_list(struct nf_c= onn *ct) } =20 /* must be called with local_bh_disable */ -static void nf_ct_del_from_dying_or_unconfirmed_list(struct nf_conn *ct) +static void nf_ct_del_from_unconfirmed_list(struct nf_conn *ct) { struct ct_pcpu *pcpu; =20 - /* We overload first tuple to link into unconfirmed or dying list.*/ + /* We overload first tuple to link into unconfirmed list.*/ pcpu =3D per_cpu_ptr(nf_ct_net(ct)->ct.pcpu_lists, ct->cpu); =20 spin_lock(&pcpu->lock); @@ -648,7 +633,8 @@ void nf_ct_destroy(struct nf_conntrack *nfct) */ nf_ct_remove_expectations(ct); =20 - nf_ct_del_from_dying_or_unconfirmed_list(ct); + if (unlikely(!nf_ct_is_confirmed(ct))) + nf_ct_del_from_unconfirmed_list(ct); =20 local_bh_enable(); =20 @@ -686,7 +672,6 @@ static void nf_ct_delete_from_lists(struct nf_conn *ct) local_bh_disable(); =20 __nf_ct_delete_from_lists(ct); - nf_ct_add_to_dying_list(ct); =20 local_bh_enable(); } @@ -700,8 +685,6 @@ static void nf_ct_add_to_ecache_list(struct nf_conn *ct) hlist_nulls_add_head_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode, &cnet->ecache.dying_list); spin_unlock(&cnet->ecache.dying_lock); -#else - nf_ct_add_to_dying_list(ct); #endif } =20 @@ -995,7 +978,6 @@ static void __nf_conntrack_insert_prepare(struct nf_con= n *ct) struct nf_conn_tstamp *tstamp; =20 refcount_inc(&ct->ct_general.use); - ct->status |=3D IPS_CONFIRMED; =20 /* set conntrack timestamp, if enabled. */ tstamp =3D nf_conn_tstamp_find(ct); @@ -1024,7 +1006,6 @@ static int __nf_ct_resolve_clash(struct sk_buff *skb, nf_conntrack_get(&ct->ct_general); =20 nf_ct_acct_merge(ct, ctinfo, loser_ct); - nf_ct_add_to_dying_list(loser_ct); nf_ct_put(loser_ct); nf_ct_set(skb, ct, ctinfo); =20 @@ -1157,7 +1138,6 @@ nf_ct_resolve_clash(struct sk_buff *skb, struct nf_co= nntrack_tuple_hash *h, return ret; =20 drop: - nf_ct_add_to_dying_list(loser_ct); NF_CT_STAT_INC(net, drop); NF_CT_STAT_INC(net, insert_failed); return NF_DROP; @@ -1224,10 +1204,10 @@ __nf_conntrack_confirm(struct sk_buff *skb) * user context, else we insert an already 'dead' hash, blocking * further use of that particular connection -JM. */ - nf_ct_del_from_dying_or_unconfirmed_list(ct); + nf_ct_del_from_unconfirmed_list(ct); + ct->status |=3D IPS_CONFIRMED; =20 if (unlikely(nf_ct_is_dying(ct))) { - nf_ct_add_to_dying_list(ct); NF_CT_STAT_INC(net, insert_failed); goto dying; } @@ -1251,7 +1231,6 @@ __nf_conntrack_confirm(struct sk_buff *skb) goto out; if (chainlen++ > max_chainlen) { chaintoolong: - nf_ct_add_to_dying_list(ct); NF_CT_STAT_INC(net, chaintoolong); NF_CT_STAT_INC(net, insert_failed); ret =3D NF_DROP; @@ -2800,7 +2779,6 @@ void nf_conntrack_init_end(void) * We need to use special "null" values, not used in hash table */ #define UNCONFIRMED_NULLS_VAL ((1<<30)+0) -#define DYING_NULLS_VAL ((1<<30)+1) =20 int nf_conntrack_init_net(struct net *net) { @@ -2821,7 +2799,6 @@ int nf_conntrack_init_net(struct net *net) =20 spin_lock_init(&pcpu->lock); INIT_HLIST_NULLS_HEAD(&pcpu->unconfirmed, UNCONFIRMED_NULLS_VAL); - INIT_HLIST_NULLS_HEAD(&pcpu->dying, DYING_NULLS_VAL); } =20 net->ct.stat =3D alloc_percpu(struct ip_conntrack_stat); diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntra= ck_ecache.c index 334b2b4e5e8b..7472c544642f 100644 --- a/net/netfilter/nf_conntrack_ecache.c +++ b/net/netfilter/nf_conntrack_ecache.c @@ -94,7 +94,6 @@ static enum retry_state ecache_work_evict_list(struct nf_= conntrack_net *cnet) hlist_nulls_for_each_entry_safe(h, n, &evicted_list, hnnode) { struct nf_conn *ct =3D nf_ct_tuplehash_to_ctrack(h); =20 - hlist_nulls_add_fake(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode); hlist_nulls_del_rcu(&ct->tuplehash[IP_CT_DIR_REPLY].hnnode); nf_ct_put(ct); =20 diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntr= ack_netlink.c index a4ec2aad2187..2e9c8183e4a2 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c @@ -62,7 +62,6 @@ struct ctnetlink_list_dump_ctx { struct nf_conn *last; unsigned int cpu; bool done; - bool retrans_done; }; =20 static int ctnetlink_dump_tuples_proto(struct sk_buff *skb, @@ -1751,13 +1750,12 @@ static int ctnetlink_dump_one_entry(struct sk_buff = *skb, } =20 static int -ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool= dying) +ctnetlink_dump_unconfirmed(struct sk_buff *skb, struct netlink_callback *c= b) { struct ctnetlink_list_dump_ctx *ctx =3D (void *)cb->ctx; struct nf_conn *ct, *last; struct nf_conntrack_tuple_hash *h; struct hlist_nulls_node *n; - struct hlist_nulls_head *list; struct net *net =3D sock_net(skb->sk); int res, cpu; =20 @@ -1774,12 +1772,11 @@ ctnetlink_dump_list(struct sk_buff *skb, struct net= link_callback *cb, bool dying =20 pcpu =3D per_cpu_ptr(net->ct.pcpu_lists, cpu); spin_lock_bh(&pcpu->lock); - list =3D dying ? &pcpu->dying : &pcpu->unconfirmed; restart: - hlist_nulls_for_each_entry(h, n, list, hnnode) { + hlist_nulls_for_each_entry(h, n, &pcpu->unconfirmed, hnnode) { ct =3D nf_ct_tuplehash_to_ctrack(h); =20 - res =3D ctnetlink_dump_one_entry(skb, cb, ct, dying); + res =3D ctnetlink_dump_one_entry(skb, cb, ct, false); if (res < 0) { ctx->cpu =3D cpu; spin_unlock_bh(&pcpu->lock); @@ -1812,8 +1809,8 @@ ctnetlink_dump_dying(struct sk_buff *skb, struct netl= ink_callback *cb) struct hlist_nulls_node *n; #endif =20 - if (ctx->retrans_done) - return ctnetlink_dump_list(skb, cb, true); + if (ctx->done) + return 0; =20 ctx->last =3D NULL; =20 @@ -1842,10 +1839,10 @@ ctnetlink_dump_dying(struct sk_buff *skb, struct ne= tlink_callback *cb) =20 spin_unlock_bh(&ecache_net->dying_lock); #endif + ctx->done =3D true; nf_ct_put(last); - ctx->retrans_done =3D true; =20 - return ctnetlink_dump_list(skb, cb, true); + return skb->len; } =20 static int ctnetlink_get_ct_dying(struct sk_buff *skb, @@ -1863,12 +1860,6 @@ static int ctnetlink_get_ct_dying(struct sk_buff *sk= b, return -EOPNOTSUPP; } =20 -static int -ctnetlink_dump_unconfirmed(struct sk_buff *skb, struct netlink_callback *c= b) -{ - return ctnetlink_dump_list(skb, cb, false); -} - static int ctnetlink_get_ct_unconfirmed(struct sk_buff *skb, const struct nfnl_info *info, const struct nlattr * const cda[]) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A676FCCA47F for ; Tue, 19 Jul 2022 12:57:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242360AbiGSM5I (ORCPT ); Tue, 19 Jul 2022 08:57:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242351AbiGSM4Y (ORCPT ); Tue, 19 Jul 2022 08:56:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58DEC9A685; Tue, 19 Jul 2022 05:22:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 08004B81A7F; Tue, 19 Jul 2022 12:22:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 568B9C341C6; Tue, 19 Jul 2022 12:22:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233347; bh=IwVwEtCJlMNehkWKAKpAVbfVe1eP3EAOJxfrxWmzl/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ztr7NDSOC6zK2sEigxaX/CklQUOBhEkbT++2xAPG9DWz8pooSOEeLefFtNJalEtVS K3wkUhNbNvOXrl3y/oWijTwoPoFrd1JSZupLm+YcS09gCZLcvU5m7jrK4tue8MhRYb wyZzQlxfM5pc+OnvnejNRidgkCxijTcEoGkJBOw8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Zijlstra , Kajetan Puchalski , Florian Westphal , Will Deacon , Sasha Levin Subject: [PATCH 5.18 065/231] netfilter: conntrack: fix crash due to confirmed bit load reordering Date: Tue, 19 Jul 2022 13:52:30 +0200 Message-Id: <20220719114719.675342376@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit 0ed8f619b412b52360ccdfaf997223ccd9319569 ] Kajetan Puchalski reports crash on ARM, with backtrace of: __nf_ct_delete_from_lists nf_ct_delete early_drop __nf_conntrack_alloc Unlike atomic_inc_not_zero, refcount_inc_not_zero is not a full barrier. conntrack uses SLAB_TYPESAFE_BY_RCU, i.e. it is possible that a 'newly' allocated object is still in use on another CPU: CPU1 CPU2 encounter 'ct' during hlist walk delete_from_lists refcount drops to 0 kmem_cache_free(ct); __nf_conntrack_alloc() // returns same object refcount_inc_not_zero(ct); /* might fail */ /* If set, ct is public/in the hash table */ test_bit(IPS_CONFIRMED_BIT, &ct->status); In case CPU1 already set refcount back to 1, refcount_inc_not_zero() will succeed. The expected possibilities for a CPU that obtained the object 'ct' (but no reference so far) are: 1. refcount_inc_not_zero() fails. CPU2 ignores the object and moves to the next entry in the list. This happens for objects that are about to be free'd, that have been free'd, or that have been reallocated by __nf_conntrack_alloc(), but where the refcount has not been increased back to 1 yet. 2. refcount_inc_not_zero() succeeds. CPU2 checks the CONFIRMED bit in ct->status. If set, the object is public/in the table. If not, the object must be skipped; CPU2 calls nf_ct_put() to un-do the refcount increment and moves to the next object. Parallel deletion from the hlists is prevented by a 'test_and_set_bit(IPS_DYING_BIT, &ct->status);' check, i.e. only one cpu will do the unlink, the other one will only drop its reference count. Because refcount_inc_not_zero is not a full barrier, CPU2 may try to delete an object that is not on any list: 1. refcount_inc_not_zero() successful (refcount inited to 1 on other CPU) 2. CONFIRMED test also successful (load was reordered or zeroing of ct->status not yet visible) 3. delete_from_lists unlinks entry not on the hlist, because IPS_DYING_BIT is 0 (already cleared). 2) is already wrong: CPU2 will handle a partially initited object that is supposed to be private to CPU1. Add needed barriers when refcount_inc_not_zero() is successful. It also inserts a smp_wmb() before the refcount is set to 1 during allocation. Because other CPU might still see the object, refcount_set(1) "resurrects" it, so we need to make sure that other CPUs will also observe the right content. In particular, the CONFIRMED bit test must only pass once the object is fully initialised and either in the hash or about to be inserted (with locks held to delay possible unlink from early_drop or gc worker). I did not change flow_offload_alloc(), as far as I can see it should call refcount_inc(), not refcount_inc_not_zero(): the ct object is attached to the skb so its refcount should be >=3D 1 in all cases. v2: prefer smp_acquire__after_ctrl_dep to smp_rmb (Will Deacon). v3: keep smp_acquire__after_ctrl_dep close to refcount_inc_not_zero call add comment in nf_conntrack_netlink, no control dependency there due to locks. Cc: Peter Zijlstra Link: https://lore.kernel.org/all/Yr7WTfd6AVTQkLjI@e126311.manchester.arm.c= om/ Reported-by: Kajetan Puchalski Diagnosed-by: Will Deacon Fixes: 719774377622 ("netfilter: conntrack: convert to refcount_t api") Signed-off-by: Florian Westphal Acked-by: Will Deacon Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/netfilter/nf_conntrack_core.c | 22 ++++++++++++++++++++++ net/netfilter/nf_conntrack_netlink.c | 1 + net/netfilter/nf_conntrack_standalone.c | 3 +++ 3 files changed, 26 insertions(+) diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack= _core.c index 9010b6e5a072..5a85735512ce 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -764,6 +764,9 @@ static void nf_ct_gc_expired(struct nf_conn *ct) if (!refcount_inc_not_zero(&ct->ct_general.use)) return; =20 + /* load ->status after refcount increase */ + smp_acquire__after_ctrl_dep(); + if (nf_ct_should_gc(ct)) nf_ct_kill(ct); =20 @@ -830,6 +833,9 @@ __nf_conntrack_find_get(struct net *net, const struct n= f_conntrack_zone *zone, */ ct =3D nf_ct_tuplehash_to_ctrack(h); if (likely(refcount_inc_not_zero(&ct->ct_general.use))) { + /* re-check key after refcount */ + smp_acquire__after_ctrl_dep(); + if (likely(nf_ct_key_equal(h, tuple, zone, net))) goto found; =20 @@ -1369,6 +1375,9 @@ static unsigned int early_drop_list(struct net *net, if (!refcount_inc_not_zero(&tmp->ct_general.use)) continue; =20 + /* load ->ct_net and ->status after refcount increase */ + smp_acquire__after_ctrl_dep(); + /* kill only if still in same netns -- might have moved due to * SLAB_TYPESAFE_BY_RCU rules. * @@ -1518,6 +1527,9 @@ static void gc_worker(struct work_struct *work) if (!refcount_inc_not_zero(&tmp->ct_general.use)) continue; =20 + /* load ->status after refcount increase */ + smp_acquire__after_ctrl_dep(); + if (gc_worker_skip_ct(tmp)) { nf_ct_put(tmp); continue; @@ -1749,6 +1761,16 @@ init_conntrack(struct net *net, struct nf_conn *tmpl, if (!exp) __nf_ct_try_assign_helper(ct, tmpl, GFP_ATOMIC); =20 + /* Other CPU might have obtained a pointer to this object before it was + * released. Because refcount is 0, refcount_inc_not_zero() will fail. + * + * After refcount_set(1) it will succeed; ensure that zeroing of + * ct->status and the correct ct->net pointer are visible; else other + * core might observe CONFIRMED bit which means the entry is valid and + * in the hash table, but its not (anymore). + */ + smp_wmb(); + /* Now it is inserted into the unconfirmed list, set refcount to 1. */ refcount_set(&ct->ct_general.use, 1); nf_ct_add_to_unconfirmed_list(ct); diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntr= ack_netlink.c index 2e9c8183e4a2..431e005ff14d 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c @@ -1203,6 +1203,7 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netl= ink_callback *cb) hnnode) { ct =3D nf_ct_tuplehash_to_ctrack(h); if (nf_ct_is_expired(ct)) { + /* need to defer nf_ct_kill() until lock is released */ if (i < ARRAY_SIZE(nf_ct_evict) && refcount_inc_not_zero(&ct->ct_general.use)) nf_ct_evict[i++] =3D ct; diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_con= ntrack_standalone.c index 55aa55b252b2..48812dda273b 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c @@ -306,6 +306,9 @@ static int ct_seq_show(struct seq_file *s, void *v) if (unlikely(!refcount_inc_not_zero(&ct->ct_general.use))) return 0; =20 + /* load ->status after refcount increase */ + smp_acquire__after_ctrl_dep(); + if (nf_ct_should_gc(ct)) { nf_ct_kill(ct); goto release; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80B1BC43334 for ; Tue, 19 Jul 2022 12:57:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242419AbiGSM5Q (ORCPT ); Tue, 19 Jul 2022 08:57:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242280AbiGSM41 (ORCPT ); Tue, 19 Jul 2022 08:56:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 290215B798; Tue, 19 Jul 2022 05:22:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C76DBB81B10; Tue, 19 Jul 2022 12:22:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D07BC341C6; Tue, 19 Jul 2022 12:22:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233350; bh=Mkvf0EX9t/n0RX1AyTZNR8hPmODfZOits7KU9Qsew+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BwX2cJjqxmiEYbGK6decVcgLZYQIFCnMGn+8fMeREXLA5GLOOaZshkCoQzVsttG0y JiAirOh7l7fBxGZFN5KMSY8dYLxN+PNzkmJH//yqEUs/MglAG7HTRn3OU5ztlSCeae 16ig1LEbjiuh0Is/yqET+UIxq2AxEWaxKcl9b3co= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jon Hunter , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 066/231] net: stmmac: dwc-qos: Disable split header for Tegra194 Date: Tue, 19 Jul 2022 13:52:31 +0200 Message-Id: <20220719114719.771014731@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jon Hunter [ Upstream commit 029c1c2059e9c4b38f97a06204cdecd10cfbeb8a ] There is a long-standing issue with the Synopsys DWC Ethernet driver for Tegra194 where random system crashes have been observed [0]. The problem occurs when the split header feature is enabled in the stmmac driver. In the bad case, a larger than expected buffer length is received and causes the calculation of the total buffer length to overflow. This results in a very large buffer length that causes the kernel to crash. Why this larger buffer length is received is not clear, however, the feedback from the NVIDIA design team is that the split header feature is not supported for Tegra194. Therefore, disable split header support for Tegra194 to prevent these random crashes from occurring. [0] https://lore.kernel.org/linux-tegra/b0b17697-f23e-8fa5-3757-604a86f3a09= 5@nvidia.com/ Fixes: 67afd6d1cfdf ("net: stmmac: Add Split Header support and enable it i= n XGMAC cores") Signed-off-by: Jon Hunter Link: https://lore.kernel.org/r/20220706083913.13750-1-jonathanh@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c index bc91fd867dcd..358fc26f8d1f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c @@ -361,6 +361,7 @@ static int tegra_eqos_probe(struct platform_device *pde= v, data->fix_mac_speed =3D tegra_eqos_fix_speed; data->init =3D tegra_eqos_init; data->bsp_priv =3D eqos; + data->sph_disable =3D 1; =20 err =3D tegra_eqos_init(pdev, eqos); if (err < 0) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5935CCA481 for ; Tue, 19 Jul 2022 12:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242364AbiGSM5M (ORCPT ); Tue, 19 Jul 2022 08:57:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242353AbiGSM41 (ORCPT ); Tue, 19 Jul 2022 08:56:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 772925B079; Tue, 19 Jul 2022 05:22:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 09E636177D; Tue, 19 Jul 2022 12:22:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F00D2C341C6; Tue, 19 Jul 2022 12:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233353; bh=XOu0oGKI6SMaLuAB12ayFkZ+0xnv/ip8udQlsI+WW+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jlAkYs1QpnqoqkDp55apg61H1+tqS9Fq8HqO9Vvw5mZmOFySWcqVi8T/waiKcWFf6 kmv/JzGCMqd8uBTm86czKVHxNnWxFXQVT8vN6tSWkyBrnaoS+4dPYwbVMbJLpdcIfc PdJcAzXbD0+A9QgJIEq5uuAw6XdX8jNT8YrcCucc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Siddharth Vadapalli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 067/231] net: ethernet: ti: am65-cpsw: Fix devlink port register sequence Date: Tue, 19 Jul 2022 13:52:32 +0200 Message-Id: <20220719114719.868009251@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Siddharth Vadapalli [ Upstream commit 0680e20af5fbf41df8a11b11bd9a7c25b2ca0746 ] Renaming interfaces using udevd depends on the interface being registered before its netdev is registered. Otherwise, udevd reads an empty phys_port_name value, resulting in the interface not being renamed. Fix this by registering the interface before registering its netdev by invoking am65_cpsw_nuss_register_devlink() before invoking register_netdev() for the interface. Move the function call to devlink_port_type_eth_set(), invoking it after register_netdev() is invoked, to ensure that netlink notification for the port state change is generated after the netdev is completely initialized. Fixes: 58356eb31d60 ("net: ti: am65-cpsw-nuss: Add devlink support") Signed-off-by: Siddharth Vadapalli Link: https://lore.kernel.org/r/20220706070208.12207-1-s-vadapalli@ti.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/etherne= t/ti/am65-cpsw-nuss.c index 6d978dbf708f..298953053407 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -2475,7 +2475,6 @@ static int am65_cpsw_nuss_register_devlink(struct am6= 5_cpsw_common *common) port->port_id, ret); goto dl_port_unreg; } - devlink_port_type_eth_set(dl_port, port->ndev); } devlink_register(common->devlink); return ret; @@ -2519,6 +2518,7 @@ static void am65_cpsw_unregister_devlink(struct am65_= cpsw_common *common) static int am65_cpsw_nuss_register_ndevs(struct am65_cpsw_common *common) { struct device *dev =3D common->dev; + struct devlink_port *dl_port; struct am65_cpsw_port *port; int ret =3D 0, i; =20 @@ -2535,6 +2535,10 @@ static int am65_cpsw_nuss_register_ndevs(struct am65= _cpsw_common *common) return ret; } =20 + ret =3D am65_cpsw_nuss_register_devlink(common); + if (ret) + return ret; + for (i =3D 0; i < common->port_num; i++) { port =3D &common->ports[i]; =20 @@ -2547,25 +2551,24 @@ static int am65_cpsw_nuss_register_ndevs(struct am6= 5_cpsw_common *common) i, ret); goto err_cleanup_ndev; } + + dl_port =3D &port->devlink_port; + devlink_port_type_eth_set(dl_port, port->ndev); } =20 ret =3D am65_cpsw_register_notifiers(common); if (ret) goto err_cleanup_ndev; =20 - ret =3D am65_cpsw_nuss_register_devlink(common); - if (ret) - goto clean_unregister_notifiers; - /* can't auto unregister ndev using devm_add_action() due to * devres release sequence in DD core for DMA */ =20 return 0; -clean_unregister_notifiers: - am65_cpsw_unregister_notifiers(common); + err_cleanup_ndev: am65_cpsw_nuss_cleanup_ndev(common); + am65_cpsw_unregister_devlink(common); =20 return ret; } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB73DC433EF for ; Tue, 19 Jul 2022 12:55:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242201AbiGSMzS (ORCPT ); Tue, 19 Jul 2022 08:55:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242105AbiGSMyE (ORCPT ); Tue, 19 Jul 2022 08:54:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA21593C22; Tue, 19 Jul 2022 05:21:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6772D6177D; Tue, 19 Jul 2022 12:21:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4849BC341CB; Tue, 19 Jul 2022 12:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233277; bh=YQc9oplaK/VMkpFIyKkSrYAnt6CG5R32uBWER36KpF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IawyQo/kaXqElIfcYmrQWRCXpXqpsEZyegiTgp7W7/Tf0dXRDvr8p2lUspwa3OyrO ncse7+zNEBcK/VTXJLwNFFXU8OYd4KTXWeJ1nmlSZmu63DCNZovk7NamwR1r0SmPR4 eT8MpdHWg8zxghxSFt0KFd72rFyUTYYojNot1DJM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Lunn , Pavel Skripkin , Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 068/231] net: ocelot: fix wrong time_after usage Date: Tue, 19 Jul 2022 13:52:33 +0200 Message-Id: <20220719114719.977077572@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavel Skripkin [ Upstream commit f46fd3d7c3bd5d7bd5bb664135cf32ca9e97190b ] Accidentally noticed, that this driver is the only user of while (time_after(jiffies...)). It looks like typo, because likely this while loop will finish after 1st iteration, because time_after() returns true when 1st argument _is after_ 2nd one. There is one possible problem with this poll loop: the scheduler could put the thread to sleep, and it does not get woken up for OCELOT_FDMA_CH_SAFE_TIMEOUT_US. During that time, the hardware has done its thing, but you exit the while loop and return -ETIMEDOUT. Fix it by using sane poll API that avoids all problems described above Fixes: 753a026cfec1 ("net: ocelot: add FDMA support") Suggested-by: Andrew Lunn Signed-off-by: Pavel Skripkin Reviewed-by: Vladimir Oltean Link: https://lore.kernel.org/r/20220706132845.27968-1-paskripkin@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mscc/ocelot_fdma.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_fdma.c b/drivers/net/ethernet= /mscc/ocelot_fdma.c index dffa597bffe6..6a8f84f325a3 100644 --- a/drivers/net/ethernet/mscc/ocelot_fdma.c +++ b/drivers/net/ethernet/mscc/ocelot_fdma.c @@ -94,19 +94,18 @@ static void ocelot_fdma_activate_chan(struct ocelot *oc= elot, dma_addr_t dma, ocelot_fdma_writel(ocelot, MSCC_FDMA_CH_ACTIVATE, BIT(chan)); } =20 +static u32 ocelot_fdma_read_ch_safe(struct ocelot *ocelot) +{ + return ocelot_fdma_readl(ocelot, MSCC_FDMA_CH_SAFE); +} + static int ocelot_fdma_wait_chan_safe(struct ocelot *ocelot, int chan) { - unsigned long timeout; u32 safe; =20 - timeout =3D jiffies + usecs_to_jiffies(OCELOT_FDMA_CH_SAFE_TIMEOUT_US); - do { - safe =3D ocelot_fdma_readl(ocelot, MSCC_FDMA_CH_SAFE); - if (safe & BIT(chan)) - return 0; - } while (time_after(jiffies, timeout)); - - return -ETIMEDOUT; + return readx_poll_timeout_atomic(ocelot_fdma_read_ch_safe, ocelot, safe, + safe & BIT(chan), 0, + OCELOT_FDMA_CH_SAFE_TIMEOUT_US); } =20 static void ocelot_fdma_dcb_set_data(struct ocelot_fdma_dcb *dcb, --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBB3FC43334 for ; Tue, 19 Jul 2022 12:55:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242245AbiGSMzY (ORCPT ); Tue, 19 Jul 2022 08:55:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242210AbiGSMyK (ORCPT ); Tue, 19 Jul 2022 08:54:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8917893C3E; Tue, 19 Jul 2022 05:21:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 47B6861632; Tue, 19 Jul 2022 12:21:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2964CC341C6; Tue, 19 Jul 2022 12:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233280; bh=ojsQWS1J3l2AGwGheZQABJttu6AqljrMiu0W/WvnjoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nGXwEBnl4A2xicK4rDfZkso49eB38HCdcOVLvW4J8Q6u2/TtTNflPGwbEoGWJJYlR N85rhMi3OrVRaVfCV8rREoKcZpcpCH3BCfdQktX9nQHaDm2wIvjZWRNnkakWWHyLIr vLcX1MIEhi6U012y0hqZXBSy+OKlaXqs5+fZurbg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 069/231] sysctl: Fix data races in proc_dointvec(). Date: Tue, 19 Jul 2022 13:52:34 +0200 Message-Id: <20220719114720.362924332@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 1f1be04b4d48a2475ea1aab46a99221bfc5c0968 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_dointvec() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_dointvec() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 830aaf8ca08e..27b3a55dc4bd 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -518,14 +518,14 @@ static int do_proc_dointvec_conv(bool *negp, unsigned= long *lvalp, if (*negp) { if (*lvalp > (unsigned long) INT_MAX + 1) return -EINVAL; - *valp =3D -*lvalp; + WRITE_ONCE(*valp, -*lvalp); } else { if (*lvalp > (unsigned long) INT_MAX) return -EINVAL; - *valp =3D *lvalp; + WRITE_ONCE(*valp, *lvalp); } } else { - int val =3D *valp; + int val =3D READ_ONCE(*valp); if (val < 0) { *negp =3D true; *lvalp =3D -(unsigned long)val; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03CABC43334 for ; Tue, 19 Jul 2022 12:55:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239417AbiGSMz2 (ORCPT ); Tue, 19 Jul 2022 08:55:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242249AbiGSMyO (ORCPT ); Tue, 19 Jul 2022 08:54:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CB66951F6; Tue, 19 Jul 2022 05:21:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 58DCB618EB; Tue, 19 Jul 2022 12:21:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A764C341C6; Tue, 19 Jul 2022 12:21:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233283; bh=ecoVLLvJ4WFCHBZReb9JWaYdV/smip+xElqVOG9o4Hc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eu/AXQZQK5kk0oNDh59XzMK7+UjEgi2cX8hwMnB14M0mjPU7lMUiWc2KtQe02TBIV gPVq+A/tXemas9/Juw5aXJuwkzeAZ0chtBLs1QygounInciJ59DVGT9VKzk82hNiBA fL1WRX7/1zFKMVOksfit8DWilHV+YryhFL0TRGnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 070/231] sysctl: Fix data races in proc_douintvec(). Date: Tue, 19 Jul 2022 13:52:35 +0200 Message-Id: <20220719114720.559405316@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 4762b532ec9539755aab61445d5da6e1926ccb99 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_douintvec() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_douintvec() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: e7d316a02f68 ("sysctl: handle error writing UINT_MAX to u32 fields") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 27b3a55dc4bd..6c61e2992fed 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -544,9 +544,9 @@ static int do_proc_douintvec_conv(unsigned long *lvalp, if (write) { if (*lvalp > UINT_MAX) return -EINVAL; - *valp =3D *lvalp; + WRITE_ONCE(*valp, *lvalp); } else { - unsigned int val =3D *valp; + unsigned int val =3D READ_ONCE(*valp); *lvalp =3D (unsigned long)val; } return 0; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCE9CC43334 for ; Tue, 19 Jul 2022 12:55:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242262AbiGSMzb (ORCPT ); Tue, 19 Jul 2022 08:55:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242303AbiGSMyT (ORCPT ); Tue, 19 Jul 2022 08:54:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A15395B37; Tue, 19 Jul 2022 05:21:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3E0DE618E1; Tue, 19 Jul 2022 12:21:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B3A2C341C6; Tue, 19 Jul 2022 12:21:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233286; bh=jJR98GNYKZguEJn8h6u7x/r0+5rwLCzLvq/012by7hY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OIAeVyxtxc7zyZm0EJkgiTvbg7OiGR+ucsGq8Kj8U3nhjYF25sNeVn1o2JIg8gAny Xtsgz5BK1qFSt+oKT65GZ2tjvXNnBnjZWPYJ5xgq+D1Pf+O3w7j67p/0pXv625QuIu 4CJy/M2VNnP9wsZS23rbeNaKs0j/TnSEjkQ/dyqs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 071/231] sysctl: Fix data races in proc_dointvec_minmax(). Date: Tue, 19 Jul 2022 13:52:36 +0200 Message-Id: <20220719114720.647024554@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit f613d86d014b6375a4085901de39406598121e35 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_dointvec_minmax() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_dointvec_minmax() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 6c61e2992fed..22ebf3f5eefe 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -929,7 +929,7 @@ static int do_proc_dointvec_minmax_conv(bool *negp, uns= igned long *lvalp, if ((param->min && *param->min > tmp) || (param->max && *param->max < tmp)) return -EINVAL; - *valp =3D tmp; + WRITE_ONCE(*valp, tmp); } =20 return 0; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9984CC43334 for ; Tue, 19 Jul 2022 12:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242171AbiGSMzx (ORCPT ); Tue, 19 Jul 2022 08:55:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242378AbiGSMy3 (ORCPT ); Tue, 19 Jul 2022 08:54:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D527F95C29; Tue, 19 Jul 2022 05:21:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2F9B1618CF; Tue, 19 Jul 2022 12:21:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAB66C341C6; Tue, 19 Jul 2022 12:21:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233289; bh=o/pgdEkrFtiMa7YeRpjlaMVNtc81Z+tPm/oq+KKV+C8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GeDrsh6uA5oyvepKMs0VpuW54a33FWL+Fv++SHueIMa9xMvSD0iC+xmpROFLnJ6r+ R1Qo1wR3ZZVNUJGqhJ8sZWuBvl4T4Xu796jPe/Cz9QSViTp1fS7dpnyZpxlPT6XmII h+L+3p9izIdsaTqk00WHk0eMvJ43n/JrQqdCzxrw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 072/231] sysctl: Fix data races in proc_douintvec_minmax(). Date: Tue, 19 Jul 2022 13:52:37 +0200 Message-Id: <20220719114720.759821586@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 2d3b559df3ed39258737789aae2ae7973d205bc1 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_douintvec_minmax() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_douintvec_minmax() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: 61d9b56a8920 ("sysctl: add unsigned int range support") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 22ebf3f5eefe..a769f64a78ed 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -995,7 +995,7 @@ static int do_proc_douintvec_minmax_conv(unsigned long = *lvalp, (param->max && *param->max < tmp)) return -ERANGE; =20 - *valp =3D tmp; + WRITE_ONCE(*valp, tmp); } =20 return 0; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34433C433EF for ; Tue, 19 Jul 2022 12:56:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242190AbiGSMz7 (ORCPT ); Tue, 19 Jul 2022 08:55:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242405AbiGSMyb (ORCPT ); Tue, 19 Jul 2022 08:54:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37B6E97487; Tue, 19 Jul 2022 05:21:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 097066177D; Tue, 19 Jul 2022 12:21:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFEEBC341D2; Tue, 19 Jul 2022 12:21:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233292; bh=F3A7SXHYjof7BlkLaf1dpEJWq0dRZbv4zt/6zVtRX98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nemFESH4bgiGA4WZbRuNJTKMsS3lswaZ5y4aRJ7pEYaJxfWvhsOa6ssHQQF0BJDO/ x1bZvBE0NIe79an+Z2ImiDVsLhQWbrmkGb7ea1lmBeu6mCI2wpNSHuFmRYcoyg6+Zu Pq8il7ip0XGF2qSSGdyIm05j5DcSkYp5k5cqRHqI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 073/231] sysctl: Fix data races in proc_doulongvec_minmax(). Date: Tue, 19 Jul 2022 13:52:38 +0200 Message-Id: <20220719114720.843625906@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit c31bcc8fb89fc2812663900589c6325ba35d9a65 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_doulongvec_minmax() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_doulongvec_minmax() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index a769f64a78ed..7a8899f237a2 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1162,9 +1162,9 @@ static int __do_proc_doulongvec_minmax(void *data, st= ruct ctl_table *table, err =3D -EINVAL; break; } - *i =3D val; + WRITE_ONCE(*i, val); } else { - val =3D convdiv * (*i) / convmul; + val =3D convdiv * READ_ONCE(*i) / convmul; if (!first) proc_put_char(&buffer, &left, '\t'); proc_put_long(&buffer, &left, val, false); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23192CCA47F for ; Tue, 19 Jul 2022 12:55:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241907AbiGSMzf (ORCPT ); Tue, 19 Jul 2022 08:55:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242382AbiGSMy3 (ORCPT ); Tue, 19 Jul 2022 08:54:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D1C797497; Tue, 19 Jul 2022 05:21:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F1107618D1; Tue, 19 Jul 2022 12:21:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC9B4C341C6; Tue, 19 Jul 2022 12:21:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233295; bh=8GkFOcfHZQJAUdibGRDiaFGXNy8Bo9/QPv0FyUulaz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f29ldv8Zrwy2sK0R2NVcrQ1CucoEpki9wjjK+hM5lQscV70yX8jWyq0IQbfrMHoh1 z3M9UkvItwxIKaHW4t6ck+4pWN2UZ+AKVev/Z63/31CEfEZ6xDSBFxxObA2XzUZ8Qs cKQk+HgcRPSZFH8J2dlkrywqFf36IaN98W53lNCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 074/231] sysctl: Fix data races in proc_dointvec_jiffies(). Date: Tue, 19 Jul 2022 13:52:39 +0200 Message-Id: <20220719114720.932750685@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit e877820877663fbae8cb9582ea597a7230b94df3 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_dointvec_jiffies() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_dointvec_jiffies() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 7a8899f237a2..878b1122cb89 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1245,9 +1245,12 @@ static int do_proc_dointvec_jiffies_conv(bool *negp,= unsigned long *lvalp, if (write) { if (*lvalp > INT_MAX / HZ) return 1; - *valp =3D *negp ? -(*lvalp*HZ) : (*lvalp*HZ); + if (*negp) + WRITE_ONCE(*valp, -*lvalp * HZ); + else + WRITE_ONCE(*valp, *lvalp * HZ); } else { - int val =3D *valp; + int val =3D READ_ONCE(*valp); unsigned long lval; if (val < 0) { *negp =3D true; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69C1BC433EF for ; Tue, 19 Jul 2022 12:55:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242301AbiGSMzm (ORCPT ); Tue, 19 Jul 2022 08:55:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242456AbiGSMyf (ORCPT ); Tue, 19 Jul 2022 08:54:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BE1F97A1A; Tue, 19 Jul 2022 05:21:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1B22C618F4; Tue, 19 Jul 2022 12:21:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2DF0C341CF; Tue, 19 Jul 2022 12:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233298; bh=wq5LS4JHOJWWJMM6YSTKJp2K1XVCUQrIjJ+BrHZeLKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TBNDeBUdf8OqPUOPRDbZEAfYJZK/wpibku2A8ybQQuj0yBtl8GJNOe8a+l3+jbrdv milY2XOKOhrkFdSAUFRDWQy3yp4W4mqQjPsEEk7MJDke1auaOhioYlc2nGSXD3V9XC AvxYNIETa5bXXps4AzEhMmbr2XRFCpVdz4W0PpKA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 075/231] tcp: Fix a data-race around sysctl_tcp_max_orphans. Date: Tue, 19 Jul 2022 13:52:40 +0200 Message-Id: <20220719114721.012013257@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 47e6ab24e8c6e3ca10ceb5835413f401f90de4bf ] While reading sysctl_tcp_max_orphans, it can be changed concurrently. So, we need to add READ_ONCE() to avoid a data-race. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index e31cf137c614..f2fd1779d925 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2735,7 +2735,8 @@ static void tcp_orphan_update(struct timer_list *unus= ed) =20 static bool tcp_too_many_orphans(int shift) { - return READ_ONCE(tcp_orphan_cache) << shift > sysctl_tcp_max_orphans; + return READ_ONCE(tcp_orphan_cache) << shift > + READ_ONCE(sysctl_tcp_max_orphans); } =20 bool tcp_check_oom(struct sock *sk, int shift) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD4FFC43334 for ; Tue, 19 Jul 2022 12:55:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242292AbiGSMzi (ORCPT ); Tue, 19 Jul 2022 08:55:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242446AbiGSMyf (ORCPT ); Tue, 19 Jul 2022 08:54:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1D5397A16; Tue, 19 Jul 2022 05:21:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CE146618EB; Tue, 19 Jul 2022 12:21:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDD89C341CF; Tue, 19 Jul 2022 12:21:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233301; bh=wB6wc6y/Dtx3NEjnGvFvSrVcgCQ3JRyJxsff8TxVPik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hzRGxw935mYMElbtSYqDBi5M9yEZG6zIGk+VtQ6vtodFZCdYEpgCCu/NUdo+VXe3z U7GvbyWi+TIc10L9WiTPquQx1dJVZImWi95fVft6UsNzO7f1pSK4Av28mnw0e+xo5V XObJ/3Vxv7uwHSWJujmXD0E8NoDNCEol/gq9HPpY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 076/231] inetpeer: Fix data-races around sysctl. Date: Tue, 19 Jul 2022 13:52:41 +0200 Message-Id: <20220719114721.099030907@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 3d32edf1f3c38d3301f6434e56316f293466d7fb ] While reading inetpeer sysctl variables, they can be changed concurrently. So, we need to add READ_ONCE() to avoid data-races. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/inetpeer.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index da21dfce24d7..e9fed83e9b3c 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c @@ -141,16 +141,20 @@ static void inet_peer_gc(struct inet_peer_base *base, struct inet_peer *gc_stack[], unsigned int gc_cnt) { + int peer_threshold, peer_maxttl, peer_minttl; struct inet_peer *p; __u32 delta, ttl; int i; =20 - if (base->total >=3D inet_peer_threshold) + peer_threshold =3D READ_ONCE(inet_peer_threshold); + peer_maxttl =3D READ_ONCE(inet_peer_maxttl); + peer_minttl =3D READ_ONCE(inet_peer_minttl); + + if (base->total >=3D peer_threshold) ttl =3D 0; /* be aggressive */ else - ttl =3D inet_peer_maxttl - - (inet_peer_maxttl - inet_peer_minttl) / HZ * - base->total / inet_peer_threshold * HZ; + ttl =3D peer_maxttl - (peer_maxttl - peer_minttl) / HZ * + base->total / peer_threshold * HZ; for (i =3D 0; i < gc_cnt; i++) { p =3D gc_stack[i]; =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AECC9C43334 for ; Tue, 19 Jul 2022 12:55:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242164AbiGSMzo (ORCPT ); Tue, 19 Jul 2022 08:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242490AbiGSMyj (ORCPT ); Tue, 19 Jul 2022 08:54:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 414AD97A3B; Tue, 19 Jul 2022 05:21:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C1AF2618E1; Tue, 19 Jul 2022 12:21:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95285C341C6; Tue, 19 Jul 2022 12:21:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233304; bh=nLlYFQCkhFBiv9hsoKKuZAY8cVQn2YoAKCkhCpyctqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y+W0xGDNbzgNfK5lO84r7RcZep3z7T9E55RwHSYlObPiCzsTGGnQShyHiuniLUy2Q 9d75d/zSJjZx4xkeLb4642QSOH/K+2pdMzN9CCYsY2Yed4WJpHLKHw5B4ZssQ/ATQP QNRzWMkZniua3mO6RISvG3mDSOve9Mje+kf3Zh6M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 077/231] net: Fix data-races around sysctl_mem. Date: Tue, 19 Jul 2022 13:52:42 +0200 Message-Id: <20220719114721.176165552@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 310731e2f1611d1d13aae237abcf8e66d33345d5 ] While reading .sysctl_mem, it can be changed concurrently. So, we need to add READ_ONCE() to avoid data-races. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/net/sock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/sock.h b/include/net/sock.h index 3c4fb8f03fd9..6bef0ffb1e7b 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1534,7 +1534,7 @@ void __sk_mem_reclaim(struct sock *sk, int amount); /* sysctl_mem values are in pages, we convert them in SK_MEM_QUANTUM units= */ static inline long sk_prot_mem_limits(const struct sock *sk, int index) { - long val =3D sk->sk_prot->sysctl_mem[index]; + long val =3D READ_ONCE(sk->sk_prot->sysctl_mem[index]); =20 #if PAGE_SIZE > SK_MEM_QUANTUM val <<=3D PAGE_SHIFT - SK_MEM_QUANTUM_SHIFT; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC3E2C433EF for ; Tue, 19 Jul 2022 12:56:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242212AbiGSM4B (ORCPT ); Tue, 19 Jul 2022 08:56:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242556AbiGSMyp (ORCPT ); Tue, 19 Jul 2022 08:54:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0233F97D7C; Tue, 19 Jul 2022 05:21:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D4938B81B36; Tue, 19 Jul 2022 12:21:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 451DDC341CA; Tue, 19 Jul 2022 12:21:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233309; bh=w2oiqg+MxnTiHaiUG3hsFk6LU/L2vahhpaOcgaZDLXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mvq/3Lw0ABrEIohz4j+xMVqCsO+inWlX/B2OlwlAmFdrE7rK/Qx+DQGmpWBrSzW2q iK8oF7kIOBPNpaekvIsI2QIzwkviaIASO0rPjZzhRBYv1I5u5/JD0gl0x43ltjjYoE RYpUfMxJ0wQP7O56USmWLttUimJntbyImqmI5KF8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , Paul Moore , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 078/231] cipso: Fix data-races around sysctl. Date: Tue, 19 Jul 2022 13:52:43 +0200 Message-Id: <20220719114721.428329791@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit dd44f04b9214adb68ef5684ae87a81ba03632250 ] While reading cipso sysctl variables, they can be changed concurrently. So, we need to add READ_ONCE() to avoid data-races. Fixes: 446fda4f2682 ("[NetLabel]: CIPSOv4 engine") Signed-off-by: Kuniyuki Iwashima Acked-by: Paul Moore Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- Documentation/networking/ip-sysctl.rst | 2 +- net/ipv4/cipso_ipv4.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/network= ing/ip-sysctl.rst index 66828293d9cb..8ffed7135fc1 100644 --- a/Documentation/networking/ip-sysctl.rst +++ b/Documentation/networking/ip-sysctl.rst @@ -1085,7 +1085,7 @@ cipso_cache_enable - BOOLEAN cipso_cache_bucket_size - INTEGER The CIPSO label cache consists of a fixed size hash table with each hash bucket containing a number of cache entries. This variable limits - the number of entries in each hash bucket; the larger the value the + the number of entries in each hash bucket; the larger the value is, the more CIPSO label mappings that can be cached. When the number of entries in a given hash bucket reaches this limit adding new entries causes the oldest entry in the bucket to be removed to make room. diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index 62d5f99760aa..6cd3b6c559f0 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c @@ -239,7 +239,7 @@ static int cipso_v4_cache_check(const unsigned char *ke= y, struct cipso_v4_map_cache_entry *prev_entry =3D NULL; u32 hash; =20 - if (!cipso_v4_cache_enabled) + if (!READ_ONCE(cipso_v4_cache_enabled)) return -ENOENT; =20 hash =3D cipso_v4_map_cache_hash(key, key_len); @@ -296,13 +296,14 @@ static int cipso_v4_cache_check(const unsigned char *= key, int cipso_v4_cache_add(const unsigned char *cipso_ptr, const struct netlbl_lsm_secattr *secattr) { + int bkt_size =3D READ_ONCE(cipso_v4_cache_bucketsize); int ret_val =3D -EPERM; u32 bkt; struct cipso_v4_map_cache_entry *entry =3D NULL; struct cipso_v4_map_cache_entry *old_entry =3D NULL; u32 cipso_ptr_len; =20 - if (!cipso_v4_cache_enabled || cipso_v4_cache_bucketsize <=3D 0) + if (!READ_ONCE(cipso_v4_cache_enabled) || bkt_size <=3D 0) return 0; =20 cipso_ptr_len =3D cipso_ptr[1]; @@ -322,7 +323,7 @@ int cipso_v4_cache_add(const unsigned char *cipso_ptr, =20 bkt =3D entry->hash & (CIPSO_V4_CACHE_BUCKETS - 1); spin_lock_bh(&cipso_v4_cache[bkt].lock); - if (cipso_v4_cache[bkt].size < cipso_v4_cache_bucketsize) { + if (cipso_v4_cache[bkt].size < bkt_size) { list_add(&entry->list, &cipso_v4_cache[bkt].list); cipso_v4_cache[bkt].size +=3D 1; } else { @@ -1199,7 +1200,8 @@ static int cipso_v4_gentag_rbm(const struct cipso_v4_= doi *doi_def, /* This will send packets using the "optimized" format when * possible as specified in section 3.4.2.6 of the * CIPSO draft. */ - if (cipso_v4_rbm_optfmt && ret_val > 0 && ret_val <=3D 10) + if (READ_ONCE(cipso_v4_rbm_optfmt) && ret_val > 0 && + ret_val <=3D 10) tag_len =3D 14; else tag_len =3D 4 + ret_val; @@ -1603,7 +1605,7 @@ int cipso_v4_validate(const struct sk_buff *skb, unsi= gned char **option) * all the CIPSO validations here but it doesn't * really specify _exactly_ what we need to validate * ... so, just make it a sysctl tunable. */ - if (cipso_v4_rbm_strictvalid) { + if (READ_ONCE(cipso_v4_rbm_strictvalid)) { if (cipso_v4_map_lvl_valid(doi_def, tag[3]) < 0) { err_offset =3D opt_iter + 3; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B16CC433EF for ; Tue, 19 Jul 2022 12:56:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242211AbiGSM4E (ORCPT ); Tue, 19 Jul 2022 08:56:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242562AbiGSMyq (ORCPT ); Tue, 19 Jul 2022 08:54:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0280C98207; Tue, 19 Jul 2022 05:21:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 486D36183D; Tue, 19 Jul 2022 12:21:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25E59C341C6; Tue, 19 Jul 2022 12:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233312; bh=DUAa5U+dAGJ6yr8/kLhhqS6OZwSXQWeIRwQAoug3uHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QpGoPaP8LwTibxSfVmElyEptH2PxhQNvsXb3+ahXY7iU8ZKHlpMQlLAFzYw71722j aWBO2EOhRghzGOwFfKtU6/i2ysrPY26WRkfYRjiF7DZ+iATOqq/PlHXpA+lehSKzWa fLUCYvPwHQ6eMTaZ0ewU2zwcs9xBvMtEUk7AXTVY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 079/231] icmp: Fix data-races around sysctl. Date: Tue, 19 Jul 2022 13:52:44 +0200 Message-Id: <20220719114721.514621079@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 48d7ee321ea5182c6a70782aa186422a70e67e22 ] While reading icmp sysctl variables, they can be changed concurrently. So, we need to add READ_ONCE() to avoid data-races. Fixes: 4cdf507d5452 ("icmp: add a global rate limitation") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/icmp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 72a375c7f417..97350a38a75d 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -253,11 +253,12 @@ bool icmp_global_allow(void) spin_lock(&icmp_global.lock); delta =3D min_t(u32, now - icmp_global.stamp, HZ); if (delta >=3D HZ / 50) { - incr =3D sysctl_icmp_msgs_per_sec * delta / HZ ; + incr =3D READ_ONCE(sysctl_icmp_msgs_per_sec) * delta / HZ; if (incr) WRITE_ONCE(icmp_global.stamp, now); } - credit =3D min_t(u32, icmp_global.credit + incr, sysctl_icmp_msgs_burst); + credit =3D min_t(u32, icmp_global.credit + incr, + READ_ONCE(sysctl_icmp_msgs_burst)); if (credit) { /* We want to use a credit of one in average, but need to randomize * it for security reasons. --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06269C433EF for ; Tue, 19 Jul 2022 12:56:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242220AbiGSM4J (ORCPT ); Tue, 19 Jul 2022 08:56:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242601AbiGSMyu (ORCPT ); Tue, 19 Jul 2022 08:54:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 120C79822F; Tue, 19 Jul 2022 05:21:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 08BD1618E6; Tue, 19 Jul 2022 12:21:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0AC1C341C6; Tue, 19 Jul 2022 12:21:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233315; bh=tbzCGK8HdhiXa0efr//XBECwdh6zNeE4FnnWpvSfh5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AdZ/5Ex0VKr6dWVVbdqzWtswjlnFuJSxiVnEzM7KxPvxaLSOYxL5mOdxHceslr/fV tPhZJdbBWEoll7LyXVru/cfzyuIgMgqKrQYjeDwx+OyL+qIsPGWDlWEnW8IRWobSYp AO9bLuNFs3m5zgCthvxJkyqCFCQ0qW3eot4VAkpI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 080/231] ipv4: Fix a data-race around sysctl_fib_sync_mem. Date: Tue, 19 Jul 2022 13:52:45 +0200 Message-Id: <20220719114721.604623907@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 73318c4b7dbd0e781aaababff17376b2894745c0 ] While reading sysctl_fib_sync_mem, it can be changed concurrently. So, we need to add READ_ONCE() to avoid a data-race. Fixes: 9ab948a91b2c ("ipv4: Allow amount of dirty memory from fib resizing = to be controllable") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/fib_trie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index fb0e49c36c2e..43a496272227 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -498,7 +498,7 @@ static void tnode_free(struct key_vector *tn) tn =3D container_of(head, struct tnode, rcu)->kv; } =20 - if (tnode_free_size >=3D sysctl_fib_sync_mem) { + if (tnode_free_size >=3D READ_ONCE(sysctl_fib_sync_mem)) { tnode_free_size =3D 0; synchronize_rcu(); } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75F39C43334 for ; Tue, 19 Jul 2022 12:56:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242272AbiGSM4O (ORCPT ); Tue, 19 Jul 2022 08:56:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242049AbiGSMy4 (ORCPT ); Tue, 19 Jul 2022 08:54:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDED097D70; Tue, 19 Jul 2022 05:22:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7AF20B81B13; Tue, 19 Jul 2022 12:21:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8CB2C341CB; Tue, 19 Jul 2022 12:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233318; bh=3+GpmsBJDlY0YGoiJxd0UgdNwZMUW7U49env2B5+uXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1z2JXkPng4sxSkb68kfUOmNu5VPl6ZzuH3l1WJgW4WxbSv8fD4roln0s8t8jO8rg0 HVixktAThFNk2HZyWROyw7AenImyVtfFTXcOED43LURFBTaQiagx59HUk60mNmGARd ri2ShwFFQZXz3rmlynjYv0zdHo793Hw6KTdZBztQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryan Wanner , Claudiu Beznea , Sasha Levin Subject: [PATCH 5.18 081/231] ARM: dts: at91: sama5d2: Fix typo in i2s1 node Date: Tue, 19 Jul 2022 13:52:46 +0200 Message-Id: <20220719114721.688189142@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ryan Wanner [ Upstream commit 2fdf15b50a46e366740df4cccbe2343269b4ff55 ] Fix typo in i2s1 causing errors in dt binding validation. Change assigned-parrents to assigned-clock-parents to match i2s0 node formatting. Fixes: 1ca81883c557 ("ARM: dts: at91: sama5d2: add nodes for I2S controller= s") Signed-off-by: Ryan Wanner [claudiu.beznea: use imperative addressing in commit description, remove blank line after fixes tag, fix typo in commit message] Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220707215812.193008-1-Ryan.Wanner@microch= ip.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/boot/dts/sama5d2.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index 89c71d419f82..659a17fc755c 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -1124,7 +1124,7 @@ AT91_XDMAC_DT_PERID(33))>, clocks =3D <&pmc PMC_TYPE_PERIPHERAL 55>, <&pmc PMC_TYPE_GCK 55>; clock-names =3D "pclk", "gclk"; assigned-clocks =3D <&pmc PMC_TYPE_CORE PMC_I2S1_MUX>; - assigned-parrents =3D <&pmc PMC_TYPE_GCK 55>; + assigned-clock-parents =3D <&pmc PMC_TYPE_GCK 55>; status =3D "disabled"; }; =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6A08C43334 for ; Tue, 19 Jul 2022 12:56:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242231AbiGSM4R (ORCPT ); Tue, 19 Jul 2022 08:56:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242114AbiGSMy5 (ORCPT ); Tue, 19 Jul 2022 08:54:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83F2699645; Tue, 19 Jul 2022 05:22:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F05A161632; Tue, 19 Jul 2022 12:22:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBD4FC341C6; Tue, 19 Jul 2022 12:22:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233321; bh=fr9eRr9LYNLPJAml2G3Qm16Rayd/ibjXZQcpvaqCjY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UV8lbnjyWl/Jhxfws4XvQKi80BpZs0AO3Xr7TDP2BTuSuuJiR0EZUZLYe6NgJ+J6v 6vtGkWD4vW7mT3OvokIeaRvEWUSvlGohUWMI3Dj1FCad6vu0Uq8qS5taYh7AE2MuVt TERO7OhC9dpCM0IYeHV779L8R6U+m8ZdpvQnA8GY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Suchanek , Jernej Skrabec , Sasha Levin Subject: [PATCH 5.18 082/231] ARM: dts: sunxi: Fix SPI NOR campatible on Orange Pi Zero Date: Tue, 19 Jul 2022 13:52:47 +0200 Message-Id: <20220719114721.762527290@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Suchanek [ Upstream commit 884b66976a7279ee889ba885fe364244d50b79e7 ] The device tree should include generic "jedec,spi-nor" compatible, and a manufacturer-specific one. The macronix part is what is shipped on the boards that come with a flash chip. Fixes: 45857ae95478 ("ARM: dts: orange-pi-zero: add node for SPI NOR") Signed-off-by: Michal Suchanek Acked-by: Jernej Skrabec Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220708174529.3360-1-msuchanek@suse.de Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts b/arch/arm/b= oot/dts/sun8i-h2-plus-orangepi-zero.dts index f19ed981da9d..3706216ffb40 100644 --- a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts @@ -169,7 +169,7 @@ &spi0 { flash@0 { #address-cells =3D <1>; #size-cells =3D <1>; - compatible =3D "mxicy,mx25l1606e", "winbond,w25q128"; + compatible =3D "mxicy,mx25l1606e", "jedec,spi-nor"; reg =3D <0>; spi-max-frequency =3D <40000000>; }; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED58CC43334 for ; Tue, 19 Jul 2022 12:56:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242256AbiGSM4X (ORCPT ); Tue, 19 Jul 2022 08:56:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242179AbiGSMzB (ORCPT ); Tue, 19 Jul 2022 08:55:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C310D99647; Tue, 19 Jul 2022 05:22:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E11CC618C1; Tue, 19 Jul 2022 12:22:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 979FEC341C6; Tue, 19 Jul 2022 12:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233324; bh=gTAyIIWfVvcGQ/wzA1TZPu6SnMzXCc/djoWkchmhfY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EpMlH2lLJOg7Huczumqfl2RGPW2VoBszJai5CX1WjTFzQI5S5XwSpfgsJlQ1ybaBf 6P0MeNEZxCobhuYv9oEwca3kW54nzCrc9RrtjVY9eZylLsxiJWt+fC+HBZmT1mn7gr OMnAj4jNTlzY1QWR34cbzDWZ3ljluHy55rBcf+kg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, William Zhang , Florian Fainelli , Sasha Levin Subject: [PATCH 5.18 083/231] arm64: dts: broadcom: bcm4908: Fix timer node for BCM4906 SoC Date: Tue, 19 Jul 2022 13:52:48 +0200 Message-Id: <20220719114721.833980298@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Zhang [ Upstream commit b4a544e415e9be33b37d9bfa9d9f9f4d13f553d6 ] The cpu mask value in interrupt property inherits from bcm4908.dtsi which sets to four cpus. Correct the value to two cpus for dual core BCM4906 SoC. Fixes: c8b404fb05dc ("arm64: dts: broadcom: bcm4908: add BCM4906 Netgear R8= 000P DTS files") Signed-off-by: William Zhang Signed-off-by: Florian Fainelli Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm64/boot/dts/broadcom/bcm4908/bcm4906.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906.dtsi b/arch/arm64= /boot/dts/broadcom/bcm4908/bcm4906.dtsi index 66023d553524..d084c33d5ca8 100644 --- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906.dtsi @@ -9,6 +9,14 @@ cpus { /delete-node/ cpu@3; }; =20 + timer { + compatible =3D "arm,armv8-timer"; + interrupts =3D , + , + , + ; + }; + pmu { compatible =3D "arm,cortex-a53-pmu"; interrupts =3D , --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A309C433EF for ; Tue, 19 Jul 2022 12:56:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242279AbiGSM41 (ORCPT ); Tue, 19 Jul 2022 08:56:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242226AbiGSMzT (ORCPT ); Tue, 19 Jul 2022 08:55:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38BDB9823F; Tue, 19 Jul 2022 05:22:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D8CB56177D; Tue, 19 Jul 2022 12:22:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A62D0C341CA; Tue, 19 Jul 2022 12:22:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233327; bh=NiPU0w4OCUfUSJ6Q5Kk8g7EVke2HETspl8rD2SltnnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OYkIJ/Y0HLs3AbRIVmkaEwTvbYLWIKkBfz37qU/VoG4EN6HJRTNPCBFcXTvfuqQzI uy2lIIs4d6PZY8ZXtYIbal8o0DIFpk32B+QnIP3UCJ7rj3/FtetjlVMi74ud5O/AYQ UBHZX6nUl0Wi5wfabPUrXIpd1cdMC/mVMLqU+BLg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, William Zhang , Florian Fainelli , Sasha Levin Subject: [PATCH 5.18 084/231] arm64: dts: broadcom: bcm4908: Fix cpu node for smp boot Date: Tue, 19 Jul 2022 13:52:49 +0200 Message-Id: <20220719114721.904833629@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Zhang [ Upstream commit 8bd582ae9a71d7f14c4e0c735b2eacaf7516d626 ] Add spin-table enable-method and cpu-release-addr properties for cpu0 node. This is required by all ARMv8 SoC. Otherwise some bootloader like u-boot can not update cpu-release-addr and linux fails to start up secondary cpus. Fixes: 2961f69f151c ("arm64: dts: broadcom: add BCM4908 and Asus GT-AC5300 = early DTS files") Signed-off-by: William Zhang Signed-off-by: Florian Fainelli Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi b/arch/arm64= /boot/dts/broadcom/bcm4908/bcm4908.dtsi index a4be040a00c0..967d2cd3c3ce 100644 --- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi @@ -29,6 +29,8 @@ cpu0: cpu@0 { device_type =3D "cpu"; compatible =3D "brcm,brahma-b53"; reg =3D <0x0>; + enable-method =3D "spin-table"; + cpu-release-addr =3D <0x0 0xfff8>; next-level-cache =3D <&l2>; }; =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 266B3C433EF for ; Tue, 19 Jul 2022 12:56:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242357AbiGSM4a (ORCPT ); Tue, 19 Jul 2022 08:56:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242282AbiGSMzd (ORCPT ); Tue, 19 Jul 2022 08:55:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC6569A5C2; Tue, 19 Jul 2022 05:22:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A999B61632; Tue, 19 Jul 2022 12:22:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B045C341C6; Tue, 19 Jul 2022 12:22:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233329; bh=Y5ulbQkpBh1mvGqG++QTnnact+0szAuiE1B9TbrCcZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0glW1TEmAO5ALk9+uVIfC3YB2D6G3ITLM573cYApwG7eZtePNomfIjgFN0CjgHZNF rBVf31fg7XS9E8CJmewGdkVJOhJPaqicVowm1cUhjKtGx2CjWJOAWrrdnEC7wCdBrB PQC9/7aiMe8ZTGryXfniMT997Gbyvp2moqDfLpGo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Yan , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.18 085/231] netfilter: nf_log: incorrect offset to network header Date: Tue, 19 Jul 2022 13:52:50 +0200 Message-Id: <20220719114721.974291914@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pablo Neira Ayuso [ Upstream commit 7a847c00eeba9744353ecdfad253143b9115678a ] NFPROTO_ARP is expecting to find the ARP header at the network offset. In the particular case of ARP, HTYPE=3D field shows the initial bytes of the ethernet header destination MAC address. netdev out: IN=3D OUT=3Dbridge0 MACSRC=3Dc2:76:e5:71:e1:de MACDST=3D36:b0:= 4a:e2:72:ea MACPROTO=3D0806 ARP HTYPE=3D14000 PTYPE=3D0x4ae2 OPCODE=3D49782 NFPROTO_NETDEV egress hook is also expecting to find the IP headers at the network offset. Fixes: 35b9395104d5 ("netfilter: add generic ARP packet logger") Reported-by: Tom Yan Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/netfilter/nf_log_syslog.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/netfilter/nf_log_syslog.c b/net/netfilter/nf_log_syslog.c index 13234641cdb3..7000e069bc07 100644 --- a/net/netfilter/nf_log_syslog.c +++ b/net/netfilter/nf_log_syslog.c @@ -61,7 +61,7 @@ dump_arp_packet(struct nf_log_buf *m, unsigned int logflags; struct arphdr _arph; =20 - ah =3D skb_header_pointer(skb, 0, sizeof(_arph), &_arph); + ah =3D skb_header_pointer(skb, nhoff, sizeof(_arph), &_arph); if (!ah) { nf_log_buf_add(m, "TRUNCATED"); return; @@ -90,7 +90,7 @@ dump_arp_packet(struct nf_log_buf *m, ah->ar_pln !=3D sizeof(__be32)) return; =20 - ap =3D skb_header_pointer(skb, sizeof(_arph), sizeof(_arpp), &_arpp); + ap =3D skb_header_pointer(skb, nhoff + sizeof(_arph), sizeof(_arpp), &_ar= pp); if (!ap) { nf_log_buf_add(m, " INCOMPLETE [%zu bytes]", skb->len - sizeof(_arph)); @@ -144,7 +144,7 @@ static void nf_log_arp_packet(struct net *net, u_int8_t= pf, =20 nf_log_dump_packet_common(m, pf, hooknum, skb, in, out, loginfo, prefix); - dump_arp_packet(m, loginfo, skb, 0); + dump_arp_packet(m, loginfo, skb, skb_network_offset(skb)); =20 nf_log_buf_close(m); } @@ -829,7 +829,7 @@ static void nf_log_ip_packet(struct net *net, u_int8_t = pf, if (in) dump_ipv4_mac_header(m, loginfo, skb); =20 - dump_ipv4_packet(net, m, loginfo, skb, 0); + dump_ipv4_packet(net, m, loginfo, skb, skb_network_offset(skb)); =20 nf_log_buf_close(m); } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1A1CC433EF for ; Tue, 19 Jul 2022 12:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242160AbiGSM4k (ORCPT ); Tue, 19 Jul 2022 08:56:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242100AbiGSMzs (ORCPT ); Tue, 19 Jul 2022 08:55:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81F4E4D833; Tue, 19 Jul 2022 05:22:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 96BA16177D; Tue, 19 Jul 2022 12:22:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 664AFC341C6; Tue, 19 Jul 2022 12:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233332; bh=//5AZjtwiCSLnW9fEPDNldUcgJn2J5C6jZWQwKamqco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zzqBXRNxRxo5f5SXo24vA4bleGvo+Q07aUpNicHkDOixX0gxkxA7aVSWSQW7Ql7JI thBcVVHGkTxF1VOf46E1CVOrB9UKoTx9MIY8wMzw1N5ctMrPFV5MVrim54R6WEKDZy ZICX3V+eB1RTs9yLDsSYBI9YuXLK0JEFy47rnUn8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baowen Zheng , Louis Peens , Simon Horman , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 086/231] nfp: fix issue of skb segments exceeds descriptor limitation Date: Tue, 19 Jul 2022 13:52:51 +0200 Message-Id: <20220719114722.043871831@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baowen Zheng [ Upstream commit 9c840d5f9aaef87e65db900bae21c70b059aba5f ] TCP packets will be dropped if the segments number in the tx skb exceeds limitation when sending iperf3 traffic with --zerocopy option. we make the following changes: Get nr_frags in nfp_nfdk_tx_maybe_close_block instead of passing from outside because it will be changed after skb_linearize operation. Fill maximum dma_len in first tx descriptor to make sure the whole head is included in the first descriptor. Fixes: c10d12e3dce8 ("nfp: add support for NFDK data path") Signed-off-by: Baowen Zheng Reviewed-by: Louis Peens Signed-off-by: Simon Horman Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/netronome/nfp/nfdk/dp.c | 33 +++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfdk/dp.c b/drivers/net/eth= ernet/netronome/nfp/nfdk/dp.c index e509d6dcba5c..805071d64a20 100644 --- a/drivers/net/ethernet/netronome/nfp/nfdk/dp.c +++ b/drivers/net/ethernet/netronome/nfp/nfdk/dp.c @@ -125,17 +125,18 @@ nfp_nfdk_tx_csum(struct nfp_net_dp *dp, struct nfp_ne= t_r_vector *r_vec, =20 static int nfp_nfdk_tx_maybe_close_block(struct nfp_net_tx_ring *tx_ring, - unsigned int nr_frags, struct sk_buff *skb) + struct sk_buff *skb) { unsigned int n_descs, wr_p, nop_slots; const skb_frag_t *frag, *fend; struct nfp_nfdk_tx_desc *txd; + unsigned int nr_frags; unsigned int wr_idx; int err; =20 recount_descs: n_descs =3D nfp_nfdk_headlen_to_segs(skb_headlen(skb)); - + nr_frags =3D skb_shinfo(skb)->nr_frags; frag =3D skb_shinfo(skb)->frags; fend =3D frag + nr_frags; for (; frag < fend; frag++) @@ -281,10 +282,13 @@ netdev_tx_t nfp_nfdk_tx(struct sk_buff *skb, struct n= et_device *netdev) if (unlikely((int)metadata < 0)) goto err_flush; =20 - nr_frags =3D skb_shinfo(skb)->nr_frags; - if (nfp_nfdk_tx_maybe_close_block(tx_ring, nr_frags, skb)) + if (nfp_nfdk_tx_maybe_close_block(tx_ring, skb)) goto err_flush; =20 + /* nr_frags will change after skb_linearize so we get nr_frags after + * nfp_nfdk_tx_maybe_close_block function + */ + nr_frags =3D skb_shinfo(skb)->nr_frags; /* DMA map all */ wr_idx =3D D_IDX(tx_ring, tx_ring->wr_p); txd =3D &tx_ring->ktxds[wr_idx]; @@ -310,7 +314,16 @@ netdev_tx_t nfp_nfdk_tx(struct sk_buff *skb, struct ne= t_device *netdev) =20 /* FIELD_PREP() implicitly truncates to chunk */ dma_len -=3D 1; - dlen_type =3D FIELD_PREP(NFDK_DESC_TX_DMA_LEN_HEAD, dma_len) | + + /* We will do our best to pass as much data as we can in descriptor + * and we need to make sure the first descriptor includes whole head + * since there is limitation in firmware side. Sometimes the value of + * dma_len bitwise and NFDK_DESC_TX_DMA_LEN_HEAD will less than + * headlen. + */ + dlen_type =3D FIELD_PREP(NFDK_DESC_TX_DMA_LEN_HEAD, + dma_len > NFDK_DESC_TX_DMA_LEN_HEAD ? + NFDK_DESC_TX_DMA_LEN_HEAD : dma_len) | FIELD_PREP(NFDK_DESC_TX_TYPE_HEAD, type); =20 txd->dma_len_type =3D cpu_to_le16(dlen_type); @@ -925,7 +938,9 @@ nfp_nfdk_tx_xdp_buf(struct nfp_net_dp *dp, struct nfp_n= et_rx_ring *rx_ring, =20 /* FIELD_PREP() implicitly truncates to chunk */ dma_len -=3D 1; - dlen_type =3D FIELD_PREP(NFDK_DESC_TX_DMA_LEN_HEAD, dma_len) | + dlen_type =3D FIELD_PREP(NFDK_DESC_TX_DMA_LEN_HEAD, + dma_len > NFDK_DESC_TX_DMA_LEN_HEAD ? + NFDK_DESC_TX_DMA_LEN_HEAD : dma_len) | FIELD_PREP(NFDK_DESC_TX_TYPE_HEAD, type); =20 txd->dma_len_type =3D cpu_to_le16(dlen_type); @@ -1303,7 +1318,7 @@ nfp_nfdk_ctrl_tx_one(struct nfp_net *nn, struct nfp_n= et_r_vector *r_vec, skb_push(skb, 4)); } =20 - if (nfp_nfdk_tx_maybe_close_block(tx_ring, 0, skb)) + if (nfp_nfdk_tx_maybe_close_block(tx_ring, skb)) goto err_free; =20 /* DMA map all */ @@ -1328,7 +1343,9 @@ nfp_nfdk_ctrl_tx_one(struct nfp_net *nn, struct nfp_n= et_r_vector *r_vec, txbuf++; =20 dma_len -=3D 1; - dlen_type =3D FIELD_PREP(NFDK_DESC_TX_DMA_LEN_HEAD, dma_len) | + dlen_type =3D FIELD_PREP(NFDK_DESC_TX_DMA_LEN_HEAD, + dma_len > NFDK_DESC_TX_DMA_LEN_HEAD ? + NFDK_DESC_TX_DMA_LEN_HEAD : dma_len) | FIELD_PREP(NFDK_DESC_TX_TYPE_HEAD, type); =20 txd->dma_len_type =3D cpu_to_le16(dlen_type); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB463C433EF for ; Tue, 19 Jul 2022 13:03:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242880AbiGSNDd (ORCPT ); Tue, 19 Jul 2022 09:03:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242629AbiGSM7R (ORCPT ); Tue, 19 Jul 2022 08:59:17 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84CBD9B55C; Tue, 19 Jul 2022 05:24:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 6D54CCE1BCF; Tue, 19 Jul 2022 12:24:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 253F4C341CB; Tue, 19 Jul 2022 12:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233440; bh=3sXG+VTt4xWZvQsDFeqcthLuMkGVH+7fXqtk7X35lCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mb0yolcGQBkSr9A/gYgf/h52+n5vVbERcKlhhVD5AZCH/VP42sEAZWanlHCTwyHNh jWG40tbKp/b/OoKyTo5iUuchaIHobmXwI4qONYtYY/DD3nHLaPk1jkECcBWMvxXvuO NLFjghiQ3T13uBisHgR/+tuCtJwKxAYquqagnq9M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Eric Dumazet , Xin Long , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 087/231] vlan: fix memory leak in vlan_newlink() Date: Tue, 19 Jul 2022 13:52:52 +0200 Message-Id: <20220719114722.113428923@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet [ Upstream commit 72a0b329114b1caa8e69dfa7cdad1dd3c69b8602 ] Blamed commit added back a bug I fixed in commit 9bbd917e0bec ("vlan: fix memory leak in vlan_dev_set_egress_priority") If a memory allocation fails in vlan_changelink() after other allocations succeeded, we need to call vlan_dev_free_egress_priority() to free all allocated memory because after a failed ->newlink() we do not call any methods like ndo_uninit() or dev->priv_destructor(). In following example, if the allocation for last element 2000:2001 fails, we need to free eight prior allocations: ip link add link dummy0 dummy0.100 type vlan id 100 \ egress-qos-map 1:2 2:3 3:4 4:5 5:6 6:7 7:8 8:9 2000:2001 syzbot report was: BUG: memory leak unreferenced object 0xffff888117bd1060 (size 32): comm "syz-executor408", pid 3759, jiffies 4294956555 (age 34.090s) hex dump (first 32 bytes): 09 00 00 00 00 a0 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [] kmalloc include/linux/slab.h:600 [inline] [] vlan_dev_set_egress_priority+0xed/0x170 net/8021q/vlan= _dev.c:193 [] vlan_changelink+0x178/0x1d0 net/8021q/vlan_netlink.c:1= 28 [] vlan_newlink+0x148/0x260 net/8021q/vlan_netlink.c:185 [] rtnl_newlink_create net/core/rtnetlink.c:3363 [inline] [] __rtnl_newlink+0xa58/0xdc0 net/core/rtnetlink.c:3580 [] rtnl_newlink+0x49/0x70 net/core/rtnetlink.c:3593 [] rtnetlink_rcv_msg+0x21c/0x5c0 net/core/rtnetlink.c:6089 [] netlink_rcv_skb+0x87/0x1d0 net/netlink/af_netlink.c:25= 01 [] netlink_unicast_kernel net/netlink/af_netlink.c:1319 [= inline] [] netlink_unicast+0x397/0x4c0 net/netlink/af_netlink.c:1= 345 [] netlink_sendmsg+0x396/0x710 net/netlink/af_netlink.c:1= 921 [] sock_sendmsg_nosec net/socket.c:714 [inline] [] sock_sendmsg+0x56/0x80 net/socket.c:734 [] ____sys_sendmsg+0x36c/0x390 net/socket.c:2488 [] ___sys_sendmsg+0x8b/0xd0 net/socket.c:2542 [] __sys_sendmsg net/socket.c:2571 [inline] [] __do_sys_sendmsg net/socket.c:2580 [inline] [] __se_sys_sendmsg net/socket.c:2578 [inline] [] __x64_sys_sendmsg+0x78/0xf0 net/socket.c:2578 [] do_syscall_x64 arch/x86/entry/common.c:50 [inline] [] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 [] entry_SYSCALL_64_after_hwframe+0x46/0xb0 Fixes: 37aa50c539bc ("vlan: introduce vlan_dev_free_egress_priority") Reported-by: syzbot Signed-off-by: Eric Dumazet Cc: Xin Long Reviewed-by: Xin Long Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/8021q/vlan_netlink.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c index 53b1955b027f..214532173536 100644 --- a/net/8021q/vlan_netlink.c +++ b/net/8021q/vlan_netlink.c @@ -182,10 +182,14 @@ static int vlan_newlink(struct net *src_net, struct n= et_device *dev, else if (dev->mtu > max_mtu) return -EINVAL; =20 + /* Note: If this initial vlan_changelink() fails, we need + * to call vlan_dev_free_egress_priority() to free memory. + */ err =3D vlan_changelink(dev, tb, data, extack); - if (err) - return err; - err =3D register_vlan_dev(dev, extack); + + if (!err) + err =3D register_vlan_dev(dev, extack); + if (err) vlan_dev_free_egress_priority(dev); return err; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1066BC43334 for ; Tue, 19 Jul 2022 12:57:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242432AbiGSM5U (ORCPT ); Tue, 19 Jul 2022 08:57:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242317AbiGSM4j (ORCPT ); Tue, 19 Jul 2022 08:56:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78A325C951; Tue, 19 Jul 2022 05:22:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D1969618CF; Tue, 19 Jul 2022 12:22:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AABD5C341C6; Tue, 19 Jul 2022 12:22:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233359; bh=TxSvIfCPAWAUFoR92x9f5Kk9Nbz45mlHnmPjtMhuEKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JVUogf3i5tJd8UEo7qnZ1TJ7qqvLThrKRCUeo8p7YGwTTSkFHDtbzEZEB8vUPuaT8 xuJKZ/o/E+ujWDgJhrXyU6ZtvGkeweTwu5sgfis8JsA8FGAvGNmVbIRBtnAAA26JC5 noxnwn+LSCo+IvQfZBOnSS1wYG43uByzfShJ1+bY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.18 088/231] netfilter: nf_tables: replace BUG_ON by element length check Date: Tue, 19 Jul 2022 13:52:53 +0200 Message-Id: <20220719114722.184024484@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pablo Neira Ayuso [ Upstream commit c39ba4de6b0a843bec5d46c2b6f2064428dada5e ] BUG_ON can be triggered from userspace with an element with a large userdata area. Replace it by length check and return EINVAL instead. Over time extensions have been growing in size. Pick a sufficiently old Fixes: tag to propagate this fix. Fixes: 7d7402642eaf ("netfilter: nf_tables: variable sized set element keys= / data") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/net/netfilter/nf_tables.h | 14 ++++--- net/netfilter/nf_tables_api.c | 72 ++++++++++++++++++++++++++-------= ----- 2 files changed, 60 insertions(+), 26 deletions(-) --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h @@ -657,18 +657,22 @@ static inline void nft_set_ext_prepare(s tmpl->len =3D sizeof(struct nft_set_ext); } =20 -static inline void nft_set_ext_add_length(struct nft_set_ext_tmpl *tmpl, u= 8 id, - unsigned int len) +static inline int nft_set_ext_add_length(struct nft_set_ext_tmpl *tmpl, u8= id, + unsigned int len) { tmpl->len =3D ALIGN(tmpl->len, nft_set_ext_types[id].align); - BUG_ON(tmpl->len > U8_MAX); + if (tmpl->len > U8_MAX) + return -EINVAL; + tmpl->offset[id] =3D tmpl->len; tmpl->len +=3D nft_set_ext_types[id].len + len; + + return 0; } =20 -static inline void nft_set_ext_add(struct nft_set_ext_tmpl *tmpl, u8 id) +static inline int nft_set_ext_add(struct nft_set_ext_tmpl *tmpl, u8 id) { - nft_set_ext_add_length(tmpl, id, 0); + return nft_set_ext_add_length(tmpl, id, 0); } =20 static inline void nft_set_ext_init(struct nft_set_ext *ext, --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -5831,8 +5831,11 @@ static int nft_add_set_elem(struct nft_c if (!nla[NFTA_SET_ELEM_KEY] && !(flags & NFT_SET_ELEM_CATCHALL)) return -EINVAL; =20 - if (flags !=3D 0) - nft_set_ext_add(&tmpl, NFT_SET_EXT_FLAGS); + if (flags !=3D 0) { + err =3D nft_set_ext_add(&tmpl, NFT_SET_EXT_FLAGS); + if (err < 0) + return err; + } =20 if (set->flags & NFT_SET_MAP) { if (nla[NFTA_SET_ELEM_DATA] =3D=3D NULL && @@ -5941,7 +5944,9 @@ static int nft_add_set_elem(struct nft_c if (err < 0) goto err_set_elem_expr; =20 - nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY, set->klen); + err =3D nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY, set->klen); + if (err < 0) + goto err_parse_key; } =20 if (nla[NFTA_SET_ELEM_KEY_END]) { @@ -5950,22 +5955,31 @@ static int nft_add_set_elem(struct nft_c if (err < 0) goto err_parse_key; =20 - nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY_END, set->klen); + err =3D nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY_END, set->klen); + if (err < 0) + goto err_parse_key_end; } =20 if (timeout > 0) { - nft_set_ext_add(&tmpl, NFT_SET_EXT_EXPIRATION); - if (timeout !=3D set->timeout) - nft_set_ext_add(&tmpl, NFT_SET_EXT_TIMEOUT); + err =3D nft_set_ext_add(&tmpl, NFT_SET_EXT_EXPIRATION); + if (err < 0) + goto err_parse_key_end; + + if (timeout !=3D set->timeout) { + err =3D nft_set_ext_add(&tmpl, NFT_SET_EXT_TIMEOUT); + if (err < 0) + goto err_parse_key_end; + } } =20 if (num_exprs) { for (i =3D 0; i < num_exprs; i++) size +=3D expr_array[i]->ops->size; =20 - nft_set_ext_add_length(&tmpl, NFT_SET_EXT_EXPRESSIONS, - sizeof(struct nft_set_elem_expr) + - size); + err =3D nft_set_ext_add_length(&tmpl, NFT_SET_EXT_EXPRESSIONS, + sizeof(struct nft_set_elem_expr) + size); + if (err < 0) + goto err_parse_key_end; } =20 if (nla[NFTA_SET_ELEM_OBJREF] !=3D NULL) { @@ -5980,7 +5994,9 @@ static int nft_add_set_elem(struct nft_c err =3D PTR_ERR(obj); goto err_parse_key_end; } - nft_set_ext_add(&tmpl, NFT_SET_EXT_OBJREF); + err =3D nft_set_ext_add(&tmpl, NFT_SET_EXT_OBJREF); + if (err < 0) + goto err_parse_key_end; } =20 if (nla[NFTA_SET_ELEM_DATA] !=3D NULL) { @@ -6014,7 +6030,9 @@ static int nft_add_set_elem(struct nft_c NFT_VALIDATE_NEED); } =20 - nft_set_ext_add_length(&tmpl, NFT_SET_EXT_DATA, desc.len); + err =3D nft_set_ext_add_length(&tmpl, NFT_SET_EXT_DATA, desc.len); + if (err < 0) + goto err_parse_data; } =20 /* The full maximum length of userdata can exceed the maximum @@ -6024,9 +6042,12 @@ static int nft_add_set_elem(struct nft_c ulen =3D 0; if (nla[NFTA_SET_ELEM_USERDATA] !=3D NULL) { ulen =3D nla_len(nla[NFTA_SET_ELEM_USERDATA]); - if (ulen > 0) - nft_set_ext_add_length(&tmpl, NFT_SET_EXT_USERDATA, - ulen); + if (ulen > 0) { + err =3D nft_set_ext_add_length(&tmpl, NFT_SET_EXT_USERDATA, + ulen); + if (err < 0) + goto err_parse_data; + } } =20 err =3D -ENOMEM; @@ -6252,8 +6273,11 @@ static int nft_del_setelem(struct nft_ct =20 nft_set_ext_prepare(&tmpl); =20 - if (flags !=3D 0) - nft_set_ext_add(&tmpl, NFT_SET_EXT_FLAGS); + if (flags !=3D 0) { + err =3D nft_set_ext_add(&tmpl, NFT_SET_EXT_FLAGS); + if (err < 0) + return err; + } =20 if (nla[NFTA_SET_ELEM_KEY]) { err =3D nft_setelem_parse_key(ctx, set, &elem.key.val, @@ -6261,16 +6285,20 @@ static int nft_del_setelem(struct nft_ct if (err < 0) return err; =20 - nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY, set->klen); + err =3D nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY, set->klen); + if (err < 0) + goto fail_elem; } =20 if (nla[NFTA_SET_ELEM_KEY_END]) { err =3D nft_setelem_parse_key(ctx, set, &elem.key_end.val, nla[NFTA_SET_ELEM_KEY_END]); if (err < 0) - return err; + goto fail_elem; =20 - nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY_END, set->klen); + err =3D nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY_END, set->klen); + if (err < 0) + goto fail_elem_key_end; } =20 err =3D -ENOMEM; @@ -6278,7 +6306,7 @@ static int nft_del_setelem(struct nft_ct elem.key_end.val.data, NULL, 0, 0, GFP_KERNEL_ACCOUNT); if (elem.priv =3D=3D NULL) - goto fail_elem; + goto fail_elem_key_end; =20 ext =3D nft_set_elem_ext(set, elem.priv); if (flags) @@ -6302,6 +6330,8 @@ fail_ops: kfree(trans); fail_trans: kfree(elem.priv); +fail_elem_key_end: + nft_data_release(&elem.key_end.val, NFT_DATA_VALUE); fail_elem: nft_data_release(&elem.key.val, NFT_DATA_VALUE); return err; From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81AC3CCA47F for ; Tue, 19 Jul 2022 12:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242483AbiGSM6e (ORCPT ); Tue, 19 Jul 2022 08:58:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242477AbiGSM5p (ORCPT ); Tue, 19 Jul 2022 08:57:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1A085C9FB; Tue, 19 Jul 2022 05:23:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A0C3B81B1A; Tue, 19 Jul 2022 12:23:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B988C341CA; Tue, 19 Jul 2022 12:23:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233391; bh=ZEvhBsiFb0MsBA5AbLVJ+Wg+sCQobeZjz46lu0goM20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OM6IzAe9YMNOQ8rekMkme+F6QeinKrR6und3ni8dTBDKWytaMQAnxVenlqWqkbL70 9LVgsdTyxItzUiJn3+q481LINzYFDXKCowOM1Dx9agkxl/ujXT3c2/yi2UJcepamds /sqWT+7NdES3Uy55PQpZQQBOZzE79ALE9ujIDdj8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bin Meng , Anup Patel , Atish Patra , Heinrich Schuchardt , Anup Patel , Sasha Levin Subject: [PATCH 5.18 089/231] RISC-V: KVM: Fix SRCU deadlock caused by kvm_riscv_check_vcpu_requests() Date: Tue, 19 Jul 2022 13:52:54 +0200 Message-Id: <20220719114722.253629343@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Anup Patel [ Upstream commit be82abe6a76ba8e76f25312566182b0f13c4fbf9 ] The kvm_riscv_check_vcpu_requests() is called with SRCU read lock held and for KVM_REQ_SLEEP request it will block the VCPU without releasing SRCU read lock. This causes KVM ioctls (such as KVM_IOEVENTFD) from other VCPUs of the same Guest/VM to hang/deadlock if there is any synchronize_srcu() or synchronize_srcu_expedited() in the path. To fix the above in kvm_riscv_check_vcpu_requests(), we should do SRCU read unlock before blocking the VCPU and do SRCU read lock after VCPU wakeup. Fixes: cce69aff689e ("RISC-V: KVM: Implement VCPU interrupts and requests h= andling") Reported-by: Bin Meng Signed-off-by: Anup Patel Reviewed-by: Atish Patra Tested-by: Heinrich Schuchardt Tested-by: Bin Meng Signed-off-by: Anup Patel Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/riscv/kvm/vcpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c index 7461f964d20a..3894777bfa87 100644 --- a/arch/riscv/kvm/vcpu.c +++ b/arch/riscv/kvm/vcpu.c @@ -673,9 +673,11 @@ static void kvm_riscv_check_vcpu_requests(struct kvm_v= cpu *vcpu) =20 if (kvm_request_pending(vcpu)) { if (kvm_check_request(KVM_REQ_SLEEP, vcpu)) { + kvm_vcpu_srcu_read_unlock(vcpu); rcuwait_wait_event(wait, (!vcpu->arch.power_off) && (!vcpu->arch.pause), TASK_INTERRUPTIBLE); + kvm_vcpu_srcu_read_lock(vcpu); =20 if (vcpu->arch.power_off || vcpu->arch.pause) { /* --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ED0DCCA488 for ; Tue, 19 Jul 2022 13:01:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243291AbiGSNAy (ORCPT ); Tue, 19 Jul 2022 09:00:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242477AbiGSM6e (ORCPT ); Tue, 19 Jul 2022 08:58:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 866F95F10C; Tue, 19 Jul 2022 05:23:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1D12EB81B10; Tue, 19 Jul 2022 12:23:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 809A1C385A5; Tue, 19 Jul 2022 12:23:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233419; bh=T750x+VhZsZMYNY0oaiE3SyflqHPJnBA4N1zMOZhvHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YmTzwA0AQROWGfBZf5MFxBx9p3DgS914CRwWu6TdBZXXgQNmtIBivMXGvciQqEr1a b5bwqd44u0OGMzaxWTieeIrXHoGiQj+DdRUJO0JN6O18Ii/j6smB29IsbXSGT5YBXS vkPccuBuPUNdGVZfWPsFARZ7Nimw2Zn8zlryRBWg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrzej Hajda , Dan Carpenter , Zhenyu Wang , Sasha Levin Subject: [PATCH 5.18 090/231] drm/i915/gvt: IS_ERR() vs NULL bug in intel_gvt_update_reg_whitelist() Date: Tue, 19 Jul 2022 13:52:55 +0200 Message-Id: <20220719114722.325130692@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit e87197fbd137c888fd6c871c72fe7e89445dd015 ] The shmem_pin_map() function returns NULL, it doesn't return error pointers. Fixes: 97ea656521c8 ("drm/i915/gvt: Parse default state to update reg white= list") Reviewed-by: Andrzej Hajda Signed-off-by: Dan Carpenter Signed-off-by: Zhenyu Wang Link: http://patchwork.freedesktop.org/patch/msgid/Ysftoia2BPUyqVcD@kili Acked-by: Zhenyu Wang Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/gvt/cmd_parser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/g= vt/cmd_parser.c index 2459213b6c87..f49c1e8b8df7 100644 --- a/drivers/gpu/drm/i915/gvt/cmd_parser.c +++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c @@ -3117,9 +3117,9 @@ void intel_gvt_update_reg_whitelist(struct intel_vgpu= *vgpu) continue; =20 vaddr =3D shmem_pin_map(engine->default_state); - if (IS_ERR(vaddr)) { - gvt_err("failed to map %s->default state, err:%zd\n", - engine->name, PTR_ERR(vaddr)); + if (!vaddr) { + gvt_err("failed to map %s->default state\n", + engine->name); return; } =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB807C43334 for ; Tue, 19 Jul 2022 13:03:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242665AbiGSNDV (ORCPT ); Tue, 19 Jul 2022 09:03:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242540AbiGSM6i (ORCPT ); Tue, 19 Jul 2022 08:58:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54DB05C947; Tue, 19 Jul 2022 05:23:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 148E7B81A7F; Tue, 19 Jul 2022 12:23:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69239C341C6; Tue, 19 Jul 2022 12:23:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233422; bh=MbtqvblcDyxVBgmf+7fz/Bb/HJlp2IV/sr6R4VkWY+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T+EtxXa7EYARDOCVBu1fAj/Sr2LRG+k+cdsshGM2vfolxa/zfTpevfzZvTwPdTns/ FsTLESy638klkYFuJzs6F3VdbPrbGeKppHaUWcbMtGm9HDBWuauKBcNeAuDj9mwFH4 U4odKkGzm6ROXjFyn+QNy96q1RCAGQBqez2yyLbU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Demi Marie Obenour , Oleksandr Tyshchenko , Sasha Levin Subject: [PATCH 5.18 091/231] xen/gntdev: Ignore failure to unmap INVALID_GRANT_HANDLE Date: Tue, 19 Jul 2022 13:52:56 +0200 Message-Id: <20220719114722.395824225@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Demi Marie Obenour [ Upstream commit 166d3863231667c4f64dee72b77d1102cdfad11f ] The error paths of gntdev_mmap() can call unmap_grant_pages() even though not all of the pages have been successfully mapped. This will trigger the WARN_ON()s in __unmap_grant_pages_done(). The number of warnings can be very large; I have observed thousands of lines of warnings in the systemd journal. Avoid this problem by only warning on unmapping failure if the handle being unmapped is not INVALID_GRANT_HANDLE. The handle field of any page that was not successfully mapped will be INVALID_GRANT_HANDLE, so this catches all cases where unmapping can legitimately fail. Fixes: dbe97cff7dd9 ("xen/gntdev: Avoid blocking in unmap_grant_pages()") Cc: stable@vger.kernel.org Suggested-by: Juergen Gross Signed-off-by: Demi Marie Obenour Reviewed-by: Oleksandr Tyshchenko Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20220710230522.1563-1-demi@invisiblethingsl= ab.com Signed-off-by: Juergen Gross Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/xen/gntdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 4b56c39f766d..84b143eef395 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -396,13 +396,15 @@ static void __unmap_grant_pages_done(int result, unsigned int offset =3D data->unmap_ops - map->unmap_ops; =20 for (i =3D 0; i < data->count; i++) { - WARN_ON(map->unmap_ops[offset+i].status); + WARN_ON(map->unmap_ops[offset + i].status !=3D GNTST_okay && + map->unmap_ops[offset + i].handle !=3D INVALID_GRANT_HANDLE); pr_debug("unmap handle=3D%d st=3D%d\n", map->unmap_ops[offset+i].handle, map->unmap_ops[offset+i].status); map->unmap_ops[offset+i].handle =3D INVALID_GRANT_HANDLE; if (use_ptemod) { - WARN_ON(map->kunmap_ops[offset+i].status); + WARN_ON(map->kunmap_ops[offset + i].status !=3D GNTST_okay && + map->kunmap_ops[offset + i].handle !=3D INVALID_GRANT_HANDLE); pr_debug("kunmap handle=3D%u st=3D%d\n", map->kunmap_ops[offset+i].handle, map->kunmap_ops[offset+i].status); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5917FC433EF for ; Tue, 19 Jul 2022 13:03:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242561AbiGSND0 (ORCPT ); Tue, 19 Jul 2022 09:03:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242498AbiGSM6t (ORCPT ); Tue, 19 Jul 2022 08:58:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73F865FAC1; Tue, 19 Jul 2022 05:23:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 18CFCB81B1A; Tue, 19 Jul 2022 12:23:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BD50C341C6; Tue, 19 Jul 2022 12:23:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233425; bh=HKGprwcnT1YdPLJuQxKd7WT80DyoJdHRFOt6AchiGk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a3iK/VgCvswVxYSm3MAnwSggpAM//E1QTbIDRktbw9yGgWrKA52RRFLD+UhCUjkiU HfLYRiJ2xrWDpvgbVP0Un/vL4nxBgbBhPNilYXRdjwPZjm22WFUK2SjFWDqsIqVAsA pVZJzO/kHQtFk/R/7qxo5ZM5ONrf+ImkpR/rob3c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, van fantasy , Matthieu Baerts , Mat Martineau , Paolo Abeni , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 092/231] mptcp: fix subflow traversal at disconnect time Date: Tue, 19 Jul 2022 13:52:57 +0200 Message-Id: <20220719114722.468349573@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paolo Abeni [ Upstream commit 5c835bb142d4013c2ab24bff5ae9f6709a39cbcf ] At disconnect time the MPTCP protocol traverse the subflows list closing each of them. In some circumstances - MPJ subflow, passive MPTCP socket, the latter operation can remove the subflow from the list, invalidating the current iterator. Address the issue using the safe list traversing helper variant. Reported-by: van fantasy Fixes: b29fcfb54cd7 ("mptcp: full disconnect implementation") Tested-by: Matthieu Baerts Reviewed-by: Mat Martineau Signed-off-by: Paolo Abeni Signed-off-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/mptcp/protocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2840,12 +2840,12 @@ static void mptcp_copy_inaddrs(struct so =20 static int mptcp_disconnect(struct sock *sk, int flags) { - struct mptcp_subflow_context *subflow; + struct mptcp_subflow_context *subflow, *tmp; struct mptcp_sock *msk =3D mptcp_sk(sk); =20 inet_sk_state_store(sk, TCP_CLOSE); =20 - mptcp_for_each_subflow(msk, subflow) { + list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) { struct sock *ssk =3D mptcp_subflow_tcp_sock(subflow); =20 __mptcp_close_ssk(sk, ssk, subflow, MPTCP_CF_FASTCLOSE); From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8814C43334 for ; Tue, 19 Jul 2022 13:03:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242716AbiGSND3 (ORCPT ); Tue, 19 Jul 2022 09:03:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238580AbiGSM6v (ORCPT ); Tue, 19 Jul 2022 08:58:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E3135FAD5; Tue, 19 Jul 2022 05:23:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9D5E0618EE; Tue, 19 Jul 2022 12:23:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43A7BC341C6; Tue, 19 Jul 2022 12:23:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233428; bh=Vl4Pwnt45oXUZQsM1fX5l8ZaNSfjY4t1rnLD8VJxKg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VJyFqPRnPTd39mwl1Wy7zKVaf7QozoU5tVD+IbqD9DrtKZO1b7HMrvNaH9WpV4atU JJ3e1nvCc7UKInXQtmtsBhodRsHkTN9cpZ4lSpRbCgW4Iqf1hch5qYQJ6cL4Wpb0OQ ML58dRv+6y1aTssMo0ZRfBqBNgKopdtTKSpGmcVo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Igor Mammedov , Jeff Layton , Chuck Lever , Sasha Levin Subject: [PATCH 5.18 093/231] NFSD: Decode NFSv4 birth time attribute Date: Tue, 19 Jul 2022 13:52:58 +0200 Message-Id: <20220719114722.627670095@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chuck Lever [ Upstream commit 5b2f3e0777da2a5dd62824bbe2fdab1d12caaf8f ] NFSD has advertised support for the NFSv4 time_create attribute since commit e377a3e698fb ("nfsd: Add support for the birth time attribute"). Igor Mammedov reports that Mac OS clients attempt to set the NFSv4 birth time attribute via OPEN(CREATE) and SETATTR if the server indicates that it supports it, but since the above commit was merged, those attempts now fail. Table 5 in RFC 8881 lists the time_create attribute as one that can be both set and retrieved, but the above commit did not add server support for clients to provide a time_create attribute. IMO that's a bug in our implementation of the NFSv4 protocol, which this commit addresses. Whether NFSD silently ignores the new birth time or actually sets it is another matter. I haven't found another filesystem service in the Linux kernel that enables users or clients to modify a file's birth time attribute. This commit reflects my (perhaps incorrect) understanding of whether Linux users can set a file's birth time. NFSD will now recognize a time_create attribute but it ignores its value. It clears the time_create bit in the returned attribute bitmask to indicate that the value was not used. Reported-by: Igor Mammedov Fixes: e377a3e698fb ("nfsd: Add support for the birth time attribute") Tested-by: Igor Mammedov Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/nfsd/nfs4xdr.c | 9 +++++++++ fs/nfsd/nfsd.h | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index da92e7d2ab6a..264c3a4629c9 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -470,6 +470,15 @@ nfsd4_decode_fattr4(struct nfsd4_compoundargs *argp, u= 32 *bmval, u32 bmlen, return nfserr_bad_xdr; } } + if (bmval[1] & FATTR4_WORD1_TIME_CREATE) { + struct timespec64 ts; + + /* No Linux filesystem supports setting this attribute. */ + bmval[1] &=3D ~FATTR4_WORD1_TIME_CREATE; + status =3D nfsd4_decode_nfstime4(argp, &ts); + if (status) + return status; + } if (bmval[1] & FATTR4_WORD1_TIME_MODIFY_SET) { u32 set_it; =20 diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h index 4fc1fd639527..727754d56243 100644 --- a/fs/nfsd/nfsd.h +++ b/fs/nfsd/nfsd.h @@ -460,7 +460,8 @@ static inline bool nfsd_attrs_supported(u32 minorversio= n, const u32 *bmval) (FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL) #define NFSD_WRITEABLE_ATTRS_WORD1 \ (FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ - | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) + | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_CREATE \ + | FATTR4_WORD1_TIME_MODIFY_SET) #ifdef CONFIG_NFSD_V4_SECURITY_LABEL #define MAYBE_FATTR4_WORD2_SECURITY_LABEL \ FATTR4_WORD2_SECURITY_LABEL --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF00FCCA487 for ; Tue, 19 Jul 2022 13:01:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243318AbiGSNA5 (ORCPT ); Tue, 19 Jul 2022 09:00:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242584AbiGSM7A (ORCPT ); Tue, 19 Jul 2022 08:59:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 445E95FAE8; Tue, 19 Jul 2022 05:23:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EA150B81B1A; Tue, 19 Jul 2022 12:23:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45F22C341CA; Tue, 19 Jul 2022 12:23:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233431; bh=JriZhhJjPKNaYLWd2CCG/ku0GwfO97kleLtUwigctRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=beY15vkbd5OfAWPNV7Its60GzyAe/Hj4a7nY9FQnDkKkNooMGSFzSMOoVmpm1vmbW UOlFhdIJn4aQN05OWauopy9aqs/u/dukqIZ0fisS8HdRkBsKoMufZ2dJxAKClOcUIg Pu/H/Lo2DR/MyZNbXwUkBAHMbtqsxUBPfwBhHuJw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "J. Bruce Fields" , Jeff Layton , Chuck Lever , Sasha Levin Subject: [PATCH 5.18 094/231] lockd: set fl_owner when unlocking files Date: Tue, 19 Jul 2022 13:52:59 +0200 Message-Id: <20220719114722.693455918@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff Layton [ Upstream commit aec158242b87a43d83322e99bc71ab4428e5ab79 ] Unlocking a POSIX lock on an inode with vfs_lock_file only works if the owner matches. Ensure we set it in the request. Cc: J. Bruce Fields Fixes: 7f024fcd5c97 ("Keep read and write fds with each nlm_file") Signed-off-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/lockd/svcsubs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index 0a22a2faf552..b2f277727469 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c @@ -176,7 +176,7 @@ nlm_delete_file(struct nlm_file *file) } } =20 -static int nlm_unlock_files(struct nlm_file *file) +static int nlm_unlock_files(struct nlm_file *file, fl_owner_t owner) { struct file_lock lock; =20 @@ -184,6 +184,7 @@ static int nlm_unlock_files(struct nlm_file *file) lock.fl_type =3D F_UNLCK; lock.fl_start =3D 0; lock.fl_end =3D OFFSET_MAX; + lock.fl_owner =3D owner; if (file->f_file[O_RDONLY] && vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL)) goto out_err; @@ -225,7 +226,7 @@ nlm_traverse_locks(struct nlm_host *host, struct nlm_fi= le *file, if (match(lockhost, host)) { =20 spin_unlock(&flctx->flc_lock); - if (nlm_unlock_files(file)) + if (nlm_unlock_files(file, fl->fl_owner)) return 1; goto again; } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0E35CCA487 for ; Tue, 19 Jul 2022 13:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238522AbiGSNA7 (ORCPT ); Tue, 19 Jul 2022 09:00:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242520AbiGSM7H (ORCPT ); Tue, 19 Jul 2022 08:59:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A8DC5FAFD; Tue, 19 Jul 2022 05:23:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7C4EA61632; Tue, 19 Jul 2022 12:23:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EA40C341C6; Tue, 19 Jul 2022 12:23:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233434; bh=Mg3fED1AAvaDbJxZHyGG4Bsb6lTRQRN91wZoWjfGKTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kHdvHQ/pf08x16sFUwmi2UNmh5HBgJtiU6xcxqmy7i7Cxn9mEqBDNZe/4052gZnih 4PAjn51MXodNpo7MP/XmjfGVhzPfdA0rr3wEHyPaw7vcyd4hJNnTICjYvJxt/cr1WC 6Iu8DKWVPToMNvJRskIYE82x5gTDBsbDGtaH1iWg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "J. Bruce Fields" , Jeff Layton , Chuck Lever , Sasha Levin Subject: [PATCH 5.18 095/231] lockd: fix nlm_close_files Date: Tue, 19 Jul 2022 13:53:00 +0200 Message-Id: <20220719114722.758879857@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff Layton [ Upstream commit 1197eb5906a5464dbaea24cac296dfc38499cc00 ] This loop condition tries a bit too hard to be clever. Just test for the two indices we care about explicitly. Cc: J. Bruce Fields Fixes: 7f024fcd5c97 ("Keep read and write fds with each nlm_file") Signed-off-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/lockd/svcsubs.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index b2f277727469..e1c4617de771 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c @@ -283,11 +283,10 @@ nlm_file_inuse(struct nlm_file *file) =20 static void nlm_close_files(struct nlm_file *file) { - struct file *f; - - for (f =3D file->f_file[0]; f <=3D file->f_file[1]; f++) - if (f) - nlmsvc_ops->fclose(f); + if (file->f_file[O_RDONLY]) + nlmsvc_ops->fclose(file->f_file[O_RDONLY]); + if (file->f_file[O_WRONLY]) + nlmsvc_ops->fclose(file->f_file[O_WRONLY]); } =20 /* --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39141C43334 for ; Tue, 19 Jul 2022 13:01:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242627AbiGSNBF (ORCPT ); Tue, 19 Jul 2022 09:01:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242607AbiGSM7N (ORCPT ); Tue, 19 Jul 2022 08:59:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49DE69B542; Tue, 19 Jul 2022 05:24:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C0517B81B1A; Tue, 19 Jul 2022 12:23:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D592C341C6; Tue, 19 Jul 2022 12:23:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233437; bh=kljyRoFz+3KUUUd3bQlrQWVQc83iAkC23StdOGnlkig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i/dP4qqdtpc/xx9BaNL5z3MYLdX6Rw3ihcXd1k7MhrDjV7ZTv7kt838ymgURAcNFe FA4GskyBD24kGMlcQvlaDwjTjdEfYwGF0qeA8U3yyPJXYMd1Gy8Cx3BRYXmNYjAh1B FxWN4JIez7k0sHSqggFTDssZk+RTXsBGx5qweHy0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yevhen Orlov , Paolo Abeni , Sasha Levin Subject: [PATCH 5.18 096/231] net: marvell: prestera: fix missed deinit sequence Date: Tue, 19 Jul 2022 13:53:01 +0200 Message-Id: <20220719114722.824466935@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yevhen Orlov [ Upstream commit f946964a9f79f8dcb5a6329265281eebfc23aee5 ] Add unregister_fib_notifier as rollback of register_fib_notifier. Fixes: 4394fbcb78cf ("net: marvell: prestera: handle fib notifications") Signed-off-by: Yevhen Orlov Link: https://lore.kernel.org/r/20220710122021.7642-1-yevhen.orlov@plvision= .eu Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/marvell/prestera/prestera_router.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_router.c b/driv= ers/net/ethernet/marvell/prestera/prestera_router.c index 6c5618cf4f08..97d9012db189 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_router.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_router.c @@ -587,6 +587,7 @@ int prestera_router_init(struct prestera_switch *sw) =20 void prestera_router_fini(struct prestera_switch *sw) { + unregister_fib_notifier(&init_net, &sw->router->fib_nb); unregister_inetaddr_notifier(&sw->router->inetaddr_nb); unregister_inetaddr_validator_notifier(&sw->router->inetaddr_valid_nb); rhashtable_destroy(&sw->router->kern_fib_cache_ht); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02312C433EF for ; Tue, 19 Jul 2022 12:57:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242440AbiGSM5Y (ORCPT ); Tue, 19 Jul 2022 08:57:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242150AbiGSM4k (ORCPT ); Tue, 19 Jul 2022 08:56:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 913399A6AA; Tue, 19 Jul 2022 05:22:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2CB79B81A7F; Tue, 19 Jul 2022 12:22:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91A6BC341C6; Tue, 19 Jul 2022 12:22:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233362; bh=RNgEKpLAZW9CrGtWagK/54Wuvr9HSc17s7AkNEZdXzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aSTpyEyczu5MF7JRYia4F08qu3JpjcQlGdDt25BfjTt5ypmNyITT06/NOb6q5gKa9 M0nfCLvUt4FArbju4IxRLL+nXG7DOOSyKXNTaTIpEtnXO0sO8od+6MmSW9Em9OAUs0 TzSV/uBKA6nafeyrvBKfmWHbfbj/bFu1rdjUgKLA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul M Stillwell Jr , Tony Nguyen , Sasha Levin , Gurucharan Subject: [PATCH 5.18 097/231] ice: handle E822 generic device ID in PLDM header Date: Tue, 19 Jul 2022 13:53:02 +0200 Message-Id: <20220719114722.891365903@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul M Stillwell Jr [ Upstream commit f52d166819a4d8e0d5cca07d8a8dd6397c96dcf1 ] The driver currently presumes that the record data in the PLDM header of the firmware image will match the device ID of the running device. This is true for E810 devices. It appears that for E822 devices that this is not guaranteed to be true. Fix this by adding a check for the generic E822 device. Fixes: d69ea414c9b4 ("ice: implement device flash update via devlink") Signed-off-by: Paul M Stillwell Jr Tested-by: Gurucharan (A Contingent worker at Int= el) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/intel/ice/ice_devids.h | 1 + .../net/ethernet/intel/ice/ice_fw_update.c | 96 ++++++++++++++++++- drivers/net/ethernet/intel/ice/ice_main.c | 1 + 3 files changed, 96 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_devids.h b/drivers/net/ethe= rnet/intel/ice/ice_devids.h index 61dd2f18dee8..b41bc3dc1745 100644 --- a/drivers/net/ethernet/intel/ice/ice_devids.h +++ b/drivers/net/ethernet/intel/ice/ice_devids.h @@ -5,6 +5,7 @@ #define _ICE_DEVIDS_H_ =20 /* Device IDs */ +#define ICE_DEV_ID_E822_SI_DFLT 0x1888 /* Intel(R) Ethernet Connection E823-L for backplane */ #define ICE_DEV_ID_E823L_BACKPLANE 0x124C /* Intel(R) Ethernet Connection E823-L for SFP */ diff --git a/drivers/net/ethernet/intel/ice/ice_fw_update.c b/drivers/net/e= thernet/intel/ice/ice_fw_update.c index 665a344fb9c0..3dc5662d62a6 100644 --- a/drivers/net/ethernet/intel/ice/ice_fw_update.c +++ b/drivers/net/ethernet/intel/ice/ice_fw_update.c @@ -736,7 +736,87 @@ static int ice_finalize_update(struct pldmfw *context) return 0; } =20 -static const struct pldmfw_ops ice_fwu_ops =3D { +struct ice_pldm_pci_record_id { + u32 vendor; + u32 device; + u32 subsystem_vendor; + u32 subsystem_device; +}; + +/** + * ice_op_pci_match_record - Check if a PCI device matches the record + * @context: PLDM fw update structure + * @record: list of records extracted from the PLDM image + * + * Determine if the PCI device associated with this device matches the rec= ord + * data provided. + * + * Searches the descriptor TLVs and extracts the relevant descriptor data = into + * a pldm_pci_record_id. This is then compared against the PCI device ID + * information. + * + * Returns: true if the device matches the record, false otherwise. + */ +static bool +ice_op_pci_match_record(struct pldmfw *context, struct pldmfw_record *reco= rd) +{ + struct pci_dev *pdev =3D to_pci_dev(context->dev); + struct ice_pldm_pci_record_id id =3D { + .vendor =3D PCI_ANY_ID, + .device =3D PCI_ANY_ID, + .subsystem_vendor =3D PCI_ANY_ID, + .subsystem_device =3D PCI_ANY_ID, + }; + struct pldmfw_desc_tlv *desc; + + list_for_each_entry(desc, &record->descs, entry) { + u16 value; + int *ptr; + + switch (desc->type) { + case PLDM_DESC_ID_PCI_VENDOR_ID: + ptr =3D &id.vendor; + break; + case PLDM_DESC_ID_PCI_DEVICE_ID: + ptr =3D &id.device; + break; + case PLDM_DESC_ID_PCI_SUBVENDOR_ID: + ptr =3D &id.subsystem_vendor; + break; + case PLDM_DESC_ID_PCI_SUBDEV_ID: + ptr =3D &id.subsystem_device; + break; + default: + /* Skip unrelated TLVs */ + continue; + } + + value =3D get_unaligned_le16(desc->data); + /* A value of zero for one of the descriptors is sometimes + * used when the record should ignore this field when matching + * device. For example if the record applies to any subsystem + * device or vendor. + */ + if (value) + *ptr =3D value; + else + *ptr =3D PCI_ANY_ID; + } + + /* the E822 device can have a generic device ID so check for that */ + if ((id.vendor =3D=3D PCI_ANY_ID || id.vendor =3D=3D pdev->vendor) && + (id.device =3D=3D PCI_ANY_ID || id.device =3D=3D pdev->device || + id.device =3D=3D ICE_DEV_ID_E822_SI_DFLT) && + (id.subsystem_vendor =3D=3D PCI_ANY_ID || + id.subsystem_vendor =3D=3D pdev->subsystem_vendor) && + (id.subsystem_device =3D=3D PCI_ANY_ID || + id.subsystem_device =3D=3D pdev->subsystem_device)) + return true; + + return false; +} + +static const struct pldmfw_ops ice_fwu_ops_e810 =3D { .match_record =3D &pldmfw_op_pci_match_record, .send_package_data =3D &ice_send_package_data, .send_component_table =3D &ice_send_component_table, @@ -744,6 +824,14 @@ static const struct pldmfw_ops ice_fwu_ops =3D { .finalize_update =3D &ice_finalize_update, }; =20 +static const struct pldmfw_ops ice_fwu_ops_e822 =3D { + .match_record =3D &ice_op_pci_match_record, + .send_package_data =3D &ice_send_package_data, + .send_component_table =3D &ice_send_component_table, + .flash_component =3D &ice_flash_component, + .finalize_update =3D &ice_finalize_update, +}; + /** * ice_get_pending_updates - Check if the component has a pending update * @pf: the PF driver structure @@ -921,7 +1009,11 @@ int ice_devlink_flash_update(struct devlink *devlink, =20 memset(&priv, 0, sizeof(priv)); =20 - priv.context.ops =3D &ice_fwu_ops; + /* the E822 device needs a slightly different ops */ + if (hw->mac_type =3D=3D ICE_MAC_GENERIC) + priv.context.ops =3D &ice_fwu_ops_e822; + else + priv.context.ops =3D &ice_fwu_ops_e810; priv.context.dev =3D dev; priv.extack =3D extack; priv.pf =3D pf; diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethern= et/intel/ice/ice_main.c index d069b19f9bf7..efb076f71e38 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -5397,6 +5397,7 @@ static const struct pci_device_id ice_pci_tbl[] =3D { { PCI_VDEVICE(INTEL, ICE_DEV_ID_E823L_10G_BASE_T), 0 }, { PCI_VDEVICE(INTEL, ICE_DEV_ID_E823L_1GBE), 0 }, { PCI_VDEVICE(INTEL, ICE_DEV_ID_E823L_QSFP), 0 }, + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E822_SI_DFLT), 0 }, /* required last entry */ { 0, } }; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15E63CCA47F for ; Tue, 19 Jul 2022 12:57:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242450AbiGSM5a (ORCPT ); Tue, 19 Jul 2022 08:57:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242173AbiGSM4m (ORCPT ); Tue, 19 Jul 2022 08:56:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 037089A6B4; Tue, 19 Jul 2022 05:22:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 91E6361632; Tue, 19 Jul 2022 12:22:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F8CCC341C6; Tue, 19 Jul 2022 12:22:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233364; bh=921mvB/gIVMmZca84WRSiz80R1gD2ZDb922HQgrDXGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WYqmuqYnktmxrYhdHgNMefnnrGbdQWTw+gIkHkzQid04/RP+Cibk0hYmXVOcHUljJ lYvAGBq9Xa4SOTMl3oIPpjyYHgQB02PqtVxpa6NE2Oycxdgw4L949a+esijULWqGO0 LhzVrmvb5H0SpomWGRxBjt28kCnjeWgek6tQUJU4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul M Stillwell Jr , Tony Nguyen , Sasha Levin , Gurucharan Subject: [PATCH 5.18 098/231] ice: change devlink code to read NVM in blocks Date: Tue, 19 Jul 2022 13:53:03 +0200 Message-Id: <20220719114722.961831691@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul M Stillwell Jr [ Upstream commit 7b6f9462a3234c35cf808453d39a074a04e71de1 ] When creating a snapshot of the NVM the driver needs to read the entire contents from the NVM and store it. The NVM reads are protected by a lock that is shared between the driver and the firmware. If the driver takes too long to read the entire NVM (which can happen on some systems) then the firmware could reclaim the lock and cause subsequent reads from the driver to fail. We could fix this by increasing the timeout that we pass to the firmware, but we could end up in the same situation again if the system is slow. Instead have the driver break the reading of the NVM into blocks that are small enough that we have confidence that the read will complete within the timeout time, but large enough not to cause significant AQ overhead. Fixes: dce730f17825 ("ice: add a devlink region for dumping NVM contents") Signed-off-by: Paul M Stillwell Jr Tested-by: Gurucharan (A Contingent worker at Int= el) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/intel/ice/ice_devlink.c | 59 +++++++++++++------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/eth= ernet/intel/ice/ice_devlink.c index 4a9de59121d8..31836bbdf813 100644 --- a/drivers/net/ethernet/intel/ice/ice_devlink.c +++ b/drivers/net/ethernet/intel/ice/ice_devlink.c @@ -792,6 +792,8 @@ void ice_devlink_destroy_vf_port(struct ice_vf *vf) devlink_port_unregister(devlink_port); } =20 +#define ICE_DEVLINK_READ_BLK_SIZE (1024 * 1024) + /** * ice_devlink_nvm_snapshot - Capture a snapshot of the NVM flash contents * @devlink: the devlink instance @@ -818,8 +820,9 @@ static int ice_devlink_nvm_snapshot(struct devlink *dev= link, struct ice_pf *pf =3D devlink_priv(devlink); struct device *dev =3D ice_pf_to_dev(pf); struct ice_hw *hw =3D &pf->hw; - void *nvm_data; - u32 nvm_size; + u8 *nvm_data, *tmp, i; + u32 nvm_size, left; + s8 num_blks; int status; =20 nvm_size =3D hw->flash.flash_size; @@ -827,26 +830,44 @@ static int ice_devlink_nvm_snapshot(struct devlink *d= evlink, if (!nvm_data) return -ENOMEM; =20 - status =3D ice_acquire_nvm(hw, ICE_RES_READ); - if (status) { - dev_dbg(dev, "ice_acquire_nvm failed, err %d aq_err %d\n", - status, hw->adminq.sq_last_status); - NL_SET_ERR_MSG_MOD(extack, "Failed to acquire NVM semaphore"); - vfree(nvm_data); - return status; - } =20 - status =3D ice_read_flat_nvm(hw, 0, &nvm_size, nvm_data, false); - if (status) { - dev_dbg(dev, "ice_read_flat_nvm failed after reading %u bytes, err %d aq= _err %d\n", - nvm_size, status, hw->adminq.sq_last_status); - NL_SET_ERR_MSG_MOD(extack, "Failed to read NVM contents"); + num_blks =3D DIV_ROUND_UP(nvm_size, ICE_DEVLINK_READ_BLK_SIZE); + tmp =3D nvm_data; + left =3D nvm_size; + + /* Some systems take longer to read the NVM than others which causes the + * FW to reclaim the NVM lock before the entire NVM has been read. Fix + * this by breaking the reads of the NVM into smaller chunks that will + * probably not take as long. This has some overhead since we are + * increasing the number of AQ commands, but it should always work + */ + for (i =3D 0; i < num_blks; i++) { + u32 read_sz =3D min_t(u32, ICE_DEVLINK_READ_BLK_SIZE, left); + + status =3D ice_acquire_nvm(hw, ICE_RES_READ); + if (status) { + dev_dbg(dev, "ice_acquire_nvm failed, err %d aq_err %d\n", + status, hw->adminq.sq_last_status); + NL_SET_ERR_MSG_MOD(extack, "Failed to acquire NVM semaphore"); + vfree(nvm_data); + return -EIO; + } + + status =3D ice_read_flat_nvm(hw, i * ICE_DEVLINK_READ_BLK_SIZE, + &read_sz, tmp, false); + if (status) { + dev_dbg(dev, "ice_read_flat_nvm failed after reading %u bytes, err %d a= q_err %d\n", + read_sz, status, hw->adminq.sq_last_status); + NL_SET_ERR_MSG_MOD(extack, "Failed to read NVM contents"); + ice_release_nvm(hw); + vfree(nvm_data); + return -EIO; + } ice_release_nvm(hw); - vfree(nvm_data); - return status; - } =20 - ice_release_nvm(hw); + tmp +=3D read_sz; + left -=3D read_sz; + } =20 *data =3D nvm_data; =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47995CCA47F for ; Tue, 19 Jul 2022 12:57:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242229AbiGSM5e (ORCPT ); Tue, 19 Jul 2022 08:57:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242328AbiGSM4n (ORCPT ); Tue, 19 Jul 2022 08:56:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E78505C962; Tue, 19 Jul 2022 05:22:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7ADF26177D; Tue, 19 Jul 2022 12:22:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4715BC341C6; Tue, 19 Jul 2022 12:22:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233367; bh=TbdUjynScr+nnVAJZyWxktS96gdnHpTb1GUq694sUlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jD3gcjzkk7xOhDU+SZp4pX+TMwwWD/vkcovqosQFDmTxKBSjs99YHQgjYv8dv2k03 19kN1yPeiBwUp7g6nXQWaWLeseqjO7cHFeN+JDwliNIZHC0lwrnIseD5i2K1maWYo2 v45Cpk549Q+LHJIaTqwt3zHg+xm7XDU6DBBFajQs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.18 099/231] tracing: Fix sleeping while atomic in kdb ftdump Date: Tue, 19 Jul 2022 13:53:04 +0200 Message-Id: <20220719114723.033189917@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Douglas Anderson [ Upstream commit 495fcec8648cdfb483b5b9ab310f3839f07cb3b8 ] If you drop into kdb and type "ftdump" you'll get a sleeping while atomic warning from memory allocation in trace_find_next_entry(). This appears to have been caused by commit ff895103a84a ("tracing: Save off entry when peeking at next entry"), which added the allocation in that path. The problematic commit was already fixed by commit 8e99cf91b99b ("tracing: Do not allocate buffer in trace_find_next_entry() in atomic") but that fix missed the kdb case. The fix here is easy: just move the assignment of the static buffer to the place where it should have been to begin with: trace_init_global_iter(). That function is called in two places, once is right before the assignment of the static buffer added by the previous fix and once is in kdb. Note that it appears that there's a second static buffer that we need to assign that was added in commit efbbdaa22bb7 ("tracing: Show real address for trace event arguments"), so we'll move that too. Link: https://lkml.kernel.org/r/20220708170919.1.I75844e5038d9425add2ad853a= 608cb44bb39df40@changeid Fixes: ff895103a84a ("tracing: Save off entry when peeking at next entry") Fixes: efbbdaa22bb7 ("tracing: Show real address for trace event arguments") Signed-off-by: Douglas Anderson Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/trace/trace.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 114c31bdf8f9..c0c98b0c86e7 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -9863,6 +9863,12 @@ void trace_init_global_iter(struct trace_iterator *i= ter) /* Output in nanoseconds only if we are using a clock in nanoseconds. */ if (trace_clocks[iter->tr->clock_id].in_ns) iter->iter_flags |=3D TRACE_FILE_TIME_IN_NS; + + /* Can not use kmalloc for iter.temp and iter.fmt */ + iter->temp =3D static_temp_buf; + iter->temp_size =3D STATIC_TEMP_BUF_SIZE; + iter->fmt =3D static_fmt_buf; + iter->fmt_size =3D STATIC_FMT_BUF_SIZE; } =20 void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) @@ -9895,11 +9901,6 @@ void ftrace_dump(enum ftrace_dump_mode oops_dump_mod= e) =20 /* Simulate the iterator */ trace_init_global_iter(&iter); - /* Can not use kmalloc for iter.temp and iter.fmt */ - iter.temp =3D static_temp_buf; - iter.temp_size =3D STATIC_TEMP_BUF_SIZE; - iter.fmt =3D static_fmt_buf; - iter.fmt_size =3D STATIC_FMT_BUF_SIZE; =20 for_each_tracing_cpu(cpu) { atomic_inc(&per_cpu_ptr(iter.array_buffer->data, cpu)->disabled); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE327C43334 for ; Tue, 19 Jul 2022 12:57:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242463AbiGSM5i (ORCPT ); Tue, 19 Jul 2022 08:57:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242373AbiGSM4p (ORCPT ); Tue, 19 Jul 2022 08:56:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D29E29A6BC; Tue, 19 Jul 2022 05:22:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 583E56177D; Tue, 19 Jul 2022 12:22:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27424C341C6; Tue, 19 Jul 2022 12:22:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233370; bh=zKIcPj/nHoDO6f2KADrbWiID08iXNMAscwYuS32iCW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IPoCtUbe8y5f5Jn7gUnUg33+RF1QbLTVn/fWjOy3cBZFRdbjJj2is/7AoSeb942z+ NQiOFY18hTQ28+bU7uPnTmE8y8D+i86rl64ZcaG+Auo5KHd3QfX8YzRVor6Kn8c0h+ jyq0vTJCbZNFWqO8hvptxnhAAxIBJI6s83HI753s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Matthew Auld , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.18 100/231] drm/i915/selftests: fix a couple IS_ERR() vs NULL tests Date: Tue, 19 Jul 2022 13:53:05 +0200 Message-Id: <20220719114723.102635040@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 896dcabd1f8f613c533d948df17408c41f8929f5 ] The shmem_pin_map() function doesn't return error pointers, it returns NULL. Fixes: be1cb55a07bf ("drm/i915/gt: Keep a no-frills swappable copy of the d= efault context state") Signed-off-by: Dan Carpenter Reviewed-by: Matthew Auld Signed-off-by: Matthew Auld Link: https://patchwork.freedesktop.org/patch/msgid/20220708094104.GL2316@k= adam (cherry picked from commit d50f5a109cf4ed50c5b575c1bb5fc3bd17b23308) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/gt/selftest_lrc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/= gt/selftest_lrc.c index 21c29d315cc0..9d42a7c67a8c 100644 --- a/drivers/gpu/drm/i915/gt/selftest_lrc.c +++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c @@ -155,8 +155,8 @@ static int live_lrc_layout(void *arg) continue; =20 hw =3D shmem_pin_map(engine->default_state); - if (IS_ERR(hw)) { - err =3D PTR_ERR(hw); + if (!hw) { + err =3D -ENOMEM; break; } hw +=3D LRC_STATE_OFFSET / sizeof(*hw); @@ -331,8 +331,8 @@ static int live_lrc_fixed(void *arg) continue; =20 hw =3D shmem_pin_map(engine->default_state); - if (IS_ERR(hw)) { - err =3D PTR_ERR(hw); + if (!hw) { + err =3D -ENOMEM; break; } hw +=3D LRC_STATE_OFFSET / sizeof(*hw); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64004C43334 for ; Tue, 19 Jul 2022 12:57:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242473AbiGSM5o (ORCPT ); Tue, 19 Jul 2022 08:57:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242238AbiGSM46 (ORCPT ); Tue, 19 Jul 2022 08:56:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E69C09B180; Tue, 19 Jul 2022 05:22:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4DA2E618CF; Tue, 19 Jul 2022 12:22:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07A36C341C6; Tue, 19 Jul 2022 12:22:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233373; bh=pNJE5Gf+Habch10E0X/gWeYItMc9ZtlV9143Podc3B0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cEsl9I8ZpCJCm8DLuUKFdYrYMfmNmxrQxN9F5Zoc/Dq2wPhGUQhHMjMVTGo5W4qX+ 8ykOLRT4ICrie4nsbfCmRnfYKC4KjKp0RcOw5g8JuOHs74a5lksGTVNwrNoBxsZQ0K KDKbhqrMnAMGrzwIrwTNtLeFzrU66GCE3q8iCNpc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Auld , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Nirmoy Das , Nirmoy Das , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.18 101/231] drm/i915/ttm: fix sg_table construction Date: Tue, 19 Jul 2022 13:53:06 +0200 Message-Id: <20220719114723.172321041@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Auld [ Upstream commit aff1e0b09b54b64944b7fe32997229552737b9e9 ] If we encounter some monster sized local-memory page that exceeds the maximum sg length (UINT32_MAX), ensure that don't end up with some misaligned address in the entry that follows, leading to fireworks later. Also ensure we have some coverage of this in the selftests. v2(Chris): - Use round_down consistently to avoid udiv errors v3(Nirmoy): - Also update the max_segment in the selftest Fixes: f701b16d4cc5 ("drm/i915/ttm: add i915_sg_from_buddy_resource") Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6379 Signed-off-by: Matthew Auld Cc: Thomas Hellstr=C3=B6m Cc: Nirmoy Das Reviewed-by: Nirmoy Das Link: https://patchwork.freedesktop.org/patch/msgid/20220711085859.24198-1-= matthew.auld@intel.com (cherry picked from commit bc99f1209f19fefa3ee11e77464ccfae541f4291) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 11 ++++++++-- drivers/gpu/drm/i915/i915_scatterlist.c | 19 +++++++++++++---- drivers/gpu/drm/i915/i915_scatterlist.h | 6 ++++-- drivers/gpu/drm/i915/intel_region_ttm.c | 10 ++++++--- drivers/gpu/drm/i915/intel_region_ttm.h | 3 ++- .../drm/i915/selftests/intel_memory_region.c | 21 +++++++++++++++++-- drivers/gpu/drm/i915/selftests/mock_region.c | 3 ++- 7 files changed, 58 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915= /gem/i915_gem_ttm.c index 45cc5837ce00..342ca303eae4 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c @@ -583,10 +583,15 @@ i915_ttm_resource_get_st(struct drm_i915_gem_object *= obj, struct ttm_resource *res) { struct ttm_buffer_object *bo =3D i915_gem_to_ttm(obj); + u64 page_alignment; =20 if (!i915_ttm_gtt_binds_lmem(res)) return i915_ttm_tt_get_st(bo->ttm); =20 + page_alignment =3D bo->page_alignment << PAGE_SHIFT; + if (!page_alignment) + page_alignment =3D obj->mm.region->min_page_size; + /* * If CPU mapping differs, we need to add the ttm_tt pages to * the resulting st. Might make sense for GGTT. @@ -597,7 +602,8 @@ i915_ttm_resource_get_st(struct drm_i915_gem_object *ob= j, struct i915_refct_sgt *rsgt; =20 rsgt =3D intel_region_ttm_resource_to_rsgt(obj->mm.region, - res); + res, + page_alignment); if (IS_ERR(rsgt)) return rsgt; =20 @@ -606,7 +612,8 @@ i915_ttm_resource_get_st(struct drm_i915_gem_object *ob= j, return i915_refct_sgt_get(obj->ttm.cached_io_rsgt); } =20 - return intel_region_ttm_resource_to_rsgt(obj->mm.region, res); + return intel_region_ttm_resource_to_rsgt(obj->mm.region, res, + page_alignment); } =20 static int i915_ttm_truncate(struct drm_i915_gem_object *obj) diff --git a/drivers/gpu/drm/i915/i915_scatterlist.c b/drivers/gpu/drm/i915= /i915_scatterlist.c index 159571b9bd24..f63b50b71e10 100644 --- a/drivers/gpu/drm/i915/i915_scatterlist.c +++ b/drivers/gpu/drm/i915/i915_scatterlist.c @@ -68,6 +68,7 @@ void i915_refct_sgt_init(struct i915_refct_sgt *rsgt, siz= e_t size) * drm_mm_node * @node: The drm_mm_node. * @region_start: An offset to add to the dma addresses of the sg list. + * @page_alignment: Required page alignment for each sg entry. Power of tw= o. * * Create a struct sg_table, initializing it from a struct drm_mm_node, * taking a maximum segment length into account, splitting into segments @@ -77,15 +78,18 @@ void i915_refct_sgt_init(struct i915_refct_sgt *rsgt, s= ize_t size) * error code cast to an error pointer on failure. */ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *no= de, - u64 region_start) + u64 region_start, + u64 page_alignment) { - const u64 max_segment =3D SZ_1G; /* Do we have a limit on this? */ + const u64 max_segment =3D round_down(UINT_MAX, page_alignment); u64 segment_pages =3D max_segment >> PAGE_SHIFT; u64 block_size, offset, prev_end; struct i915_refct_sgt *rsgt; struct sg_table *st; struct scatterlist *sg; =20 + GEM_BUG_ON(!max_segment); + rsgt =3D kmalloc(sizeof(*rsgt), GFP_KERNEL); if (!rsgt) return ERR_PTR(-ENOMEM); @@ -112,6 +116,8 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const str= uct drm_mm_node *node, sg =3D __sg_next(sg); =20 sg_dma_address(sg) =3D region_start + offset; + GEM_BUG_ON(!IS_ALIGNED(sg_dma_address(sg), + page_alignment)); sg_dma_len(sg) =3D 0; sg->length =3D 0; st->nents++; @@ -138,6 +144,7 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const str= uct drm_mm_node *node, * i915_buddy_block list * @res: The struct i915_ttm_buddy_resource. * @region_start: An offset to add to the dma addresses of the sg list. + * @page_alignment: Required page alignment for each sg entry. Power of tw= o. * * Create a struct sg_table, initializing it from struct i915_buddy_block = list, * taking a maximum segment length into account, splitting into segments @@ -147,11 +154,12 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const s= truct drm_mm_node *node, * error code cast to an error pointer on failure. */ struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *= res, - u64 region_start) + u64 region_start, + u64 page_alignment) { struct i915_ttm_buddy_resource *bman_res =3D to_ttm_buddy_resource(res); const u64 size =3D res->num_pages << PAGE_SHIFT; - const u64 max_segment =3D rounddown(UINT_MAX, PAGE_SIZE); + const u64 max_segment =3D round_down(UINT_MAX, page_alignment); struct drm_buddy *mm =3D bman_res->mm; struct list_head *blocks =3D &bman_res->blocks; struct drm_buddy_block *block; @@ -161,6 +169,7 @@ struct i915_refct_sgt *i915_rsgt_from_buddy_resource(st= ruct ttm_resource *res, resource_size_t prev_end; =20 GEM_BUG_ON(list_empty(blocks)); + GEM_BUG_ON(!max_segment); =20 rsgt =3D kmalloc(sizeof(*rsgt), GFP_KERNEL); if (!rsgt) @@ -191,6 +200,8 @@ struct i915_refct_sgt *i915_rsgt_from_buddy_resource(st= ruct ttm_resource *res, sg =3D __sg_next(sg); =20 sg_dma_address(sg) =3D region_start + offset; + GEM_BUG_ON(!IS_ALIGNED(sg_dma_address(sg), + page_alignment)); sg_dma_len(sg) =3D 0; sg->length =3D 0; st->nents++; diff --git a/drivers/gpu/drm/i915/i915_scatterlist.h b/drivers/gpu/drm/i915= /i915_scatterlist.h index 12c6a1684081..b13e4cdea923 100644 --- a/drivers/gpu/drm/i915/i915_scatterlist.h +++ b/drivers/gpu/drm/i915/i915_scatterlist.h @@ -213,9 +213,11 @@ static inline void __i915_refct_sgt_init(struct i915_r= efct_sgt *rsgt, void i915_refct_sgt_init(struct i915_refct_sgt *rsgt, size_t size); =20 struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *no= de, - u64 region_start); + u64 region_start, + u64 page_alignment); =20 struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *= res, - u64 region_start); + u64 region_start, + u64 page_alignment); =20 #endif diff --git a/drivers/gpu/drm/i915/intel_region_ttm.c b/drivers/gpu/drm/i915= /intel_region_ttm.c index 737ef3f4ab54..d896558cf458 100644 --- a/drivers/gpu/drm/i915/intel_region_ttm.c +++ b/drivers/gpu/drm/i915/intel_region_ttm.c @@ -151,6 +151,7 @@ int intel_region_ttm_fini(struct intel_memory_region *m= em) * Convert an opaque TTM resource manager resource to a refcounted sg_tabl= e. * @mem: The memory region. * @res: The resource manager resource obtained from the TTM resource mana= ger. + * @page_alignment: Required page alignment for each sg entry. Power of tw= o. * * The gem backends typically use sg-tables for operations on the underlyi= ng * io_memory. So provide a way for the backends to translate the @@ -160,16 +161,19 @@ int intel_region_ttm_fini(struct intel_memory_region = *mem) */ struct i915_refct_sgt * intel_region_ttm_resource_to_rsgt(struct intel_memory_region *mem, - struct ttm_resource *res) + struct ttm_resource *res, + u64 page_alignment) { if (mem->is_range_manager) { struct ttm_range_mgr_node *range_node =3D to_ttm_range_mgr_node(res); =20 return i915_rsgt_from_mm_node(&range_node->mm_nodes[0], - mem->region.start); + mem->region.start, + page_alignment); } else { - return i915_rsgt_from_buddy_resource(res, mem->region.start); + return i915_rsgt_from_buddy_resource(res, mem->region.start, + page_alignment); } } =20 diff --git a/drivers/gpu/drm/i915/intel_region_ttm.h b/drivers/gpu/drm/i915= /intel_region_ttm.h index fdee5e7bd46c..b17e494ef79c 100644 --- a/drivers/gpu/drm/i915/intel_region_ttm.h +++ b/drivers/gpu/drm/i915/intel_region_ttm.h @@ -24,7 +24,8 @@ int intel_region_ttm_fini(struct intel_memory_region *mem= ); =20 struct i915_refct_sgt * intel_region_ttm_resource_to_rsgt(struct intel_memory_region *mem, - struct ttm_resource *res); + struct ttm_resource *res, + u64 page_alignment); =20 void intel_region_ttm_resource_free(struct intel_memory_region *mem, struct ttm_resource *res); diff --git a/drivers/gpu/drm/i915/selftests/intel_memory_region.c b/drivers= /gpu/drm/i915/selftests/intel_memory_region.c index ba32893e0873..0250a114fe0a 100644 --- a/drivers/gpu/drm/i915/selftests/intel_memory_region.c +++ b/drivers/gpu/drm/i915/selftests/intel_memory_region.c @@ -451,7 +451,6 @@ static int igt_mock_splintered_region(void *arg) =20 static int igt_mock_max_segment(void *arg) { - const unsigned int max_segment =3D rounddown(UINT_MAX, PAGE_SIZE); struct intel_memory_region *mem =3D arg; struct drm_i915_private *i915 =3D mem->i915; struct i915_ttm_buddy_resource *res; @@ -460,7 +459,10 @@ static int igt_mock_max_segment(void *arg) struct drm_buddy *mm; struct list_head *blocks; struct scatterlist *sg; + I915_RND_STATE(prng); LIST_HEAD(objects); + unsigned int max_segment; + unsigned int ps; u64 size; int err =3D 0; =20 @@ -472,7 +474,13 @@ static int igt_mock_max_segment(void *arg) */ =20 size =3D SZ_8G; - mem =3D mock_region_create(i915, 0, size, PAGE_SIZE, 0, 0); + ps =3D PAGE_SIZE; + if (i915_prandom_u64_state(&prng) & 1) + ps =3D SZ_64K; /* For something like DG2 */ + + max_segment =3D round_down(UINT_MAX, ps); + + mem =3D mock_region_create(i915, 0, size, ps, 0, 0); if (IS_ERR(mem)) return PTR_ERR(mem); =20 @@ -498,12 +506,21 @@ static int igt_mock_max_segment(void *arg) } =20 for (sg =3D obj->mm.pages->sgl; sg; sg =3D sg_next(sg)) { + dma_addr_t daddr =3D sg_dma_address(sg); + if (sg->length > max_segment) { pr_err("%s: Created an oversized scatterlist entry, %u > %u\n", __func__, sg->length, max_segment); err =3D -EINVAL; goto out_close; } + + if (!IS_ALIGNED(daddr, ps)) { + pr_err("%s: Created an unaligned scatterlist entry, addr=3D%pa, ps=3D%u= \n", + __func__, &daddr, ps); + err =3D -EINVAL; + goto out_close; + } } =20 out_close: diff --git a/drivers/gpu/drm/i915/selftests/mock_region.c b/drivers/gpu/drm= /i915/selftests/mock_region.c index f64325491f35..6f7c9820d3e9 100644 --- a/drivers/gpu/drm/i915/selftests/mock_region.c +++ b/drivers/gpu/drm/i915/selftests/mock_region.c @@ -32,7 +32,8 @@ static int mock_region_get_pages(struct drm_i915_gem_obje= ct *obj) return PTR_ERR(obj->mm.res); =20 obj->mm.rsgt =3D intel_region_ttm_resource_to_rsgt(obj->mm.region, - obj->mm.res); + obj->mm.res, + obj->mm.region->min_page_size); if (IS_ERR(obj->mm.rsgt)) { err =3D PTR_ERR(obj->mm.rsgt); goto err_free_resource; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A6D7C433EF for ; Tue, 19 Jul 2022 12:57:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242484AbiGSM5r (ORCPT ); Tue, 19 Jul 2022 08:57:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242266AbiGSM5G (ORCPT ); Tue, 19 Jul 2022 08:57:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E8555C9C5; Tue, 19 Jul 2022 05:22:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AE838B81B08; Tue, 19 Jul 2022 12:22:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBA41C341C6; Tue, 19 Jul 2022 12:22:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233376; bh=XXbXHJXvxJrzUxIUhJtRBBaqXbxp1MJ2QMAF03qMuX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cx7bxvUd7gTSMaOLE6ReoVGU2qTp7YzLAml313gynz6v/FnKL00C8w6mK7fwQmj8d m/TBOLBJm7WLGAPJf8OmK6UPAhfF+tf+dSFAYuYiACT4Ryb9dyO7Z/jcE3/RdXYOGk Wcxj0F2JoVpDVnu33XnG5PTQLD6WV656oLjXzH7Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Kuoppala , Chris Wilson , Andi Shyti , Andrzej Hajda , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Mauro Carvalho Chehab , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.18 102/231] drm/i915/gt: Serialize GRDOM access between multiple engine resets Date: Tue, 19 Jul 2022 13:53:07 +0200 Message-Id: <20220719114723.242242143@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Wilson [ Upstream commit b24dcf1dc507f69ed3b5c66c2b6a0209ae80d4d4 ] Don't allow two engines to be reset in parallel, as they would both try to select a reset bit (and send requests to common registers) and wait on that register, at the same time. Serialize control of the reset requests/acks using the uncore->lock, which will also ensure that no other GT state changes at the same time as the actual reset. Cc: stable@vger.kernel.org # v4.4 and upper Reported-by: Mika Kuoppala Signed-off-by: Chris Wilson Acked-by: Mika Kuoppala Reviewed-by: Andi Shyti Reviewed-by: Andrzej Hajda Acked-by: Thomas Hellstr=C3=B6m Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Rodrigo Vivi Link: https://patchwork.freedesktop.org/patch/msgid/e0a2d894e77aed7c2e36b0d= 1abdc7dbac3011729.1657639152.git.mchehab@kernel.org (cherry picked from commit 336561a914fc0c6f1218228718f633b31b7af1c3) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/gt/intel_reset.c | 37 ++++++++++++++++++++------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/g= t/intel_reset.c index b7c6d4462ec5..d57db66ac7ea 100644 --- a/drivers/gpu/drm/i915/gt/intel_reset.c +++ b/drivers/gpu/drm/i915/gt/intel_reset.c @@ -299,9 +299,9 @@ static int gen6_hw_domain_reset(struct intel_gt *gt, u3= 2 hw_domain_mask) return err; } =20 -static int gen6_reset_engines(struct intel_gt *gt, - intel_engine_mask_t engine_mask, - unsigned int retry) +static int __gen6_reset_engines(struct intel_gt *gt, + intel_engine_mask_t engine_mask, + unsigned int retry) { struct intel_engine_cs *engine; u32 hw_mask; @@ -320,6 +320,20 @@ static int gen6_reset_engines(struct intel_gt *gt, return gen6_hw_domain_reset(gt, hw_mask); } =20 +static int gen6_reset_engines(struct intel_gt *gt, + intel_engine_mask_t engine_mask, + unsigned int retry) +{ + unsigned long flags; + int ret; + + spin_lock_irqsave(>->uncore->lock, flags); + ret =3D __gen6_reset_engines(gt, engine_mask, retry); + spin_unlock_irqrestore(>->uncore->lock, flags); + + return ret; +} + static struct intel_engine_cs *find_sfc_paired_vecs_engine(struct intel_en= gine_cs *engine) { int vecs_id; @@ -486,9 +500,9 @@ static void gen11_unlock_sfc(struct intel_engine_cs *en= gine) rmw_clear_fw(uncore, sfc_lock.lock_reg, sfc_lock.lock_bit); } =20 -static int gen11_reset_engines(struct intel_gt *gt, - intel_engine_mask_t engine_mask, - unsigned int retry) +static int __gen11_reset_engines(struct intel_gt *gt, + intel_engine_mask_t engine_mask, + unsigned int retry) { struct intel_engine_cs *engine; intel_engine_mask_t tmp; @@ -582,8 +596,11 @@ static int gen8_reset_engines(struct intel_gt *gt, struct intel_engine_cs *engine; const bool reset_non_ready =3D retry >=3D 1; intel_engine_mask_t tmp; + unsigned long flags; int ret; =20 + spin_lock_irqsave(>->uncore->lock, flags); + for_each_engine_masked(engine, gt, engine_mask, tmp) { ret =3D gen8_engine_reset_prepare(engine); if (ret && !reset_non_ready) @@ -611,17 +628,19 @@ static int gen8_reset_engines(struct intel_gt *gt, * This is best effort, so ignore any error from the initial reset. */ if (IS_DG2(gt->i915) && engine_mask =3D=3D ALL_ENGINES) - gen11_reset_engines(gt, gt->info.engine_mask, 0); + __gen11_reset_engines(gt, gt->info.engine_mask, 0); =20 if (GRAPHICS_VER(gt->i915) >=3D 11) - ret =3D gen11_reset_engines(gt, engine_mask, retry); + ret =3D __gen11_reset_engines(gt, engine_mask, retry); else - ret =3D gen6_reset_engines(gt, engine_mask, retry); + ret =3D __gen6_reset_engines(gt, engine_mask, retry); =20 skip_reset: for_each_engine_masked(engine, gt, engine_mask, tmp) gen8_engine_reset_cancel(engine); =20 + spin_unlock_irqrestore(>->uncore->lock, flags); + return ret; } =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E827CC43334 for ; Tue, 19 Jul 2022 12:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242239AbiGSM5v (ORCPT ); Tue, 19 Jul 2022 08:57:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242403AbiGSM5H (ORCPT ); Tue, 19 Jul 2022 08:57:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAF059B192; Tue, 19 Jul 2022 05:23:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D59E61913; Tue, 19 Jul 2022 12:23:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA87FC341C6; Tue, 19 Jul 2022 12:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233379; bh=5eseb3gcyY9nM+ZlZrhdlo7NLp4RLmzgYXbJ80QXtiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jntI1R1qt/T6qQkev3XHtAqErhiPWQilDQBolFglQE7/NdI1sGRZ2ulDbZvSibZHl xLxF0hjTiibXgsQdm1AHhOt3XM/B0mq02A7BHw+Uiqw/AoqcjrYT9ss5WGDnM+hQMG AQueMA1UEC1BCowpbtQLxt0lC551zBX2xFxzdQwE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauro Carvalho Chehab , Chris Wilson , Tvrtko Ursulin , Andi Shyti , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.18 103/231] drm/i915/gt: Serialize TLB invalidates with GT resets Date: Tue, 19 Jul 2022 13:53:08 +0200 Message-Id: <20220719114723.312935813@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Wilson [ Upstream commit a1c5a7bf79c1faa5633b918b5c0666545e84c4d1 ] Avoid trying to invalidate the TLB in the middle of performing an engine reset, as this may result in the reset timing out. Currently, the TLB invalidate is only serialised by its own mutex, forgoing the uncore lock, but we can take the uncore->lock as well to serialise the mmio access, thereby serialising with the GDRST. Tested on a NUC5i7RYB, BIOS RYBDWi35.86A.0380.2019.0517.1530 with i915 selftest/hangcheck. Cc: stable@vger.kernel.org # v4.4 and upper Fixes: 7938d61591d3 ("drm/i915: Flush TLBs before releasing backing store") Reported-by: Mauro Carvalho Chehab Tested-by: Mauro Carvalho Chehab Reviewed-by: Mauro Carvalho Chehab Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Reviewed-by: Andi Shyti Acked-by: Thomas Hellstr=C3=B6m Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Rodrigo Vivi Link: https://patchwork.freedesktop.org/patch/msgid/1e59a7c45dd919a530256b9= ac721ac6ea86c0677.1657639152.git.mchehab@kernel.org (cherry picked from commit 33da97894758737895e90c909f16786052680ef4) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/gt/intel_gt.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/i= ntel_gt.c index 8a2483ccbfb9..f4375479e6f0 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt.c +++ b/drivers/gpu/drm/i915/gt/intel_gt.c @@ -1012,6 +1012,20 @@ void intel_gt_invalidate_tlbs(struct intel_gt *gt) mutex_lock(>->tlb_invalidate_lock); intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL); =20 + spin_lock_irq(&uncore->lock); /* serialise invalidate with GT reset */ + + for_each_engine(engine, gt, id) { + struct reg_and_bit rb; + + rb =3D get_reg_and_bit(engine, regs =3D=3D gen8_regs, regs, num); + if (!i915_mmio_reg_offset(rb.reg)) + continue; + + intel_uncore_write_fw(uncore, rb.reg, rb.bit); + } + + spin_unlock_irq(&uncore->lock); + for_each_engine(engine, gt, id) { /* * HW architecture suggest typical invalidation time at 40us, @@ -1026,7 +1040,6 @@ void intel_gt_invalidate_tlbs(struct intel_gt *gt) if (!i915_mmio_reg_offset(rb.reg)) continue; =20 - intel_uncore_write_fw(uncore, rb.reg, rb.bit); if (__intel_wait_for_register_fw(uncore, rb.reg, rb.bit, 0, timeout_us, timeout_ms, --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F7E1CCA47F for ; Tue, 19 Jul 2022 12:58:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242425AbiGSM6P (ORCPT ); Tue, 19 Jul 2022 08:58:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242351AbiGSM5K (ORCPT ); Tue, 19 Jul 2022 08:57:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4A495C96B; Tue, 19 Jul 2022 05:23:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A0872B81B1C; Tue, 19 Jul 2022 12:23:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 019CEC341C6; Tue, 19 Jul 2022 12:23:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233382; bh=1hAtghOKEH8FSD8tecwcdFljb7QXypnWi+WQSL/Z5Lg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YiNB1Hh7LdxY1Q/jd6Wh2+wbjdZY6i9riteKen3WXB1wCXH/dTolbxiy6kGPgSq8f nIOBi/VGH+vlbE5/ahAIteDrIFB8xoqG65JWg5LlbydSsDKmSY18WYd2LhoYTzqp1w 6NYwwmpmxvoADJvx0AirgoyyXFhD2qiRZdzdqxl0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrzej Hajda , Andi Shyti , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.18 104/231] drm/i915/selftests: fix subtraction overflow bug Date: Tue, 19 Jul 2022 13:53:09 +0200 Message-Id: <20220719114723.384437849@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrzej Hajda [ Upstream commit 333991c4e66b3d4b5613315f18016da80344f659 ] On some machines hole_end can be small enough to cause subtraction overflow. On the other side (addr + 2 * min_alignment) can overflow in case of mock tests. This patch should handle both cases. Fixes: e1c5f754067b59 ("drm/i915: Avoid overflow in computing pot_hole loop= termination") Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/3674 Signed-off-by: Andrzej Hajda Reviewed-by: Andi Shyti Signed-off-by: Andi Shyti Link: https://patchwork.freedesktop.org/patch/msgid/20220624113528.2159210-= 1-andrzej.hajda@intel.com Signed-off-by: Rodrigo Vivi (cherry picked from commit ab3edc679c552a466e4bf0b11af3666008bd65a2) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/dr= m/i915/selftests/i915_gem_gtt.c index ab751192eb3b..34d1ef015233 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c @@ -742,7 +742,7 @@ static int pot_hole(struct i915_address_space *vm, u64 addr; =20 for (addr =3D round_up(hole_start + min_alignment, step) - min_alignment; - addr <=3D round_down(hole_end - (2 * min_alignment), step) - min_al= ignment; + hole_end > addr && hole_end - addr >=3D 2 * min_alignment; addr +=3D step) { err =3D i915_vma_pin(vma, 0, 0, addr | flags); if (err) { --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 842A9C43334 for ; Tue, 19 Jul 2022 12:58:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242499AbiGSM6S (ORCPT ); Tue, 19 Jul 2022 08:58:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242165AbiGSM5U (ORCPT ); Tue, 19 Jul 2022 08:57:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB2925D0C9; Tue, 19 Jul 2022 05:23:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 662D2B81B21; Tue, 19 Jul 2022 12:23:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9A09C341CA; Tue, 19 Jul 2022 12:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233385; bh=EfOYFyw83csPAeTB3cOrj1p3bu3mp5DP6XDuWqNdGtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y6cfv2n8gZ729uJoy46PB7fHnBOPVyN6cEGp4NNNZxae6fnbDuLmvJAuJOBqsdzTL dVAOe7ui8zj4BBsnCMqo4QC/hLGu93RQ6UMe1LRfU9DbGUxnTgi97Fs2ur9jkawfl1 xzE22toJYVPClpX1/A3gsAHEkWDI6F8SJ98eqUPg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kashyap Desai , Michael Chan , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 105/231] bnxt_en: reclaim max resources if sriov enable fails Date: Tue, 19 Jul 2022 13:53:10 +0200 Message-Id: <20220719114723.475307137@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kashyap Desai [ Upstream commit c5b744d38c36a407a41e918602eec4d89730787b ] If bnxt_sriov_enable() fails after some resources have been reserved for the VFs, the current code is not unwinding properly and the reserved resources become unavailable afterwards. Fix it by properly unwinding with a call to bnxt_hwrm_func_qcaps() to reset all maximum resources. Also, add the missing bnxt_ulp_sriov_cfg() call to let the RDMA driver know to abort. Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.") Signed-off-by: Kashyap Desai Signed-off-by: Michael Chan Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethern= et/broadcom/bnxt/bnxt.c index d5149478a351..ee6686a111bd 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7641,7 +7641,7 @@ static void bnxt_hwrm_dbg_qcaps(struct bnxt *bp) =20 static int bnxt_hwrm_queue_qportcfg(struct bnxt *bp); =20 -static int bnxt_hwrm_func_qcaps(struct bnxt *bp) +int bnxt_hwrm_func_qcaps(struct bnxt *bp) { int rc; =20 diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethern= et/broadcom/bnxt/bnxt.h index 98453a78cbd0..4c6ce2b2b3b7 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -2310,6 +2310,7 @@ int bnxt_cancel_reservations(struct bnxt *bp, bool fw= _reset); int bnxt_hwrm_alloc_wol_fltr(struct bnxt *bp); int bnxt_hwrm_free_wol_fltr(struct bnxt *bp); int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all); +int bnxt_hwrm_func_qcaps(struct bnxt *bp); int bnxt_hwrm_fw_set_time(struct bnxt *); int bnxt_open_nic(struct bnxt *, bool, bool); int bnxt_half_open_nic(struct bnxt *bp); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/= ethernet/broadcom/bnxt/bnxt_sriov.c index ddf2f3963abe..a1a2c7a64fd5 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c @@ -823,8 +823,10 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num= _vfs) goto err_out2; =20 rc =3D pci_enable_sriov(bp->pdev, *num_vfs); - if (rc) + if (rc) { + bnxt_ulp_sriov_cfg(bp, 0); goto err_out2; + } =20 return 0; =20 @@ -832,6 +834,9 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_= vfs) /* Free the resources reserved for various VF's */ bnxt_hwrm_func_vf_resource_free(bp, *num_vfs); =20 + /* Restore the max resources */ + bnxt_hwrm_func_qcaps(bp); + err_out1: bnxt_free_vf_resources(bp); =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA872C43334 for ; Tue, 19 Jul 2022 12:58:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242387AbiGSM60 (ORCPT ); Tue, 19 Jul 2022 08:58:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242456AbiGSM5b (ORCPT ); Tue, 19 Jul 2022 08:57:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E3C89B19C; Tue, 19 Jul 2022 05:23:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CE3FE618F1; Tue, 19 Jul 2022 12:23:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98D9AC341C6; Tue, 19 Jul 2022 12:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233388; bh=sbrNjhLCvn5a2AkRbEaXHTgvzEtiaBNNhza+/u7Y8Kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KgtmaZ5/INc7RtnfAi3VnHEsCBP1/0J417923tlVDlDGRZNsjzHsrfPEa79pddu97 2XDxLPhbPAPUJhE7108dzzkTI7PgAGjsuYCy11pL8XR5qH+vIoYGf8gCUoqTiUxfyL V/aK/zOkFj+WAH872/VKPtJ3NrElJYMbd0ZnQJTY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavan Chebbi , Michael Chan , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 106/231] bnxt_en: Fix bnxt_reinit_after_abort() code path Date: Tue, 19 Jul 2022 13:53:11 +0200 Message-Id: <20220719114723.549336840@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Chan [ Upstream commit 4279414bff8af9898e8c53ae6c5bc17f68ad67b7 ] bnxt_reinit_after_abort() is called during ifup when a previous FW reset sequence has aborted or a previous ifup has failed after detecting FW reset. In all cases, it is safe to assume that a previous FW reset has completed and the driver may not have fully reinitialized. Prior to this patch, it is assumed that the FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE flag will always be set by the firmware in bnxt_hwrm_if_change(). This may not be true if the driver has already attempted to register with the firmware. The firmware may not set the RESET_DONE flag again after the driver has registered, assuming that the driver has seen the flag already. Fix it to always go through the FW reset initialization path if the BNXT_STATE_FW_RESET_DET flag is set. This flag is always set by the driver after successfully going through bnxt_reinit_after_abort(). Fixes: 6882c36cf82e ("bnxt_en: attempt to reinitialize after aborted reset") Reviewed-by: Pavan Chebbi Signed-off-by: Michael Chan Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethern= et/broadcom/bnxt/bnxt.c index ee6686a111bd..1ceccaed2da0 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -9916,7 +9916,8 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool = up) =20 if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_RESC_CHANGE) resc_reinit =3D true; - if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE) + if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE || + test_bit(BNXT_STATE_FW_RESET_DET, &bp->state)) fw_reset =3D true; else bnxt_remap_fw_health_regs(bp); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43A38CCA481 for ; Tue, 19 Jul 2022 12:58:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242308AbiGSM6h (ORCPT ); Tue, 19 Jul 2022 08:58:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242481AbiGSM5q (ORCPT ); Tue, 19 Jul 2022 08:57:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7811B459B8; Tue, 19 Jul 2022 05:23:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E568D61632; Tue, 19 Jul 2022 12:23:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BB4FC341C6; Tue, 19 Jul 2022 12:23:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233394; bh=rxlbLmPe2RGO+1IlEcnh73vt9heuUv2J9NYtvApGj6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mZCVeGaNrSkxBbl8CuRTapX5HZj833RERxXH6GCKqgrRBjweo0XDii2gPR5/eVbyB Dap/dKS5MNYI8x5w3c3r4H12/mliFbUs0udFDTK8y8DNOh21WqiHalb9iCqQpPLuBj bHOrBM/tzIt//v+iFf+7CWa3rC3QcfIDHk3thHeY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Saravanan Vajravel , Somnath Kotur , Vikas Gupta , Michael Chan , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 107/231] bnxt_en: fix livepatch query Date: Tue, 19 Jul 2022 13:53:12 +0200 Message-Id: <20220719114723.621691392@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vikas Gupta [ Upstream commit 619b9b1622c283cc5ca86f4c487db266a8f55dab ] In the livepatch query fw_target BNXT_FW_SRT_PATCH is applicable for P5 chips only. Fixes: 3c4153394e2c ("bnxt_en: implement firmware live patching") Reviewed-by: Saravanan Vajravel Reviewed-by: Somnath Kotur Signed-off-by: Vikas Gupta Signed-off-by: Michael Chan Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/ne= t/ethernet/broadcom/bnxt/bnxt_devlink.c index 0c17f90d44a2..3a9441fe4fd1 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c @@ -979,9 +979,11 @@ static int bnxt_dl_info_get(struct devlink *dl, struct= devlink_info_req *req, if (rc) return rc; =20 - rc =3D bnxt_dl_livepatch_info_put(bp, req, BNXT_FW_SRT_PATCH); - if (rc) - return rc; + if (BNXT_CHIP_P5(bp)) { + rc =3D bnxt_dl_livepatch_info_put(bp, req, BNXT_FW_SRT_PATCH); + if (rc) + return rc; + } return bnxt_dl_livepatch_info_put(bp, req, BNXT_FW_CRT_PATCH); =20 } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D537C433EF for ; Tue, 19 Jul 2022 12:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242548AbiGSM6j (ORCPT ); Tue, 19 Jul 2022 08:58:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238226AbiGSM6E (ORCPT ); Tue, 19 Jul 2022 08:58:04 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B4624F1A1; Tue, 19 Jul 2022 05:23:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id B48ABCE1BE6; Tue, 19 Jul 2022 12:23:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C7D2C341C6; Tue, 19 Jul 2022 12:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233397; bh=DSnmKI9BAc5haUNJPV0pkaM7GGOJqSGfP80wvs2MKMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qqyJowF/LHnsBt4HKShnH9G4togqBBGM1l/FJWRUj28HwzIfO2SZ4M+oSqm1n6y/O URNGt65XBPo/7yi3o7cpu9VlBJ6oc3O3QrnNXTBG6wfXfLVwMgOZoWY1sQmA2TlwER ZKn4+Mz0zjqWqW1CBUmT5o7FmdepGtW6GWRL4AI0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Cochran , Pavan Chebbi , Michael Chan , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 108/231] bnxt_en: Fix bnxt_refclk_read() Date: Tue, 19 Jul 2022 13:53:13 +0200 Message-Id: <20220719114723.694600153@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavan Chebbi [ Upstream commit ddde5412fdaa5048bbca31529d46cb8da882870c ] The upper 32-bit PHC register is not latched when reading the lower 32-bit PHC register. Current code leaves a small window where we may not read correct higher order bits if the lower order bits are just about to wrap around. This patch fixes this by reading higher order bits twice and makes sure that final value is correctly paired with its lower 32 bits. Fixes: 30e96f487f64 ("bnxt_en: Do not read the PTP PHC during chip reset") Cc: Richard Cochran Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c b/drivers/net/et= hernet/broadcom/bnxt/bnxt_ptp.c index f9c94e5fe718..3221911e25fe 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c @@ -76,14 +76,23 @@ static int bnxt_refclk_read(struct bnxt *bp, struct ptp= _system_timestamp *sts, u64 *ns) { struct bnxt_ptp_cfg *ptp =3D bp->ptp_cfg; + u32 high_before, high_now, low; =20 if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) return -EIO; =20 + high_before =3D readl(bp->bar0 + ptp->refclk_mapped_regs[1]); ptp_read_system_prets(sts); - *ns =3D readl(bp->bar0 + ptp->refclk_mapped_regs[0]); + low =3D readl(bp->bar0 + ptp->refclk_mapped_regs[0]); ptp_read_system_postts(sts); - *ns |=3D (u64)readl(bp->bar0 + ptp->refclk_mapped_regs[1]) << 32; + high_now =3D readl(bp->bar0 + ptp->refclk_mapped_regs[1]); + if (high_now !=3D high_before) { + ptp_read_system_prets(sts); + low =3D readl(bp->bar0 + ptp->refclk_mapped_regs[0]); + ptp_read_system_postts(sts); + } + *ns =3D ((u64)high_now << 32) | low; + return 0; } =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3240BC43334 for ; Tue, 19 Jul 2022 12:58:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242426AbiGSM6p (ORCPT ); Tue, 19 Jul 2022 08:58:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235856AbiGSM6J (ORCPT ); Tue, 19 Jul 2022 08:58:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF4285D596; Tue, 19 Jul 2022 05:23:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 86BB0618C1; Tue, 19 Jul 2022 12:23:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68F36C341C6; Tue, 19 Jul 2022 12:23:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233399; bh=XECchj46DqH3hUhk2VLoi/eh4vI39pKf+B4T1uialzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=idz6KXx1WsT8V1z7oAlpo3HGG92f7YCpt1INlLY3VSqq7a/0VGswBg27UnMeABFU7 mkrobYMSRcOIuomxEm+RCPHI5PGEAv9TWXlYsRyONOClL8j/JIBMDzi+wJdVqa0w5h Jxmd0lX0l90Qf2biSkI3P6EbWLKTwbPl6/Ol3RZs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 109/231] sysctl: Fix data-races in proc_dou8vec_minmax(). Date: Tue, 19 Jul 2022 13:53:14 +0200 Message-Id: <20220719114723.766278861@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 7dee5d7747a69aa2be41f04c6a7ecfe3ac8cdf18 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_dou8vec_minmax() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_dou8vec_minmax() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: cb9444130662 ("sysctl: add proc_dou8vec_minmax()") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 878b1122cb89..54ec36e69907 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1079,13 +1079,13 @@ int proc_dou8vec_minmax(struct ctl_table *table, in= t write, =20 tmp.maxlen =3D sizeof(val); tmp.data =3D &val; - val =3D *data; + val =3D READ_ONCE(*data); res =3D do_proc_douintvec(&tmp, write, buffer, lenp, ppos, do_proc_douintvec_minmax_conv, ¶m); if (res) return res; if (write) - *data =3D val; + WRITE_ONCE(*data, val); return 0; } EXPORT_SYMBOL_GPL(proc_dou8vec_minmax); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C81AAC433EF for ; Tue, 19 Jul 2022 12:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242555AbiGSM6s (ORCPT ); Tue, 19 Jul 2022 08:58:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242490AbiGSM6N (ORCPT ); Tue, 19 Jul 2022 08:58:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D97985D5A0; Tue, 19 Jul 2022 05:23:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6FDFF618F1; Tue, 19 Jul 2022 12:23:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5097BC341C6; Tue, 19 Jul 2022 12:23:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233402; bh=C35YW5OGVExMjOSZqjrwbAh058nF7suNo+uXffy0b2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oGb2d8dtSizYvw7bbRtfARZucSeOHf94T871pWz8887QdqX4tPSonk4f/0eLU8E3b Wa+VSsBeiJ/9vo7NLnIPm75PVkgXmp74EkBkl7s9pCTHZQylaEAzz37r5EYvmsTZw+ Au3k9SCcDiydpNw1lJPYwYE0dccm5WxxEjrU47KI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 110/231] sysctl: Fix data-races in proc_dointvec_ms_jiffies(). Date: Tue, 19 Jul 2022 13:53:15 +0200 Message-Id: <20220719114723.838662068@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 7d1025e559782b58824b36cb8ad547a69f2e4b31 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_dointvec_ms_jiffies() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_dointvec_ms_jiffies() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 54ec36e69907..f165ea67dd33 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1296,9 +1296,9 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *neg= p, unsigned long *lvalp, =20 if (jif > INT_MAX) return 1; - *valp =3D (int)jif; + WRITE_ONCE(*valp, (int)jif); } else { - int val =3D *valp; + int val =3D READ_ONCE(*valp); unsigned long lval; if (val < 0) { *negp =3D true; @@ -1366,8 +1366,8 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *ta= ble, int write, * @ppos: the current position in the file * * Reads/writes up to table->maxlen/sizeof(unsigned int) integer - * values from/to the user buffer, treated as an ASCII string.=20 - * The values read are assumed to be in 1/1000 seconds, and=20 + * values from/to the user buffer, treated as an ASCII string. + * The values read are assumed to be in 1/1000 seconds, and * are converted into jiffies. * * Returns 0 on success. --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBFE0CCA47F for ; Tue, 19 Jul 2022 12:58:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242433AbiGSM6u (ORCPT ); Tue, 19 Jul 2022 08:58:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242427AbiGSM6O (ORCPT ); Tue, 19 Jul 2022 08:58:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D70734F1B2; Tue, 19 Jul 2022 05:23:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5790B618EE; Tue, 19 Jul 2022 12:23:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 363DFC341C6; Tue, 19 Jul 2022 12:23:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233405; bh=1O4YvpPOVTcmd9SUcxf3I9CNQViboW+x42n9Xo73vWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xt8TGTOxwmZyBPYH2kcHCcqZe2DyuVcm6Vms8PQDg3yqZIkPb4mHi0pJH4M0aHqoi 0Q0EpPypKk3tlYcHjWXqs8HrykN9ILDL7kht+TE5gZ7TEJGkosq/T1rOd9r8AApkqP ykXI55WFAtw0Ax+VoQLr0vZaYt2qL0eiSinUaiyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 111/231] tcp: Fix a data-race around sysctl_max_tw_buckets. Date: Tue, 19 Jul 2022 13:53:16 +0200 Message-Id: <20220719114723.910459435@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 6f605b57f3782114e330e108ce1903ede22ec675 ] While reading sysctl_max_tw_buckets, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/inet_timewait_sock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c index 0ec501845cb3..47ccc343c9fb 100644 --- a/net/ipv4/inet_timewait_sock.c +++ b/net/ipv4/inet_timewait_sock.c @@ -156,7 +156,8 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct= sock *sk, { struct inet_timewait_sock *tw; =20 - if (refcount_read(&dr->tw_refcount) - 1 >=3D dr->sysctl_max_tw_buckets) + if (refcount_read(&dr->tw_refcount) - 1 >=3D + READ_ONCE(dr->sysctl_max_tw_buckets)) return NULL; =20 tw =3D kmem_cache_alloc(sk->sk_prot_creator->twsk_prot->twsk_slab, --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B64E2C433EF for ; Tue, 19 Jul 2022 12:58:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242575AbiGSM6y (ORCPT ); Tue, 19 Jul 2022 08:58:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242451AbiGSM6U (ORCPT ); Tue, 19 Jul 2022 08:58:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 221175E318; Tue, 19 Jul 2022 05:23:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1F17B81A7F; Tue, 19 Jul 2022 12:23:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B4E2C341C6; Tue, 19 Jul 2022 12:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233408; bh=tQ7WdwdL1bb226D+1gw3GgZvo9NVXwpbQGG5RlgGYYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a2P38pRvvcPmxfCsi/3DgvxFAcrVrJYNGtPQZTSv0czbzow6flpnwn98wC5An1hjL 98zs1O7wSSvNfrbzXlDFFldbr+PYcuF6dmKs4DCnyYH5/5ayLVgVuRaiYjFjdMbLIn bSB1YEnUpbYsW84TKPGrW6c0gJwNtSQ+pWemlTUA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 112/231] icmp: Fix a data-race around sysctl_icmp_echo_ignore_all. Date: Tue, 19 Jul 2022 13:53:17 +0200 Message-Id: <20220719114723.979917108@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit bb7bb35a63b4812da8e3aff587773678e31d23e3 ] While reading sysctl_icmp_echo_ignore_all, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/icmp.c | 2 +- net/ipv4/sysctl_net_ipv4.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 97350a38a75d..92eaa96a9ff1 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -990,7 +990,7 @@ static bool icmp_echo(struct sk_buff *skb) =20 net =3D dev_net(skb_dst(skb)->dev); /* should there be an ICMP stat for ignored echos? */ - if (net->ipv4.sysctl_icmp_echo_ignore_all) + if (READ_ONCE(net->ipv4.sysctl_icmp_echo_ignore_all)) return true; =20 icmp_param.data.icmph =3D *icmp_hdr(skb); diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index ad80d180b60b..8987864c4479 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -603,6 +603,8 @@ static struct ctl_table ipv4_net_table[] =3D { .maxlen =3D sizeof(u8), .mode =3D 0644, .proc_handler =3D proc_dou8vec_minmax, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE }, { .procname =3D "icmp_echo_enable_probe", --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01EB2C43334 for ; Tue, 19 Jul 2022 12:58:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242580AbiGSM64 (ORCPT ); Tue, 19 Jul 2022 08:58:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242330AbiGSM6Y (ORCPT ); Tue, 19 Jul 2022 08:58:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2F665F106; Tue, 19 Jul 2022 05:23:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D0E6618F1; Tue, 19 Jul 2022 12:23:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA4BFC341C6; Tue, 19 Jul 2022 12:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233411; bh=JFj+LVCeBm8RwxCHRYQqnzhufZo45CcRt8VNjkTJA6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JA3YbHojfMvEDxXhiuTRllr+bq7xoOrBzP6XHBBmhrdhzD+FSu/ozwl5qUCqhY9DA H1OEjaTknaywBAzWn/CIvhQiM8LSj/wmMhG8tqBAqxi1foSJfdrtjj1pJTRO8yUCS9 WKm6bXWG2zZT2p/wF03nmF+TVA/rVL2wXQn6Ja6A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 113/231] icmp: Fix data-races around sysctl_icmp_echo_enable_probe. Date: Tue, 19 Jul 2022 13:53:18 +0200 Message-Id: <20220719114724.048794263@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 4a2f7083cc6cb72dade9a63699ca352fad26d1cd ] While reading sysctl_icmp_echo_enable_probe, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: d329ea5bd884 ("icmp: add response to RFC 8335 PROBE messages") Fixes: 1fd07f33c3ea ("ipv6: ICMPV6: add response to ICMPV6 RFC 8335 PROBE m= essages") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/icmp.c | 2 +- net/ipv6/icmp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 92eaa96a9ff1..7edc8a3b1646 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -1025,7 +1025,7 @@ bool icmp_build_probe(struct sk_buff *skb, struct icm= phdr *icmphdr) u16 ident_len; u8 status; =20 - if (!net->ipv4.sysctl_icmp_echo_enable_probe) + if (!READ_ONCE(net->ipv4.sysctl_icmp_echo_enable_probe)) return false; =20 /* We currently only support probing interfaces on the proxy node diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index e6b978ea0e87..26554aa6fc1b 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c @@ -919,7 +919,7 @@ static int icmpv6_rcv(struct sk_buff *skb) break; case ICMPV6_EXT_ECHO_REQUEST: if (!net->ipv6.sysctl.icmpv6_echo_ignore_all && - net->ipv4.sysctl_icmp_echo_enable_probe) + READ_ONCE(net->ipv4.sysctl_icmp_echo_enable_probe)) icmpv6_echo_reply(skb); break; =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99626C433EF for ; Tue, 19 Jul 2022 12:59:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242519AbiGSM7C (ORCPT ); Tue, 19 Jul 2022 08:59:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242520AbiGSM6b (ORCPT ); Tue, 19 Jul 2022 08:58:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8637D4F1A2; Tue, 19 Jul 2022 05:23:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 12304618E6; Tue, 19 Jul 2022 12:23:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5D69C341C6; Tue, 19 Jul 2022 12:23:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233414; bh=1vc3EJytqyUNS1xlFfoMKtjkqyxG3EvQLNlJniO4kOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pl5H6se3r+oxS/jvUTOdbuB4ap2gDr6nJLEb4JKWp4ZHVUYnEkChjxpfJqhkSEJVV wTI+eADstdDUS+EH+4Xy2bDa8dXmOXiUMaJUnD9sIAmkddar4f8vD59C8vweYH20rr I1TA00WdXmsbynY3ScUYDawjLyzcRsqqMEdtIJVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 114/231] icmp: Fix a data-race around sysctl_icmp_echo_ignore_broadcasts. Date: Tue, 19 Jul 2022 13:53:19 +0200 Message-Id: <20220719114724.118355028@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 66484bb98ed2dfa1dda37a32411483d8311ac269 ] While reading sysctl_icmp_echo_ignore_broadcasts, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/icmp.c | 2 +- net/ipv4/sysctl_net_ipv4.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 7edc8a3b1646..2c402b4671a1 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -1239,7 +1239,7 @@ int icmp_rcv(struct sk_buff *skb) */ if ((icmph->type =3D=3D ICMP_ECHO || icmph->type =3D=3D ICMP_TIMESTAMP) && - net->ipv4.sysctl_icmp_echo_ignore_broadcasts) { + READ_ONCE(net->ipv4.sysctl_icmp_echo_ignore_broadcasts)) { goto error; } if (icmph->type !=3D ICMP_ECHO && diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 8987864c4479..6613351094ce 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -621,6 +621,8 @@ static struct ctl_table ipv4_net_table[] =3D { .maxlen =3D sizeof(u8), .mode =3D 0644, .proc_handler =3D proc_dou8vec_minmax, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE }, { .procname =3D "icmp_ignore_bogus_error_responses", --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEAA8C43334 for ; Tue, 19 Jul 2022 13:00:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242600AbiGSM7J (ORCPT ); Tue, 19 Jul 2022 08:59:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242238AbiGSM6c (ORCPT ); Tue, 19 Jul 2022 08:58:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C2555E32F; Tue, 19 Jul 2022 05:23:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C780A618F1; Tue, 19 Jul 2022 12:23:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7952C341C6; Tue, 19 Jul 2022 12:23:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233417; bh=6IOMZz7gILfFZJHf3t+fgNOMfg8Rc7QlheseHOz1F5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t2ZpCfvh2WGzP4U/VpdTRjlu4+NziJlsIIVsS61PQW+chCdeb5yfe1M9PHFE9PFjx SVn83Y4RFb40Pq9ouLOlbX35e84gkyzj38uMGZxP2GToIINBML4gCjNkixL4mDaWsA mOqdUjKrL+oFT/invJpSULkXZ59aa/lphU1k9aE0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 115/231] icmp: Fix a data-race around sysctl_icmp_ignore_bogus_error_responses. Date: Tue, 19 Jul 2022 13:53:20 +0200 Message-Id: <20220719114724.188064907@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit b04f9b7e85c7d7aecbada620e8759a662af068d3 ] While reading sysctl_icmp_ignore_bogus_error_responses, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/icmp.c | 2 +- net/ipv4/sysctl_net_ipv4.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 2c402b4671a1..1a061d10949f 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -930,7 +930,7 @@ static bool icmp_unreach(struct sk_buff *skb) * get the other vendor to fix their kit. */ =20 - if (!net->ipv4.sysctl_icmp_ignore_bogus_error_responses && + if (!READ_ONCE(net->ipv4.sysctl_icmp_ignore_bogus_error_responses) && inet_addr_type_dev_table(net, skb->dev, iph->daddr) =3D=3D RTN_BROADC= AST) { net_warn_ratelimited("%pI4 sent an invalid ICMP type %u, code %u error t= o a broadcast: %pI4 on %s\n", &ip_hdr(skb)->saddr, diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 6613351094ce..4cf2a6f560d4 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -630,6 +630,8 @@ static struct ctl_table ipv4_net_table[] =3D { .maxlen =3D sizeof(u8), .mode =3D 0644, .proc_handler =3D proc_dou8vec_minmax, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE }, { .procname =3D "icmp_errors_use_inbound_ifaddr", --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA7B9C43334 for ; Tue, 19 Jul 2022 13:02:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239181AbiGSNCw (ORCPT ); Tue, 19 Jul 2022 09:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243066AbiGSNAR (ORCPT ); Tue, 19 Jul 2022 09:00:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0F785071A; Tue, 19 Jul 2022 05:25:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F060661912; Tue, 19 Jul 2022 12:25:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCD55C36AE2; Tue, 19 Jul 2022 12:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233530; bh=sLR9GzEa95OpEvmC8G+YIBsFoFoidxpreXI4ynraqzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=18GJi4a1B3SaBEarBbpHnmv4yK65vGE0m6/sMmMG4tTaGXoAFKN0G/VzLrisbR7fz 5K+Wi+o9XuWpr65ockucQ3/E6WnJfhQNVlADR3KMh2pUb3inFpjOUOdFoWUL/uh+sp IsWrZKd1dIFCDfuaZ6HKTiOKrty6f9lUiON4o6Dc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 116/231] icmp: Fix a data-race around sysctl_icmp_errors_use_inbound_ifaddr. Date: Tue, 19 Jul 2022 13:53:21 +0200 Message-Id: <20220719114724.257227943@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit d2efabce81db7eed1c98fa1a3f203f0edd738ac3 ] While reading sysctl_icmp_errors_use_inbound_ifaddr, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1c2fb7f93cb2 ("[IPV4]: Sysctl configurable icmp error source address= .") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/icmp.c | 2 +- net/ipv4/sysctl_net_ipv4.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 1a061d10949f..37ba5f042908 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -693,7 +693,7 @@ void __icmp_send(struct sk_buff *skb_in, int type, int = code, __be32 info, =20 rcu_read_lock(); if (rt_is_input_route(rt) && - net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr) + READ_ONCE(net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr)) dev =3D dev_get_by_index_rcu(net, inet_iif(skb_in)); =20 if (dev) diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 4cf2a6f560d4..33e65e79e46e 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -639,6 +639,8 @@ static struct ctl_table ipv4_net_table[] =3D { .maxlen =3D sizeof(u8), .mode =3D 0644, .proc_handler =3D proc_dou8vec_minmax, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE }, { .procname =3D "icmp_ratelimit", --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C985ECCA47F for ; Tue, 19 Jul 2022 13:01:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242456AbiGSNBR (ORCPT ); Tue, 19 Jul 2022 09:01:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242634AbiGSM7S (ORCPT ); Tue, 19 Jul 2022 08:59:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2FBB49B50; Tue, 19 Jul 2022 05:24:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A80E261921; Tue, 19 Jul 2022 12:24:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F30DC341CF; Tue, 19 Jul 2022 12:24:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233443; bh=l1kNMadkvYVvVheARyYreP6xCmK8rdh3y0HThwRVqco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bfy/A7f2eab3dX8XwDTaMKpzinSVt+m5h7RWnZQsY6YdR3g+dE9i2DTgsDA1pc8dx apBJcEs5Re0NMs6BEIx/FxGsZQFE8rS018xvlCGVAXVm6JrtFx5ga9IGLzz7zS0iem kbRDlBa8y+MhWLfJGUzDHipTKN0vmc/o2O2mU790= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 117/231] icmp: Fix a data-race around sysctl_icmp_ratelimit. Date: Tue, 19 Jul 2022 13:53:22 +0200 Message-Id: <20220719114724.327043094@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 2a4eb714841f288cf51c7d942d98af6a8c6e4b01 ] While reading sysctl_icmp_ratelimit, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/icmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 37ba5f042908..41efb7381859 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -320,7 +320,8 @@ static bool icmpv4_xrlim_allow(struct net *net, struct = rtable *rt, =20 vif =3D l3mdev_master_ifindex(dst->dev); peer =3D inet_getpeer_v4(net->ipv4.peers, fl4->daddr, vif, 1); - rc =3D inet_peer_xrlim_allow(peer, net->ipv4.sysctl_icmp_ratelimit); + rc =3D inet_peer_xrlim_allow(peer, + READ_ONCE(net->ipv4.sysctl_icmp_ratelimit)); if (peer) inet_putpeer(peer); out: --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB0BCC433EF for ; Tue, 19 Jul 2022 13:01:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242745AbiGSNBw (ORCPT ); Tue, 19 Jul 2022 09:01:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242707AbiGSM72 (ORCPT ); Tue, 19 Jul 2022 08:59:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C0FD4F682; Tue, 19 Jul 2022 05:24:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C347CB81B08; Tue, 19 Jul 2022 12:24:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3E10C341D4; Tue, 19 Jul 2022 12:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233478; bh=sZ4gSH3EmHNfxqY9izStaWXalFrxgZLAwUzlrp8Cgic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1GagmxsodQIfymAEVyKTRKR5PGjIkiilnPe7WuIwKEYAhJcJChf7ELyqiNC7Tuq4R YS54QEVgGLwtu/4YEA/Gy2orZ9msYbpe61/FwlDKenDPNiIdmZ3bxnDhq3xaIdiaEg 12DLwDBB9TsWQP+qNv94ojTlc9oQ8gneHCexaOOg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 118/231] icmp: Fix a data-race around sysctl_icmp_ratemask. Date: Tue, 19 Jul 2022 13:53:23 +0200 Message-Id: <20220719114724.397875539@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 1ebcb25ad6fc3d50fca87350acf451b9a66dd31e ] While reading sysctl_icmp_ratemask, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/icmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 41efb7381859..c13ceda9ce5d 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -282,7 +282,7 @@ static bool icmpv4_mask_allow(struct net *net, int type= , int code) return true; =20 /* Limit if icmp type is enabled in ratemask. */ - if (!((1 << type) & net->ipv4.sysctl_icmp_ratemask)) + if (!((1 << type) & READ_ONCE(net->ipv4.sysctl_icmp_ratemask))) return true; =20 return false; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F1E2C43334 for ; Tue, 19 Jul 2022 13:02:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242758AbiGSNCd (ORCPT ); Tue, 19 Jul 2022 09:02:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242837AbiGSM7l (ORCPT ); Tue, 19 Jul 2022 08:59:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03A6F1E3D1; Tue, 19 Jul 2022 05:25:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 09CE4B81B25; Tue, 19 Jul 2022 12:25:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26AD8C341D8; Tue, 19 Jul 2022 12:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233509; bh=cZgTHkVtlok+T5XHfZpzvaVm/8OrIF2Ls//nqAw6xA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=odjdd8c7beappH1ntOHKo1ZLqCm0IZ4NYRJWHHalnVlRygIT46HGXoXbXFO5KhjiK gNNpKBAFmTY7mhxZalCeqOWasPo01iXHMDiKyDwATvojWJj5mr5ZII+PliY1K1Xwd9 N8TP+OUTqy5o5mlfCU9QfMZzxamTrrFiDcnJsp/w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 119/231] raw: Fix a data-race around sysctl_raw_l3mdev_accept. Date: Tue, 19 Jul 2022 13:53:24 +0200 Message-Id: <20220719114724.471593392@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 1dace014928e6e385363032d359a04dee9158af0 ] While reading sysctl_raw_l3mdev_accept, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 6897445fb194 ("net: provide a sysctl raw_l3mdev_accept for raw socke= t lookup with VRFs") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/net/raw.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/raw.h b/include/net/raw.h index 8ad8df594853..c51a635671a7 100644 --- a/include/net/raw.h +++ b/include/net/raw.h @@ -75,7 +75,7 @@ static inline bool raw_sk_bound_dev_eq(struct net *net, i= nt bound_dev_if, int dif, int sdif) { #if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV) - return inet_bound_dev_eq(!!net->ipv4.sysctl_raw_l3mdev_accept, + return inet_bound_dev_eq(READ_ONCE(net->ipv4.sysctl_raw_l3mdev_accept), bound_dev_if, dif, sdif); #else return inet_bound_dev_eq(true, bound_dev_if, dif, sdif); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28004C43334 for ; Tue, 19 Jul 2022 13:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242913AbiGSND7 (ORCPT ); Tue, 19 Jul 2022 09:03:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242849AbiGSM7m (ORCPT ); Tue, 19 Jul 2022 08:59:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 727E42F02C; Tue, 19 Jul 2022 05:25:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 914E7618F1; Tue, 19 Jul 2022 12:25:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6494DC341D0; Tue, 19 Jul 2022 12:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233512; bh=9Dpr3W6uGf7xets34ZXk9jwqgVe8iCvMPbxopTKleiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=scH9DiSYPGwEhvZ6TDf1Zy7t3bJNv2wVaD4zUUUcpxGqwO9Wq9tvZtfTav0PJf8QU wfLyw6gdcBh5k1pmDXspxpxcYwXgVYaxSLZCK7/K8s8uMCKscwueTGTwXTX1wjJGuv pbTuiKFokyYkWTcCKk3g+/CzVnCWA14ViED7mto4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 120/231] tcp: Fix data-races around sysctl_tcp_ecn. Date: Tue, 19 Jul 2022 13:53:25 +0200 Message-Id: <20220719114724.545069902@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 4785a66702f086cf2ea84bdbe6ec921f274bd9f2 ] While reading sysctl_tcp_ecn, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c | 2 +- net/ipv4/syncookies.c | 2 +- net/ipv4/sysctl_net_ipv4.c | 2 ++ net/ipv4/tcp_input.c | 2 +- net/ipv4/tcp_output.c | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c b/= drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c index 4af5561cbfc5..7c760aa65540 100644 --- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c +++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c @@ -1392,7 +1392,7 @@ static void chtls_pass_accept_request(struct sock *sk, th_ecn =3D tcph->ece && tcph->cwr; if (th_ecn) { ect =3D !INET_ECN_is_not_ect(ip_dsfield); - ecn_ok =3D sock_net(sk)->ipv4.sysctl_tcp_ecn; + ecn_ok =3D READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_ecn); if ((!ect && ecn_ok) || tcp_ca_needs_ecn(sk)) inet_rsk(oreq)->ecn_ok =3D 1; } diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index f33c31dd7366..b387c4835155 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c @@ -273,7 +273,7 @@ bool cookie_ecn_ok(const struct tcp_options_received *t= cp_opt, if (!ecn_ok) return false; =20 - if (net->ipv4.sysctl_tcp_ecn) + if (READ_ONCE(net->ipv4.sysctl_tcp_ecn)) return true; =20 return dst_feature(dst, RTAX_FEATURE_ECN); diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 33e65e79e46e..11add5214713 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -680,6 +680,8 @@ static struct ctl_table ipv4_net_table[] =3D { .maxlen =3D sizeof(u8), .mode =3D 0644, .proc_handler =3D proc_dou8vec_minmax, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_TWO, }, { .procname =3D "tcp_ecn_fallback", diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 6b8fcf79688b..2d71bcfcc759 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -6712,7 +6712,7 @@ static void tcp_ecn_create_request(struct request_soc= k *req, =20 ect =3D !INET_ECN_is_not_ect(TCP_SKB_CB(skb)->ip_dsfield); ecn_ok_dst =3D dst_feature(dst, DST_FEATURE_ECN_MASK); - ecn_ok =3D net->ipv4.sysctl_tcp_ecn || ecn_ok_dst; + ecn_ok =3D READ_ONCE(net->ipv4.sysctl_tcp_ecn) || ecn_ok_dst; =20 if (((!ect || th->res1) && ecn_ok) || tcp_ca_needs_ecn(listen_sk) || (ecn_ok_dst & DST_FEATURE_ECN_CA) || diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 6b00c17c72aa..9eefe7f6370f 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -324,7 +324,7 @@ static void tcp_ecn_send_syn(struct sock *sk, struct sk= _buff *skb) { struct tcp_sock *tp =3D tcp_sk(sk); bool bpf_needs_ecn =3D tcp_bpf_ca_needs_ecn(sk); - bool use_ecn =3D sock_net(sk)->ipv4.sysctl_tcp_ecn =3D=3D 1 || + bool use_ecn =3D READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_ecn) =3D=3D 1 || tcp_ca_needs_ecn(sk) || bpf_needs_ecn; =20 if (!use_ecn) { --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E009C433EF for ; Tue, 19 Jul 2022 13:02:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242590AbiGSNCh (ORCPT ); Tue, 19 Jul 2022 09:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242919AbiGSM7t (ORCPT ); Tue, 19 Jul 2022 08:59:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBA4E4BD06; Tue, 19 Jul 2022 05:25:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 13D58B81B82; Tue, 19 Jul 2022 12:25:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AF8DC341C6; Tue, 19 Jul 2022 12:25:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233515; bh=LNbB8tIV6AgkH04KAZ85y76xz1DHDWBXK4uA1vgSrE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y5JddwXX3gNtKscOAmEMCC2B3eg/AysmDtjAhOd66koG5S1rB3b0p+5SslRWpZ1lQ mrSImOgMxDAwndMQ++2kOIDb87zQlf6Yyib+izIAxnwXW5lakDoUsb5TEmM2DmF6sO eXsneFcFXfv/lF8cgwn1ksgv0GXa6wuCiEcJojIk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 121/231] tcp: Fix a data-race around sysctl_tcp_ecn_fallback. Date: Tue, 19 Jul 2022 13:53:26 +0200 Message-Id: <20220719114724.628158175@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 12b8d9ca7e678abc48195294494f1815b555d658 ] While reading sysctl_tcp_ecn_fallback, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 492135557dc0 ("tcp: add rfc3168, section 6.1.1.1. fallback") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/sysctl_net_ipv4.c | 2 ++ net/ipv4/tcp_output.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 11add5214713..ffe0264a51b8 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -689,6 +689,8 @@ static struct ctl_table ipv4_net_table[] =3D { .maxlen =3D sizeof(u8), .mode =3D 0644, .proc_handler =3D proc_dou8vec_minmax, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE, }, { .procname =3D "ip_dynaddr", diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 9eefe7f6370f..34249469e361 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -346,7 +346,7 @@ static void tcp_ecn_send_syn(struct sock *sk, struct sk= _buff *skb) =20 static void tcp_ecn_clear_syn(struct sock *sk, struct sk_buff *skb) { - if (sock_net(sk)->ipv4.sysctl_tcp_ecn_fallback) + if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_ecn_fallback)) /* tp->ecn_flags are cleared at a later point in time when * SYN ACK is ultimatively being received. */ --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 531A6C43334 for ; Tue, 19 Jul 2022 13:02:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242799AbiGSNCk (ORCPT ); Tue, 19 Jul 2022 09:02:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242912AbiGSM7t (ORCPT ); Tue, 19 Jul 2022 08:59:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 542824A81E; Tue, 19 Jul 2022 05:25:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7C556618E6; Tue, 19 Jul 2022 12:25:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C822C341C6; Tue, 19 Jul 2022 12:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233518; bh=7dSLYIHIm3EYBlEfEPcwTq3M191ou+GChuS+y1uPKGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k95yboQir4yB29lW9ZP35grHOuvFHCbOTGElpdvHYf+qSpW1S7wtmHGL8XB5Wyxs5 6ZGlwUhGiug0sTbOPyldWLURToMGR5YRJrvRlulvNUwZwmMR5+b7yZhGD/+vWB/9Yk rVONtc5iopmXEsh6KY5kmJFxtcfmIiRNijxQCmAE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 122/231] ipv4: Fix data-races around sysctl_ip_dynaddr. Date: Tue, 19 Jul 2022 13:53:27 +0200 Message-Id: <20220719114724.709039768@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit e49e4aff7ec19b2d0d0957ee30e93dade57dab9e ] While reading sysctl_ip_dynaddr, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- Documentation/networking/ip-sysctl.rst | 2 +- net/ipv4/af_inet.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/network= ing/ip-sysctl.rst index 8ffed7135fc1..8899b474edbf 100644 --- a/Documentation/networking/ip-sysctl.rst +++ b/Documentation/networking/ip-sysctl.rst @@ -1179,7 +1179,7 @@ ip_autobind_reuse - BOOLEAN option should only be set by experts. Default: 0 =20 -ip_dynaddr - BOOLEAN +ip_dynaddr - INTEGER If set non-zero, enables support for dynamic addresses. If set to a non-zero value larger than 1, a kernel log message will be printed when dynamic address rewriting diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 72fde2888ad2..98bc180563d1 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1247,7 +1247,7 @@ static int inet_sk_reselect_saddr(struct sock *sk) if (new_saddr =3D=3D old_saddr) return 0; =20 - if (sock_net(sk)->ipv4.sysctl_ip_dynaddr > 1) { + if (READ_ONCE(sock_net(sk)->ipv4.sysctl_ip_dynaddr) > 1) { pr_info("%s(): shifting inet->saddr from %pI4 to %pI4\n", __func__, &old_saddr, &new_saddr); } @@ -1302,7 +1302,7 @@ int inet_sk_rebuild_header(struct sock *sk) * Other protocols have to map its equivalent state to TCP_SYN_SENT. * DCCP maps its DCCP_REQUESTING state to TCP_SYN_SENT. -acme */ - if (!sock_net(sk)->ipv4.sysctl_ip_dynaddr || + if (!READ_ONCE(sock_net(sk)->ipv4.sysctl_ip_dynaddr) || sk->sk_state !=3D TCP_SYN_SENT || (sk->sk_userlocks & SOCK_BINDADDR_LOCK) || (err =3D inet_sk_reselect_saddr(sk)) !=3D 0) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0D79C433EF for ; Tue, 19 Jul 2022 13:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242802AbiGSNCp (ORCPT ); Tue, 19 Jul 2022 09:02:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242971AbiGSM7y (ORCPT ); Tue, 19 Jul 2022 08:59:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 580F95007D; Tue, 19 Jul 2022 05:25:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 547A16182C; Tue, 19 Jul 2022 12:25:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2592BC341C6; Tue, 19 Jul 2022 12:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233521; bh=W61HKVJbMsqMD6iutIUHFWIUDrrKWcXaFRcxexO6GVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dzoYzyCYCRsJpl3pD3Lscfcn4axl5FoCtyyE14ZDH878iLGpcv6zOtOleOu8lAwSr osBaeHH3sngGlureeNwxzfZjJNYkW9Tb9SVuMEh4nRM/z0eDQ217Pl5YSbqEzlvJkG Q5+vrnWzTg7i1A3+RxYoDZmnu5OCooRdzIIVoakc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 123/231] nexthop: Fix data-races around nexthop_compat_mode. Date: Tue, 19 Jul 2022 13:53:28 +0200 Message-Id: <20220719114724.792687497@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit bdf00bf24bef9be1ca641a6390fd5487873e0d2e ] While reading nexthop_compat_mode, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: 4f80116d3df3 ("net: ipv4: add sysctl for nexthop api compatibility m= ode") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/fib_semantics.c | 2 +- net/ipv4/nexthop.c | 5 +++-- net/ipv6/route.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -1811,7 +1811,7 @@ int fib_dump_info(struct sk_buff *skb, u goto nla_put_failure; if (nexthop_is_blackhole(fi->nh)) rtm->rtm_type =3D RTN_BLACKHOLE; - if (!fi->fib_net->ipv4.sysctl_nexthop_compat_mode) + if (!READ_ONCE(fi->fib_net->ipv4.sysctl_nexthop_compat_mode)) goto offload; } =20 --- a/net/ipv4/nexthop.c +++ b/net/ipv4/nexthop.c @@ -1858,7 +1858,7 @@ static void __remove_nexthop_fib(struct /* __ip6_del_rt does a release, so do a hold here */ fib6_info_hold(f6i); ipv6_stub->ip6_del_rt(net, f6i, - !net->ipv4.sysctl_nexthop_compat_mode); + !READ_ONCE(net->ipv4.sysctl_nexthop_compat_mode)); } } =20 @@ -2361,7 +2361,8 @@ out: if (!rc) { nh_base_seq_inc(net); nexthop_notify(RTM_NEWNEXTHOP, new_nh, &cfg->nlinfo); - if (replace_notify && net->ipv4.sysctl_nexthop_compat_mode) + if (replace_notify && + READ_ONCE(net->ipv4.sysctl_nexthop_compat_mode)) nexthop_replace_notify(net, new_nh, &cfg->nlinfo); } =20 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -5737,7 +5737,7 @@ static int rt6_fill_node(struct net *net if (nexthop_is_blackhole(rt->nh)) rtm->rtm_type =3D RTN_BLACKHOLE; =20 - if (net->ipv4.sysctl_nexthop_compat_mode && + if (READ_ONCE(net->ipv4.sysctl_nexthop_compat_mode) && rt6_fill_node_nexthop(skb, rt->nh, &nh_flags) < 0) goto nla_put_failure; From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EA62C433EF for ; Tue, 19 Jul 2022 13:02:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242742AbiGSNCr (ORCPT ); Tue, 19 Jul 2022 09:02:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242988AbiGSM7z (ORCPT ); Tue, 19 Jul 2022 08:59:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 112345C976; Tue, 19 Jul 2022 05:25:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2204C61924; Tue, 19 Jul 2022 12:25:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01987C341C6; Tue, 19 Jul 2022 12:25:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233524; bh=Q/LC8x8u1BICLPDe82F7RyQjByOA98Fh4+OHqOj3ey0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bQ9+idosvDfudSTxY38YvKnH7q7cnvj+ZoaRCw4AteGpo95IkuUDA9VvRuFaTw9vv A1Phirj/MsvlfQ47sikUI5U1efM9EFPfKy4zVZ+EcCGnyzHYpL2J1+NfxdGGlwgjZW 0ZxR3MxHkibompJSFZwHS4OGuWaWaC0r6W/66H9k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 124/231] net: ftgmac100: Hold reference returned by of_get_child_by_name() Date: Tue, 19 Jul 2022 13:53:29 +0200 Message-Id: <20220719114724.883323292@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 49b9f431ff0d845a36be0b3ede35ec324f2e5fee ] In ftgmac100_probe(), we should hold the refernece returned by of_get_child_by_name() and use it to call of_node_put() for reference balance. Fixes: 39bfab8844a0 ("net: ftgmac100: Add support for DT phy-handle propert= y") Signed-off-by: Liang He Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/faraday/ftgmac100.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index 5231818943c6..c03663785a8d 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1764,6 +1764,19 @@ static int ftgmac100_setup_clk(struct ftgmac100 *pri= v) return rc; } =20 +static bool ftgmac100_has_child_node(struct device_node *np, const char *n= ame) +{ + struct device_node *child_np =3D of_get_child_by_name(np, name); + bool ret =3D false; + + if (child_np) { + ret =3D true; + of_node_put(child_np); + } + + return ret; +} + static int ftgmac100_probe(struct platform_device *pdev) { struct resource *res; @@ -1883,7 +1896,7 @@ static int ftgmac100_probe(struct platform_device *pd= ev) =20 /* Display what we found */ phy_attached_info(phy); - } else if (np && !of_get_child_by_name(np, "mdio")) { + } else if (np && !ftgmac100_has_child_node(np, "mdio")) { /* Support legacy ASPEED devicetree descriptions that decribe a * MAC with an embedded MDIO controller but have no "mdio" * child node. Automatically scan the MDIO bus for available --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1B36C43334 for ; Tue, 19 Jul 2022 13:02:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242813AbiGSNCu (ORCPT ); Tue, 19 Jul 2022 09:02:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243033AbiGSNAI (ORCPT ); Tue, 19 Jul 2022 09:00:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69D5B60697; Tue, 19 Jul 2022 05:25:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7104CB81B21; Tue, 19 Jul 2022 12:25:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D647DC341CB; Tue, 19 Jul 2022 12:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233527; bh=4Ae9WzvhYzV9DqfC1sH5vWDfWr4NdbtZgH8jm50vzHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=or90O26Uq3doL5sixqECZLD7q6fa9O9r5zpWg0OaoxT2mmagojxyu+6r9vuJq5hUY vQms5nvLoIRp3rwXA2tyxi8Y58GXFKw8QJEz8v9FEYey3phpOuKNfl9N8gEazWEQ85 Y08yhjbYnjHXQZZMmg9u2wevx2LdDyg+q4Fw2IJg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 125/231] net: stmmac: fix leaks in probe Date: Tue, 19 Jul 2022 13:53:30 +0200 Message-Id: <20220719114724.968377404@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 23aa6d5088e3bd65de77c5c307237b9937f8b48a ] These two error paths should clean up before returning. Fixes: 2bb4b98b60d7 ("net: stmmac: Add Ingenic SoCs MAC support.") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c b/drivers/= net/ethernet/stmicro/stmmac/dwmac-ingenic.c index 9a6d819b84ae..378b4dd826bb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c @@ -273,7 +273,8 @@ static int ingenic_mac_probe(struct platform_device *pd= ev) mac->tx_delay =3D tx_delay_ps * 1000; } else { dev_err(&pdev->dev, "Invalid TX clock delay: %dps\n", tx_delay_ps); - return -EINVAL; + ret =3D -EINVAL; + goto err_remove_config_dt; } } =20 @@ -283,7 +284,8 @@ static int ingenic_mac_probe(struct platform_device *pd= ev) mac->rx_delay =3D rx_delay_ps * 1000; } else { dev_err(&pdev->dev, "Invalid RX clock delay: %dps\n", rx_delay_ps); - return -EINVAL; + ret =3D -EINVAL; + goto err_remove_config_dt; } } =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF319CCA486 for ; Tue, 19 Jul 2022 13:01:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239079AbiGSNBN (ORCPT ); Tue, 19 Jul 2022 09:01:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242633AbiGSM7S (ORCPT ); Tue, 19 Jul 2022 08:59:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4246A45F4C; Tue, 19 Jul 2022 05:24:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C8D40618E1; Tue, 19 Jul 2022 12:24:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74B36C341DB; Tue, 19 Jul 2022 12:24:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233447; bh=WYLhbyzG+PR2L8bSmowbBE5Xtl4RQvgXzIf3PnAW4mc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pzyZ1jOGxi3WQBRIS6TePEYUQ+eXa/r/S07i1wY4aeqhKiyTTNPq1W4YxkyFmYDu0 28zgMNclAMtvaIIXjARnAZ0v1SQq2K+hMVOl5ItB6hvIT6hjACsVQN59Mc4r+ybsTK 7+9b7NwYN9KXVeBc8hukYJqNaLn8PAC5JdBHhmkg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Coiby Xu , Mimi Zohar , Sasha Levin Subject: [PATCH 5.18 126/231] ima: force signature verification when CONFIG_KEXEC_SIG is configured Date: Tue, 19 Jul 2022 13:53:31 +0200 Message-Id: <20220719114725.050016696@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Coiby Xu [ Upstream commit af16df54b89dee72df253abc5e7b5e8a6d16c11c ] Currently, an unsigned kernel could be kexec'ed when IMA arch specific policy is configured unless lockdown is enabled. Enforce kernel signature verification check in the kexec_file_load syscall when IMA arch specific policy is configured. Fixes: 99d5cadfde2b ("kexec_file: split KEXEC_VERIFY_SIG into KEXEC_SIG and= KEXEC_SIG_FORCE") Reported-and-suggested-by: Mimi Zohar Signed-off-by: Coiby Xu Signed-off-by: Mimi Zohar Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/linux/kexec.h | 6 ++++++ kernel/kexec_file.c | 11 ++++++++++- security/integrity/ima/ima_efi.c | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index fcd5035209f1..8d573baaab29 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -452,6 +452,12 @@ static inline int kexec_crash_loaded(void) { return 0;= } #define kexec_in_progress false #endif /* CONFIG_KEXEC_CORE */ =20 +#ifdef CONFIG_KEXEC_SIG +void set_kexec_sig_enforced(void); +#else +static inline void set_kexec_sig_enforced(void) {} +#endif + #endif /* !defined(__ASSEBMLY__) */ =20 #endif /* LINUX_KEXEC_H */ diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index c108a2a88754..bb0fb63f563c 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -29,6 +29,15 @@ #include #include "kexec_internal.h" =20 +#ifdef CONFIG_KEXEC_SIG +static bool sig_enforce =3D IS_ENABLED(CONFIG_KEXEC_SIG_FORCE); + +void set_kexec_sig_enforced(void) +{ + sig_enforce =3D true; +} +#endif + static int kexec_calculate_store_digests(struct kimage *image); =20 /* @@ -159,7 +168,7 @@ kimage_validate_signature(struct kimage *image) image->kernel_buf_len); if (ret) { =20 - if (IS_ENABLED(CONFIG_KEXEC_SIG_FORCE)) { + if (sig_enforce) { pr_notice("Enforced kernel signature verification failed (%d).\n", ret); return ret; } diff --git a/security/integrity/ima/ima_efi.c b/security/integrity/ima/ima_= efi.c index 71786d01946f..9db66fe310d4 100644 --- a/security/integrity/ima/ima_efi.c +++ b/security/integrity/ima/ima_efi.c @@ -67,6 +67,8 @@ const char * const *arch_get_ima_policy(void) if (IS_ENABLED(CONFIG_IMA_ARCH_POLICY) && arch_ima_get_secureboot()) { if (IS_ENABLED(CONFIG_MODULE_SIG)) set_module_sig_enforced(); + if (IS_ENABLED(CONFIG_KEXEC_SIG)) + set_kexec_sig_enforced(); return sb_arch_rules; } return NULL; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE29FC43334 for ; Tue, 19 Jul 2022 13:01:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242546AbiGSNBW (ORCPT ); Tue, 19 Jul 2022 09:01:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242651AbiGSM7U (ORCPT ); Tue, 19 Jul 2022 08:59:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6AB64F66E; Tue, 19 Jul 2022 05:24:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0E1D8618E1; Tue, 19 Jul 2022 12:24:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91995C36AE2; Tue, 19 Jul 2022 12:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233450; bh=sXZL6Z37ACoS8mPQ/3ZughF+dsMb+90JYpKbHlk9Vzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ir/5L5pW1k+ii+R3A+aHbiBBXvZq8LolI5r68Fy52uO7Vf9bF4pYjVwanjI5PiTrT 7M0WQmiVrH78TBVONR1hb7XKBGkdm4kQ4qJvbZjlE8Gjj9SJKf0ElPxRqA3DpEW8m9 XoXeJpYNnghSOJdcHh+D00bZeDbZ/ndRVRIuDtjk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Mimi Zohar , Sasha Levin Subject: [PATCH 5.18 127/231] ima: Fix potential memory leak in ima_init_crypto() Date: Tue, 19 Jul 2022 13:53:32 +0200 Message-Id: <20220719114725.132383911@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jianglei Nie [ Upstream commit 067d2521874135267e681c19d42761c601d503d6 ] On failure to allocate the SHA1 tfm, IMA fails to initialize and exits without freeing the ima_algo_array. Add the missing kfree() for ima_algo_array to avoid the potential memory leak. Signed-off-by: Jianglei Nie Fixes: 6d94809af6b0 ("ima: Allocate and initialize tfm for each PCR bank") Signed-off-by: Mimi Zohar Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- security/integrity/ima/ima_crypto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/i= ma_crypto.c index a7206cc1d7d1..64499056648a 100644 --- a/security/integrity/ima/ima_crypto.c +++ b/security/integrity/ima/ima_crypto.c @@ -205,6 +205,7 @@ int __init ima_init_crypto(void) =20 crypto_free_shash(ima_algo_array[i].tfm); } + kfree(ima_algo_array); out: crypto_free_shash(ima_shash_tfm); return rc; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CF9BC43334 for ; Tue, 19 Jul 2022 13:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242886AbiGSNDj (ORCPT ); Tue, 19 Jul 2022 09:03:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239532AbiGSM7V (ORCPT ); Tue, 19 Jul 2022 08:59:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FA2149B60; Tue, 19 Jul 2022 05:24:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E056761922; Tue, 19 Jul 2022 12:24:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7962C341DC; Tue, 19 Jul 2022 12:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233453; bh=mPWFpi/NvBUG7VpmrRy9y9gCA5c8Z8stgsW5SFbdZ2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HaRjCKKSE8fD3UnkQF68uIWrlbNY4odHPONtNfSwq8y/COM3zF+neHLPo1Ab00xN+ m5b6C/onLGVFcb6EiLJq6QsNEX5h73JFwGoSCe7e9IBqy+tVFPeLBwF7OSNfy2esb8 ZhadPV2eASJXxMhp9YXm3e2IzP1tXOnuHwkNO+7U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fangzhi Zuo , Solomon Chiu , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 128/231] drm/amd/display: Ignore First MST Sideband Message Return Error Date: Tue, 19 Jul 2022 13:53:33 +0200 Message-Id: <20220719114725.221481298@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fangzhi Zuo [ Upstream commit acea108fa067d140bd155161a79b1fcd967f4137 ] [why] First MST sideband message returns AUX_RET_ERROR_HPD_DISCON on certain intel platform. Aux transaction considered failure if HPD unexpected pulled low. The actual aux transaction success in such case, hence do not return error. [how] Not returning error when AUX_RET_ERROR_HPD_DISCON detected on the first sideband message. v2: squash in additional DMI entries v3: squash in static fix Signed-off-by: Fangzhi Zuo Acked-by: Solomon Chiu Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 39 +++++++++++++++++++ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 8 ++++ .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 17 ++++++++ 3 files changed, 64 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gp= u/drm/amd/display/amdgpu_dm/amdgpu_dm.c index b55a433e829e..bfbd701a4c9a 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -72,6 +72,7 @@ #include #include #include +#include =20 #include #include @@ -1391,6 +1392,41 @@ static bool dm_should_disable_stutter(struct pci_dev= *pdev) return false; } =20 +static const struct dmi_system_id hpd_disconnect_quirk_table[] =3D { + { + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Precision 3660"), + }, + }, + { + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Precision 3260"), + }, + }, + { + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Precision 3460"), + }, + }, + {} +}; + +static void retrieve_dmi_info(struct amdgpu_display_manager *dm) +{ + const struct dmi_system_id *dmi_id; + + dm->aux_hpd_discon_quirk =3D false; + + dmi_id =3D dmi_first_match(hpd_disconnect_quirk_table); + if (dmi_id) { + dm->aux_hpd_discon_quirk =3D true; + DRM_INFO("aux_hpd_discon_quirk attached\n"); + } +} + static int amdgpu_dm_init(struct amdgpu_device *adev) { struct dc_init_data init_data; @@ -1521,6 +1557,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) } =20 INIT_LIST_HEAD(&adev->dm.da_list); + + retrieve_dmi_info(&adev->dm); + /* Display Core create. */ adev->dm.dc =3D dc_create(&init_data); =20 diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gp= u/drm/amd/display/amdgpu_dm/amdgpu_dm.h index 7e44b0429448..4844601a5f47 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h @@ -546,6 +546,14 @@ struct amdgpu_display_manager { * last successfully applied backlight values. */ u32 actual_brightness[AMDGPU_DM_MAX_NUM_EDP]; + + /** + * @aux_hpd_discon_quirk: + * + * quirk for hpd discon while aux is on-going. + * occurred on certain intel platform + */ + bool aux_hpd_discon_quirk; }; =20 enum dsc_clock_force_state { diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/= drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c index 31ac1fce36f8..d864cae1af67 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c @@ -58,6 +58,8 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux, ssize_t result =3D 0; struct aux_payload payload; enum aux_return_code_type operation_result; + struct amdgpu_device *adev; + struct ddc_service *ddc; =20 if (WARN_ON(msg->size > 16)) return -E2BIG; @@ -76,6 +78,21 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux, result =3D dc_link_aux_transfer_raw(TO_DM_AUX(aux)->ddc_service, &payload, &operation_result); =20 + /* + * w/a on certain intel platform where hpd is unexpected to pull low duri= ng + * 1st sideband message transaction by return AUX_RET_ERROR_HPD_DISCON + * aux transaction is succuess in such case, therefore bypass the error + */ + ddc =3D TO_DM_AUX(aux)->ddc_service; + adev =3D ddc->ctx->driver_context; + if (adev->dm.aux_hpd_discon_quirk) { + if (msg->address =3D=3D DP_SIDEBAND_MSG_DOWN_REQ_BASE && + operation_result =3D=3D AUX_RET_ERROR_HPD_DISCON) { + result =3D 0; + operation_result =3D AUX_RET_SUCCESS; + } + } + if (payload.write && result >=3D 0) result =3D msg->size; =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE23CC433EF for ; Tue, 19 Jul 2022 13:01:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242650AbiGSNBd (ORCPT ); Tue, 19 Jul 2022 09:01:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242662AbiGSM7X (ORCPT ); Tue, 19 Jul 2022 08:59:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3DD349B66; Tue, 19 Jul 2022 05:24:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 32A5261921; Tue, 19 Jul 2022 12:24:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD314C341D5; Tue, 19 Jul 2022 12:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233456; bh=rO+12WaTA7CEK346tI4sccEoEMeXEJJq6yWPr6caLSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B5v/E3FpdbmQOMcKgUTmbBm2jzgS9rxQzN328ijse26cQMyMWv9KHFcQLf/rIQDdN IZ6eKBxjErScUz2ktug/b5u6vXtw/YcwOC+C9BH+JsY9EWPRwKffMNyTMvQHhV7RgX DcvmX1acreUNKvC0P1BtRTJtl1l05LCaeUQ0OuEs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Prike Liang , Aaron Liu , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 129/231] drm/amdkfd: correct the MEC atomic support firmware checking for GC 10.3.7 Date: Tue, 19 Jul 2022 13:53:34 +0200 Message-Id: <20220719114725.304038043@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Prike Liang [ Upstream commit c0044865480a162146b9dfe7783e73a08e97b2b9 ] On the GC 10.3.7 platform the initial MEC release version #3 can support atomic operation,so need correct and set its MEC atomic support version to = #3. Signed-off-by: Prike Liang Reviewed-by: Aaron Liu Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 5.18.x Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/= amdkfd/kfd_device.c index 651498bfecc8..2059c3138410 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c @@ -158,6 +158,8 @@ static void kfd_device_info_init(struct kfd_dev *kfd, /* Navi2x+, Navi1x+ */ if (gc_version =3D=3D IP_VERSION(10, 3, 6)) kfd->device_info.no_atomic_fw_version =3D 14; + else if (gc_version =3D=3D IP_VERSION(10, 3, 7)) + kfd->device_info.no_atomic_fw_version =3D 3; else if (gc_version >=3D IP_VERSION(10, 3, 0)) kfd->device_info.no_atomic_fw_version =3D 92; else if (gc_version >=3D IP_VERSION(10, 1, 1)) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D684FC43334 for ; Tue, 19 Jul 2022 13:01:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242681AbiGSNBg (ORCPT ); Tue, 19 Jul 2022 09:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242665AbiGSM7Y (ORCPT ); Tue, 19 Jul 2022 08:59:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79EE149B74; Tue, 19 Jul 2022 05:24:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EA57BB81B80; Tue, 19 Jul 2022 12:24:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 052C4C341E4; Tue, 19 Jul 2022 12:24:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233459; bh=mukEhGxDxYqsZJvDjalyuz6QK5fWbcNu3bfkO6/Zbvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FY/DsKqS1CqqDRs7pnDWuSardJPeX7Zx3b8dg4n+Cn4IUk01D+f8ZN/XACaM9Z/lP nFOsO/TlNtYYEmsFzvUaVKj8ii77VRvzeEXjjbujRG1F1UOH1JSEbXqTLhsdVGBHgP t94WvI1zOTKfUEKgjX8voNIyZsfL3B7ChrUKn6rw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Kleiner , Alex Deucher , Harry Wentland , Sasha Levin Subject: [PATCH 5.18 130/231] drm/amd/display: Only use depth 36 bpp linebuffers on DCN display engines. Date: Tue, 19 Jul 2022 13:53:35 +0200 Message-Id: <20220719114725.387633231@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mario Kleiner [ Upstream commit add61d3c31de6a4b5e11a2ab96aaf4c873481568 ] Various DCE versions had trouble with 36 bpp lb depth, requiring fixes, last time in commit 353ca0fa5630 ("drm/amd/display: Fix 10bit 4K display on CIK GPUs") for DCE-8. So far >=3D DCE-11.2 was considered ok, but now I found out that on DCE-11.2 it causes dithering when there shouldn't be any, so identity pixel passthrough with identity gamma LUTs doesn't work when it should. This breaks various important neuroscience applications, as reported to me by scientific users of Polaris cards under Ubuntu 22.04 with Linux 5.15, and confirmed by testing it myself on DCE-11.2. Lets only use depth 36 for DCN engines, where my testing showed that it is both necessary for high color precision output, e.g., RGBA16 fb's, and not harmful, as far as more than one year in real-world use showed. DCE engines seem to work fine for high precision output at 30 bpp, so this ("famous last words") depth 30 should hopefully fix all known problems without introducing new ones. Successfully retested on DCE-11.2 Polaris and DCN-1.0 Raven Ridge on top of Linux 5.19.0-rc2 + drm-next. Fixes: 353ca0fa5630 ("drm/amd/display: Fix 10bit 4K display on CIK GPUs") Signed-off-by: Mario Kleiner Tested-by: Mario Kleiner Cc: stable@vger.kernel.org # 5.14.0 Cc: Alex Deucher Cc: Harry Wentland Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gp= u/drm/amd/display/dc/core/dc_resource.c index d251c3f3a714..5cdbd2b8aa4d 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -1113,12 +1113,13 @@ bool resource_build_scaling_params(struct pipe_ctx = *pipe_ctx) * on certain displays, such as the Sharp 4k. 36bpp is needed * to support SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 and * SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616 with actual > 10 bpc - * precision on at least DCN display engines. However, at least - * Carrizo with DCE_VERSION_11_0 does not like 36 bpp lb depth, - * so use only 30 bpp on DCE_VERSION_11_0. Testing with DCE 11.2 and 8.3 - * did not show such problems, so this seems to be the exception. + * precision on DCN display engines, but apparently not for DCE, as + * far as testing on DCE-11.2 and DCE-8 showed. Various DCE parts have + * problems: Carrizo with DCE_VERSION_11_0 does not like 36 bpp lb depth, + * neither do DCE-8 at 4k resolution, or DCE-11.2 (broken identify pixel + * passthrough). Therefore only use 36 bpp on DCN where it is actually ne= eded. */ - if (plane_state->ctx->dce_version > DCE_VERSION_11_0) + if (plane_state->ctx->dce_version > DCE_VERSION_MAX) pipe_ctx->plane_res.scl_data.lb_params.depth =3D LB_PIXEL_DEPTH_36BPP; else pipe_ctx->plane_res.scl_data.lb_params.depth =3D LB_PIXEL_DEPTH_30BPP; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4342BC433EF for ; Tue, 19 Jul 2022 13:03:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242891AbiGSNDp (ORCPT ); Tue, 19 Jul 2022 09:03:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242677AbiGSM7Z (ORCPT ); Tue, 19 Jul 2022 08:59:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 696EC4F673; Tue, 19 Jul 2022 05:24:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 09146B81B38; Tue, 19 Jul 2022 12:24:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 172DAC385A2; Tue, 19 Jul 2022 12:24:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233462; bh=gPzFQAuMIDgC5aBGExLik2rUKlCn5pdg2+zrDFcH3ec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IVb1Qh1fo6i90cDATKqjcfI0ORQ+0DP4WG3D0kCV/JjGJ1pVvMwfL3txl23hYEie4 4AwR9NUP/cINkJ+RdPRJiCLHYfB0t+4c2ia3EMXeD5ZhrurBBuZ0cb7ZczKlBty8OJ EsVw4RRbEkRZ7ZFkk1gFJMJ3A+Avt3hiKS1RjQH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , =?UTF-8?q?Andr=C3=A9=20Almeida?= , Yefim Barashkin , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 131/231] drm/amd/pm: Prevent divide by zero Date: Tue, 19 Jul 2022 13:53:36 +0200 Message-Id: <20220719114725.466922271@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yefim Barashkin [ Upstream commit 0638c98c17aa12fe914459c82cd178247e21fb2b ] divide error: 0000 [#1] SMP PTI CPU: 3 PID: 78925 Comm: tee Not tainted 5.15.50-1-lts #1 Hardware name: MSI MS-7A59/Z270 SLI PLUS (MS-7A59), BIOS 1.90 01/30/2018 RIP: 0010:smu_v11_0_set_fan_speed_rpm+0x11/0x110 [amdgpu] Speed is user-configurable through a file. I accidentally set it to zero, and the driver crashed. Reviewed-by: Evan Quan Reviewed-by: Andr=C3=A9 Almeida Signed-off-by: Yefim Barashkin Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/d= rm/amd/pm/swsmu/smu11/smu_v11_0.c index 5f8809f6990d..2fbd2926a531 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c @@ -1228,6 +1228,8 @@ int smu_v11_0_set_fan_speed_rpm(struct smu_context *s= mu, uint32_t crystal_clock_freq =3D 2500; uint32_t tach_period; =20 + if (speed =3D=3D 0) + return -EINVAL; /* * To prevent from possible overheat, some ASICs may have requirement * for minimum fan speed: --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F14A1C43334 for ; Tue, 19 Jul 2022 13:01:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242721AbiGSNBk (ORCPT ); Tue, 19 Jul 2022 09:01:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242680AbiGSM70 (ORCPT ); Tue, 19 Jul 2022 08:59:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E204945F60; Tue, 19 Jul 2022 05:24:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 788B661924; Tue, 19 Jul 2022 12:24:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48D6DC341DA; Tue, 19 Jul 2022 12:24:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233465; bh=xM1h63EzfJyAhP/Vsu8PXkT6uqn3siEWV0H/xcVOprY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iku6esDkcr51/ler92EIDPSyQJwP01GkNQhGr9rXcGM35vZiIwWsU3HSfqImN0z+i BM3GCV28K6c87DZcAW0Tdzr4EqPmlMc25k02Ufx5elKyFhg7azV3rhMSuanUo8sVkr wh1IVhk+xzpQEB5wmAH12AkREuIjZiaAW5HB0Z1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Michel=20D=C3=A4nzer?= , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 132/231] drm/amd/display: Ensure valid event timestamp for cursor-only commits Date: Tue, 19 Jul 2022 13:53:37 +0200 Message-Id: <20220719114725.544527782@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michel D=C3=A4nzer [ Upstream commit 3283c83eb6fcfbda8ea03d7149d8e42e71c5d45e ] Requires enabling the vblank machinery for them. Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2030 Signed-off-by: Michel D=C3=A4nzer Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 43 +++++++++++++++++= +++-- 1 file changed, 40 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -464,6 +464,26 @@ static void dm_pflip_high_irq(void *inte vrr_active, (int) !e); } =20 +static void dm_crtc_handle_vblank(struct amdgpu_crtc *acrtc) +{ + struct drm_crtc *crtc =3D &acrtc->base; + struct drm_device *dev =3D crtc->dev; + unsigned long flags; + + drm_crtc_handle_vblank(crtc); + + spin_lock_irqsave(&dev->event_lock, flags); + + /* Send completion event for cursor-only commits */ + if (acrtc->event && acrtc->pflip_status !=3D AMDGPU_FLIP_SUBMITTED) { + drm_crtc_send_vblank_event(crtc, acrtc->event); + drm_crtc_vblank_put(crtc); + acrtc->event =3D NULL; + } + + spin_unlock_irqrestore(&dev->event_lock, flags); +} + static void dm_vupdate_high_irq(void *interrupt_params) { struct common_irq_params *irq_params =3D interrupt_params; @@ -502,7 +522,7 @@ static void dm_vupdate_high_irq(void *in * if a pageflip happened inside front-porch. */ if (vrr_active) { - drm_crtc_handle_vblank(&acrtc->base); + dm_crtc_handle_vblank(acrtc); =20 /* BTR processing for pre-DCE12 ASICs */ if (acrtc->dm_irq_params.stream && @@ -554,7 +574,7 @@ static void dm_crtc_high_irq(void *inter * to dm_vupdate_high_irq after end of front-porch. */ if (!vrr_active) - drm_crtc_handle_vblank(&acrtc->base); + dm_crtc_handle_vblank(acrtc); =20 /** * Following stuff must happen at start of vblank, for crc @@ -9199,6 +9219,7 @@ static void amdgpu_dm_commit_planes(stru struct amdgpu_bo *abo; uint32_t target_vblank, last_flip_vblank; bool vrr_active =3D amdgpu_dm_vrr_active(acrtc_state); + bool cursor_update =3D false; bool pflip_present =3D false; struct { struct dc_surface_update surface_updates[MAX_SURFACES]; @@ -9234,8 +9255,13 @@ static void amdgpu_dm_commit_planes(stru struct dm_plane_state *dm_new_plane_state =3D to_dm_plane_state(new_plan= e_state); =20 /* Cursor plane is handled after stream updates */ - if (plane->type =3D=3D DRM_PLANE_TYPE_CURSOR) + if (plane->type =3D=3D DRM_PLANE_TYPE_CURSOR) { + if ((fb && crtc =3D=3D pcrtc) || + (old_plane_state->fb && old_plane_state->crtc =3D=3D pcrtc)) + cursor_update =3D true; + continue; + } =20 if (!fb || !crtc || pcrtc !=3D crtc) continue; @@ -9397,6 +9423,17 @@ static void amdgpu_dm_commit_planes(stru bundle->stream_update.vrr_infopacket =3D &acrtc_state->stream->vrr_infopacket; } + } else if (cursor_update && acrtc_state->active_planes > 0 && + !acrtc_state->force_dpms_off && + acrtc_attach->base.state->event) { + drm_crtc_vblank_get(pcrtc); + + spin_lock_irqsave(&pcrtc->dev->event_lock, flags); + + acrtc_attach->event =3D acrtc_attach->base.state->event; + acrtc_attach->base.state->event =3D NULL; + + spin_unlock_irqrestore(&pcrtc->dev->event_lock, flags); } =20 /* Update the planes if changed or disable if we don't have any. */ From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 748F7C433EF for ; Tue, 19 Jul 2022 13:03:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239502AbiGSNDv (ORCPT ); Tue, 19 Jul 2022 09:03:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242700AbiGSM71 (ORCPT ); Tue, 19 Jul 2022 08:59:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1CF44F680; Tue, 19 Jul 2022 05:24:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6D64BB81B29; Tue, 19 Jul 2022 12:24:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B714C341E1; Tue, 19 Jul 2022 12:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233468; bh=jD3s+6w84cU2Oi8eJMG5lj6xF1TAOiBOrVNqWZW59DI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w74KDlVI18PGN0iVT9uTpT3ceT9Kl3LJ5b5RSm3GhDceoOaY/KRoqWQM4epUpD1cc pEN2gt2PFCFa94eNGxTueglGh77eoAJHbyUuLpku4KTy+ZrCV541zqWbJV8shC5QAH DL8+2FTxppMeDVB/BteYiHEZTv3Hp2EIx/mfGOwA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julian Sikorski , Julian Sikorski , Shyam Prasad N , Steve French , Sasha Levin Subject: [PATCH 5.18 133/231] smb3: workaround negprot bug in some Samba servers Date: Tue, 19 Jul 2022 13:53:38 +0200 Message-Id: <20220719114725.618451555@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steve French [ Upstream commit 32f319183c439b239294cb2d70ada3564c4c7c39 ] Mount can now fail to older Samba servers due to a server bug handling padding at the end of the last negotiate context (negotiate contexts typically are rounded up to 8 bytes by adding padding if needed). This server bug can be avoided by switching the order of negotiate contexts, placing a negotiate context at the end that does not require padding (prior to the recent netname context fix this was the case on the client). Fixes: 73130a7b1ac9 ("smb3: fix empty netname context on secondary channels= ") Reported-by: Julian Sikorski Tested-by: Julian Sikorski Reviewed-by: Shyam Prasad N Signed-off-by: Steve French Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/cifs/smb2pdu.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 6a8a00f28b19..2e6c0f4d8449 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -571,10 +571,6 @@ assemble_neg_contexts(struct smb2_negotiate_req *req, *total_len +=3D ctxt_len; pneg_ctxt +=3D ctxt_len; =20 - build_posix_ctxt((struct smb2_posix_neg_context *)pneg_ctxt); - *total_len +=3D sizeof(struct smb2_posix_neg_context); - pneg_ctxt +=3D sizeof(struct smb2_posix_neg_context); - /* * secondary channels don't have the hostname field populated * use the hostname field in the primary channel instead @@ -586,9 +582,14 @@ assemble_neg_contexts(struct smb2_negotiate_req *req, hostname); *total_len +=3D ctxt_len; pneg_ctxt +=3D ctxt_len; - neg_context_count =3D 4; - } else /* second channels do not have a hostname */ neg_context_count =3D 3; + } else + neg_context_count =3D 2; + + build_posix_ctxt((struct smb2_posix_neg_context *)pneg_ctxt); + *total_len +=3D sizeof(struct smb2_posix_neg_context); + pneg_ctxt +=3D sizeof(struct smb2_posix_neg_context); + neg_context_count++; =20 if (server->compress_algorithm) { build_compression_ctxt((struct smb2_compression_capabilities_context *) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EAD4C433EF for ; Tue, 19 Jul 2022 13:01:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231921AbiGSNBq (ORCPT ); Tue, 19 Jul 2022 09:01:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242702AbiGSM71 (ORCPT ); Tue, 19 Jul 2022 08:59:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C05749B6A; Tue, 19 Jul 2022 05:24:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 840E6B81B25; Tue, 19 Jul 2022 12:24:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D837C341CF; Tue, 19 Jul 2022 12:24:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233472; bh=ds/jYxyr9dNl95S3HVk6w7DZ/o5Nsle7cc9jjK4Z3SM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hb4S3UwuUX/sCHsZc0re79/EUdskvdM3MOvC1kdAU2zB3S3tZcVbF/t93iqJ21DOn o87RR6TYu1KDYMAH8TErqmvZYlB/LsfknKS9jXswqobWq4/M5exxR57k6DngyEKLUe q5J0vummavTe/m1KcwceTdCJzR7/DgHrSWJ17ASM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yanghang Liu , =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= , Martin Habets , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 134/231] sfc: fix use after free when disabling sriov Date: Tue, 19 Jul 2022 13:53:39 +0200 Message-Id: <20220719114725.712936540@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: =C3=8D=C3=B1igo Huguet [ Upstream commit ebe41da5d47ac0fff877e57bd14c54dccf168827 ] Use after free is detected by kfence when disabling sriov. What was read after being freed was vf->pci_dev: it was freed from pci_disable_sriov and later read in efx_ef10_sriov_free_vf_vports, called from efx_ef10_sriov_free_vf_vswitching. Set the pointer to NULL at release time to not trying to read it later. Reproducer and dmesg log (note that kfence doesn't detect it every time): $ echo 1 > /sys/class/net/enp65s0f0np0/device/sriov_numvfs $ echo 0 > /sys/class/net/enp65s0f0np0/device/sriov_numvfs BUG: KFENCE: use-after-free read in efx_ef10_sriov_free_vf_vswitching+0x82= /0x170 [sfc] Use-after-free read at 0x00000000ff3c1ba5 (in kfence-#224): efx_ef10_sriov_free_vf_vswitching+0x82/0x170 [sfc] efx_ef10_pci_sriov_disable+0x38/0x70 [sfc] efx_pci_sriov_configure+0x24/0x40 [sfc] sriov_numvfs_store+0xfe/0x140 kernfs_fop_write_iter+0x11c/0x1b0 new_sync_write+0x11f/0x1b0 vfs_write+0x1eb/0x280 ksys_write+0x5f/0xe0 do_syscall_64+0x5c/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae kfence-#224: 0x00000000edb8ef95-0x00000000671f5ce1, size=3D2792, cache=3Dk= malloc-4k allocated by task 6771 on cpu 10 at 3137.860196s: pci_alloc_dev+0x21/0x60 pci_iov_add_virtfn+0x2a2/0x320 sriov_enable+0x212/0x3e0 efx_ef10_sriov_configure+0x67/0x80 [sfc] efx_pci_sriov_configure+0x24/0x40 [sfc] sriov_numvfs_store+0xba/0x140 kernfs_fop_write_iter+0x11c/0x1b0 new_sync_write+0x11f/0x1b0 vfs_write+0x1eb/0x280 ksys_write+0x5f/0xe0 do_syscall_64+0x5c/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae freed by task 6771 on cpu 12 at 3170.991309s: device_release+0x34/0x90 kobject_cleanup+0x3a/0x130 pci_iov_remove_virtfn+0xd9/0x120 sriov_disable+0x30/0xe0 efx_ef10_pci_sriov_disable+0x57/0x70 [sfc] efx_pci_sriov_configure+0x24/0x40 [sfc] sriov_numvfs_store+0xfe/0x140 kernfs_fop_write_iter+0x11c/0x1b0 new_sync_write+0x11f/0x1b0 vfs_write+0x1eb/0x280 ksys_write+0x5f/0xe0 do_syscall_64+0x5c/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae Fixes: 3c5eb87605e85 ("sfc: create vports for VFs and assign random MAC add= resses") Reported-by: Yanghang Liu Signed-off-by: =C3=8D=C3=B1igo Huguet Acked-by: Martin Habets Link: https://lore.kernel.org/r/20220712062642.6915-1-ihuguet@redhat.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/sfc/ef10_sriov.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/s= fc/ef10_sriov.c index 7f5aa4a8c451..92550c7e85ce 100644 --- a/drivers/net/ethernet/sfc/ef10_sriov.c +++ b/drivers/net/ethernet/sfc/ef10_sriov.c @@ -408,8 +408,9 @@ static int efx_ef10_pci_sriov_enable(struct efx_nic *ef= x, int num_vfs) static int efx_ef10_pci_sriov_disable(struct efx_nic *efx, bool force) { struct pci_dev *dev =3D efx->pci_dev; + struct efx_ef10_nic_data *nic_data =3D efx->nic_data; unsigned int vfs_assigned =3D pci_vfs_assigned(dev); - int rc =3D 0; + int i, rc =3D 0; =20 if (vfs_assigned && !force) { netif_info(efx, drv, efx->net_dev, "VFs are assigned to guests; " @@ -417,10 +418,13 @@ static int efx_ef10_pci_sriov_disable(struct efx_nic = *efx, bool force) return -EBUSY; } =20 - if (!vfs_assigned) + if (!vfs_assigned) { + for (i =3D 0; i < efx->vf_count; i++) + nic_data->vf[i].pci_dev =3D NULL; pci_disable_sriov(dev); - else + } else { rc =3D -EBUSY; + } =20 efx_ef10_sriov_free_vf_vswitching(efx); efx->vf_count =3D 0; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 357FCC43334 for ; Tue, 19 Jul 2022 13:02:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242766AbiGSNCF (ORCPT ); Tue, 19 Jul 2022 09:02:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242703AbiGSM72 (ORCPT ); Tue, 19 Jul 2022 08:59:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03F6149B7B; Tue, 19 Jul 2022 05:24:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8954AB81B21; Tue, 19 Jul 2022 12:24:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2AF7C385A2; Tue, 19 Jul 2022 12:24:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233475; bh=34nY3cGcXUqpygCFQdRtZUmjMo5CnWbwj99e4WJuw6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bbXYtX3WmU+c9EYKDTJCcUp8Je44avSZ6/dMkWj4/AB7vj91Fx5Q2DCiOMa6J5fP0 mDWrU6jUKSfGiUXaktKUC2NUr0MfM1qyt4wKSrXW45EvP0cZYZWPl8Ir79S1+seJ1K 9vtKEdGvlWsUTVh0QHHUHlHEGFO4BY5+FEW78CmQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiubo Li , David Howells , Bagas Sanjaya , Ilya Dryomov , Sasha Levin Subject: [PATCH 5.18 135/231] netfs: do not unlock and put the folio twice Date: Tue, 19 Jul 2022 13:53:40 +0200 Message-Id: <20220719114725.789597627@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiubo Li [ Upstream commit fac47b43c760ea90e64b895dba60df0327be7775 ] check_write_begin() will unlock and put the folio when return non-zero. So we should avoid unlocking and putting it twice in netfs layer. Change the way ->check_write_begin() works in the following two ways: (1) Pass it a pointer to the folio pointer, allowing it to unlock and put the folio prior to doing the stuff it wants to do, provided it clears the folio pointer. (2) Change the return values such that 0 with folio pointer set means continue, 0 with folio pointer cleared means re-get and all error codes indicating an error (no special treatment for -EAGAIN). [ bagasdotme: use Sphinx code text syntax for *foliop pointer ] Cc: stable@vger.kernel.org Link: https://tracker.ceph.com/issues/56423 Link: https://lore.kernel.org/r/cf169f43-8ee7-8697-25da-0204d1b4343e@redhat= .com Co-developed-by: David Howells Signed-off-by: Xiubo Li Signed-off-by: David Howells Signed-off-by: Bagas Sanjaya Signed-off-by: Ilya Dryomov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- Documentation/filesystems/netfs_library.rst | 8 +++++--- fs/afs/file.c | 2 +- fs/ceph/addr.c | 11 ++++++----- fs/netfs/buffered_read.c | 17 ++++++++++------- include/linux/netfs.h | 2 +- 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Documentation/filesystems/netfs_library.rst b/Documentation/fi= lesystems/netfs_library.rst index 0483abcafcb0..0542358724f1 100644 --- a/Documentation/filesystems/netfs_library.rst +++ b/Documentation/filesystems/netfs_library.rst @@ -300,7 +300,7 @@ through which it can issue requests and negotiate:: void (*issue_read)(struct netfs_io_subrequest *subreq); bool (*is_still_valid)(struct netfs_io_request *rreq); int (*check_write_begin)(struct file *file, loff_t pos, unsigned len, - struct folio *folio, void **_fsdata); + struct folio **foliop, void **_fsdata); void (*done)(struct netfs_io_request *rreq); void (*cleanup)(struct address_space *mapping, void *netfs_priv); }; @@ -376,8 +376,10 @@ The operations are as follows: allocated/grabbed the folio to be modified to allow the filesystem to f= lush conflicting state before allowing it to be modified. =20 - It should return 0 if everything is now fine, -EAGAIN if the folio shou= ld be - regrabbed and any other error code to abort the operation. + It may unlock and discard the folio it was given and set the caller's f= olio + pointer to NULL. It should return 0 if everything is now fine (``*foli= op`` + left set) or the op should be retried (``*foliop`` cleared) and any oth= er + error code to abort the operation. =20 * ``done`` =20 diff --git a/fs/afs/file.c b/fs/afs/file.c index fab8324833ba..a8a5a91dc375 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c @@ -376,7 +376,7 @@ static int afs_begin_cache_operation(struct netfs_io_re= quest *rreq) } =20 static int afs_check_write_begin(struct file *file, loff_t pos, unsigned l= en, - struct folio *folio, void **_fsdata) + struct folio **foliop, void **_fsdata) { struct afs_vnode *vnode =3D AFS_FS_I(file_inode(file)); =20 diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 11dbb1133a21..ae567fb7f65a 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -63,7 +63,7 @@ (CONGESTION_ON_THRESH(congestion_kb) >> 2)) =20 static int ceph_netfs_check_write_begin(struct file *file, loff_t pos, uns= igned int len, - struct folio *folio, void **_fsdata); + struct folio **foliop, void **_fsdata); =20 static inline struct ceph_snap_context *page_snap_context(struct page *pag= e) { @@ -1285,18 +1285,19 @@ ceph_find_incompatible(struct page *page) } =20 static int ceph_netfs_check_write_begin(struct file *file, loff_t pos, uns= igned int len, - struct folio *folio, void **_fsdata) + struct folio **foliop, void **_fsdata) { struct inode *inode =3D file_inode(file); struct ceph_inode_info *ci =3D ceph_inode(inode); struct ceph_snap_context *snapc; =20 - snapc =3D ceph_find_incompatible(folio_page(folio, 0)); + snapc =3D ceph_find_incompatible(folio_page(*foliop, 0)); if (snapc) { int r; =20 - folio_unlock(folio); - folio_put(folio); + folio_unlock(*foliop); + folio_put(*foliop); + *foliop =3D NULL; if (IS_ERR(snapc)) return PTR_ERR(snapc); =20 diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c index e8e3359a4c54..8d03826c2b15 100644 --- a/fs/netfs/buffered_read.c +++ b/fs/netfs/buffered_read.c @@ -320,8 +320,9 @@ static bool netfs_skip_folio_read(struct folio *folio, = loff_t pos, size_t len, * conflicting writes once the folio is grabbed and locked. It is passed a * pointer to the fsdata cookie that gets returned to the VM to be passed = to * write_end. It is permitted to sleep. It should return 0 if the request - * should go ahead; unlock the folio and return -EAGAIN to cause the folio= to - * be regot; or return an error. + * should go ahead or it may return an error. It may also unlock and put = the + * folio, provided it sets ``*foliop`` to NULL, in which case a return of 0 + * will cause the folio to be re-got and the process to be retried. * * The calling netfs must initialise a netfs context contiguous to the vfs * inode before calling this. @@ -352,13 +353,13 @@ int netfs_write_begin(struct file *file, struct addre= ss_space *mapping, =20 if (ctx->ops->check_write_begin) { /* Allow the netfs (eg. ceph) to flush conflicts. */ - ret =3D ctx->ops->check_write_begin(file, pos, len, folio, _fsdata); + ret =3D ctx->ops->check_write_begin(file, pos, len, &folio, _fsdata); if (ret < 0) { trace_netfs_failure(NULL, NULL, ret, netfs_fail_check_write_begin); - if (ret =3D=3D -EAGAIN) - goto retry; goto error; } + if (!folio) + goto retry; } =20 if (folio_test_uptodate(folio)) @@ -420,8 +421,10 @@ int netfs_write_begin(struct file *file, struct addres= s_space *mapping, error_put: netfs_put_request(rreq, false, netfs_rreq_trace_put_failed); error: - folio_unlock(folio); - folio_put(folio); + if (folio) { + folio_unlock(folio); + folio_put(folio); + } _leave(" =3D %d", ret); return ret; } diff --git a/include/linux/netfs.h b/include/linux/netfs.h index a9c6f73877ec..95dadf0cd4b8 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -211,7 +211,7 @@ struct netfs_request_ops { void (*issue_read)(struct netfs_io_subrequest *subreq); bool (*is_still_valid)(struct netfs_io_request *rreq); int (*check_write_begin)(struct file *file, loff_t pos, unsigned len, - struct folio *folio, void **_fsdata); + struct folio **foliop, void **_fsdata); void (*done)(struct netfs_io_request *rreq); void (*cleanup)(struct address_space *mapping, void *netfs_priv); }; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B11B6C43334 for ; Tue, 19 Jul 2022 13:01:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242755AbiGSNB5 (ORCPT ); Tue, 19 Jul 2022 09:01:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242706AbiGSM72 (ORCPT ); Tue, 19 Jul 2022 08:59:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C61E74F685; Tue, 19 Jul 2022 05:24:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 53EFF61921; Tue, 19 Jul 2022 12:24:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22E5AC36AE3; Tue, 19 Jul 2022 12:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233481; bh=T0O0KgkJt/ofJDvterLLW1GOiWLpCRtQ9l7LyqAHt2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJCRuPrnXS0CdgmwHLaKQBHvQaR+xxQXENnxEE5JkZqN/e+rUKb8g3rHbo4VHuDAq cWbhFkeLcGspJVTIqYCEdn1QuhQ4JIiLVbbRlSv/or3iyVdYDnB55NFnJpZNyJZrnX /nFtsTcYsIyIY4NjACbiu0vfDWGo2bF+5r9diskQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Abeni , Andrea Mayer , Sasha Levin Subject: [PATCH 5.18 136/231] seg6: fix skb checksum evaluation in SRH encapsulation/insertion Date: Tue, 19 Jul 2022 13:53:41 +0200 Message-Id: <20220719114725.865735173@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrea Mayer [ Upstream commit df8386d13ea280d55beee1b95f61a59234a3798b ] Support for SRH encapsulation and insertion was introduced with commit 6c8702c60b88 ("ipv6: sr: add support for SRH encapsulation and injection with lwtunnels"), through the seg6_do_srh_encap() and seg6_do_srh_inline() functions, respectively. The former encapsulates the packet in an outer IPv6 header along with the SRH, while the latter inserts the SRH between the IPv6 header and the payload. Then, the headers are initialized/updated according to the operating mode (i.e., encap/inline). Finally, the skb checksum is calculated to reflect the changes applied to the headers. The IPv6 payload length ('payload_len') is not initialized within seg6_do_srh_{inline,encap}() but is deferred in seg6_do_srh(), i.e. the caller of seg6_do_srh_{inline,encap}(). However, this operation invalidates the skb checksum, since the 'payload_len' is updated only after the checksum is evaluated. To solve this issue, the initialization of the IPv6 payload length is moved from seg6_do_srh() directly into the seg6_do_srh_{inline,encap}() functions and before the skb checksum update takes place. Fixes: 6c8702c60b88 ("ipv6: sr: add support for SRH encapsulation and injec= tion with lwtunnels") Reported-by: Paolo Abeni Link: https://lore.kernel.org/all/20220705190727.69d532417be7438b15404ee1@u= niroma2.it Signed-off-by: Andrea Mayer Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv6/seg6_iptunnel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c index d64855010948..e756ba705fd9 100644 --- a/net/ipv6/seg6_iptunnel.c +++ b/net/ipv6/seg6_iptunnel.c @@ -189,6 +189,8 @@ int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_= sr_hdr *osrh, int proto) } #endif =20 + hdr->payload_len =3D htons(skb->len - sizeof(struct ipv6hdr)); + skb_postpush_rcsum(skb, hdr, tot_len); =20 return 0; @@ -241,6 +243,8 @@ int seg6_do_srh_inline(struct sk_buff *skb, struct ipv6= _sr_hdr *osrh) } #endif =20 + hdr->payload_len =3D htons(skb->len - sizeof(struct ipv6hdr)); + skb_postpush_rcsum(skb, hdr, sizeof(struct ipv6hdr) + hdrlen); =20 return 0; @@ -302,7 +306,6 @@ static int seg6_do_srh(struct sk_buff *skb) break; } =20 - ipv6_hdr(skb)->payload_len =3D htons(skb->len - sizeof(struct ipv6hdr)); skb_set_transport_header(skb, sizeof(struct ipv6hdr)); nf_reset_ct(skb); =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35450C433EF for ; Tue, 19 Jul 2022 13:02:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239626AbiGSNCB (ORCPT ); Tue, 19 Jul 2022 09:02:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242710AbiGSM72 (ORCPT ); Tue, 19 Jul 2022 08:59:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 798D04F67E; Tue, 19 Jul 2022 05:24:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2C278B81B08; Tue, 19 Jul 2022 12:24:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 554ECC385A2; Tue, 19 Jul 2022 12:24:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233484; bh=EHpPLdX0RRFghrWnI2kiLnvza5BCve9h77TBjSTdMa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F5yscIPKiQVW6UWUmzjOJ58/1jK1xP2jGeX9zmB/DzmFsSu1tXjmavpSjvaW3zXCi tO05Wz/YjitA794Sx8WgIzchsdqruqU+Gv9EO0bTEhzTQGXYJMFHPnONSNi4YwjiLg ks8sthOd+H/oarKlPg27jgj/JmRZqDKMfl0gySfc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrea Mayer , Paolo Abeni , Sasha Levin Subject: [PATCH 5.18 137/231] seg6: fix skb checksum in SRv6 End.B6 and End.B6.Encaps behaviors Date: Tue, 19 Jul 2022 13:53:42 +0200 Message-Id: <20220719114725.940385117@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrea Mayer [ Upstream commit f048880fc77058d864aff5c674af7918b30f312a ] The SRv6 End.B6 and End.B6.Encaps behaviors rely on functions seg6_do_srh_{encap,inline}() to, respectively: i) encapsulate the packet within an outer IPv6 header with the specified Segment Routing Header (SRH); ii) insert the specified SRH directly after the IPv6 header of the packet. This patch removes the initialization of the IPv6 header payload length from the input_action_end_b6{_encap}() functions, as it is now handled properly by seg6_do_srh_{encap,inline}() to avoid corruption of the skb checksum. Fixes: 140f04c33bbc ("ipv6: sr: implement several seg6local actions") Signed-off-by: Andrea Mayer Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv6/seg6_local.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c index 98a34287439c..2cd4a8d3b30a 100644 --- a/net/ipv6/seg6_local.c +++ b/net/ipv6/seg6_local.c @@ -826,7 +826,6 @@ static int input_action_end_b6(struct sk_buff *skb, str= uct seg6_local_lwt *slwt) if (err) goto drop; =20 - ipv6_hdr(skb)->payload_len =3D htons(skb->len - sizeof(struct ipv6hdr)); skb_set_transport_header(skb, sizeof(struct ipv6hdr)); =20 seg6_lookup_nexthop(skb, NULL, 0); @@ -858,7 +857,6 @@ static int input_action_end_b6_encap(struct sk_buff *sk= b, if (err) goto drop; =20 - ipv6_hdr(skb)->payload_len =3D htons(skb->len - sizeof(struct ipv6hdr)); skb_set_transport_header(skb, sizeof(struct ipv6hdr)); =20 seg6_lookup_nexthop(skb, NULL, 0); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4506EC433EF for ; Tue, 19 Jul 2022 13:01:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242736AbiGSNBs (ORCPT ); Tue, 19 Jul 2022 09:01:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242711AbiGSM72 (ORCPT ); Tue, 19 Jul 2022 08:59:28 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D513422CD; Tue, 19 Jul 2022 05:24:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D0D74CE1BCF; Tue, 19 Jul 2022 12:24:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60514C385A2; Tue, 19 Jul 2022 12:24:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233487; bh=PqrAsJ/FF2MY6nMGvixd5t6bmjHkSyaeV6AQ2pKUo2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FPNfHZtjv3yHTs1Ya8yv/X/vtLOm9JgB3n9acKjfrBRhcAXiIHaGsQCXw4XZySiz0 dRPRL25VcCANbnewOANs2XxQRKfUpsanr0vPrQ+qn/WAPfc2p6FC7msVDySSQULtZn lCOuQMIMyT2WP8m1OLry5cyIfmbILx6dDP5LB8vI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrea Mayer , Paolo Abeni , Sasha Levin Subject: [PATCH 5.18 138/231] seg6: bpf: fix skb checksum in bpf_push_seg6_encap() Date: Tue, 19 Jul 2022 13:53:43 +0200 Message-Id: <20220719114726.014296437@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrea Mayer [ Upstream commit 4889fbd98deaf243c3baadc54e296d71c6af1eb0 ] Both helper functions bpf_lwt_seg6_action() and bpf_lwt_push_encap() use the bpf_push_seg6_encap() to encapsulate the packet in an IPv6 with Segment Routing Header (SRH) or insert an SRH between the IPv6 header and the payload. To achieve this result, such helper functions rely on bpf_push_seg6_encap() which, in turn, leverages seg6_do_srh_{encap,inline}() to perform the required operation (i.e. encap/inline). This patch removes the initialization of the IPv6 header payload length from bpf_push_seg6_encap(), as it is now handled properly by seg6_do_srh_{encap,inline}() to prevent corruption of the skb checksum. Fixes: fe94cc290f53 ("bpf: Add IPv6 Segment Routing helpers") Signed-off-by: Andrea Mayer Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/core/filter.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/core/filter.c b/net/core/filter.c index af1e77f2f24a..6391c1885bca 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -6148,7 +6148,6 @@ static int bpf_push_seg6_encap(struct sk_buff *skb, u= 32 type, void *hdr, u32 len if (err) return err; =20 - ipv6_hdr(skb)->payload_len =3D htons(skb->len - sizeof(struct ipv6hdr)); skb_set_transport_header(skb, sizeof(struct ipv6hdr)); =20 return seg6_lookup_nexthop(skb, NULL, 0); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A383EC433EF for ; Tue, 19 Jul 2022 13:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242751AbiGSNCM (ORCPT ); Tue, 19 Jul 2022 09:02:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242712AbiGSM72 (ORCPT ); Tue, 19 Jul 2022 08:59:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C541422CE; Tue, 19 Jul 2022 05:24:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4320DB81B29; Tue, 19 Jul 2022 12:24:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9593BC341D4; Tue, 19 Jul 2022 12:24:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233491; bh=ZzoeeK22UdI5rV/NKmOMY8h+jq09j5Z1NOc3uDW+Uf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MXRCAmYdpmTkhnZYJqbNFWOlBLwlji9GZPq4dC+meYyoAyiBqspAC4WhOUkrW4RI3 7a8uApqM0u28Mg51d9ZHkeFtKpuIpmz1vJ8EFm34W2iOQ0xf6XT45MJx/WCxemS3m8 ZFdA+3LdKwZ7DHFItmopwKKL2yA4XN2elq/qXh/k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ma Yuying , =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= , Edward Cree , Paolo Abeni , Sasha Levin Subject: [PATCH 5.18 139/231] sfc: fix kernel panic when creating VF Date: Tue, 19 Jul 2022 13:53:44 +0200 Message-Id: <20220719114726.087418351@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: =C3=8D=C3=B1igo Huguet [ Upstream commit ada74c5539eba06cf8b47d068f92e0b3963a9a6e ] When creating VFs a kernel panic can happen when calling to efx_ef10_try_update_nic_stats_vf. When releasing a DMA coherent buffer, sometimes, I don't know in what specific circumstances, it has to unmap memory with vunmap. It is disallowed to do that in IRQ context or with BH disabled. Otherwise, we hit this line in vunmap, causing the crash: BUG_ON(in_interrupt()); This patch reenables BH to release the buffer. Log messages when the bug is hit: kernel BUG at mm/vmalloc.c:2727! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 6 PID: 1462 Comm: NetworkManager Kdump: loaded Tainted: G I = --------- --- 5.14.0-119.el9.x86_64 #1 Hardware name: Dell Inc. PowerEdge R740/06WXJT, BIOS 2.8.2 08/27/2020 RIP: 0010:vunmap+0x2e/0x30 ...skip... Call Trace: __iommu_dma_free+0x96/0x100 efx_nic_free_buffer+0x2b/0x40 [sfc] efx_ef10_try_update_nic_stats_vf+0x14a/0x1c0 [sfc] efx_ef10_update_stats_vf+0x18/0x40 [sfc] efx_start_all+0x15e/0x1d0 [sfc] efx_net_open+0x5a/0xe0 [sfc] __dev_open+0xe7/0x1a0 __dev_change_flags+0x1d7/0x240 dev_change_flags+0x21/0x60 ...skip... Fixes: d778819609a2 ("sfc: DMA the VF stats only when requested") Reported-by: Ma Yuying Signed-off-by: =C3=8D=C3=B1igo Huguet Acked-by: Edward Cree Link: https://lore.kernel.org/r/20220713092116.21238-1-ihuguet@redhat.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/sfc/ef10.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef1= 0.c index 186cb28c03bd..8b62ce21aff3 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c @@ -1932,7 +1932,10 @@ static int efx_ef10_try_update_nic_stats_vf(struct e= fx_nic *efx) =20 efx_update_sw_stats(efx, stats); out: + /* releasing a DMA coherent buffer with BH disabled can panic */ + spin_unlock_bh(&efx->stats_lock); efx_nic_free_buffer(efx, &stats_buf); + spin_lock_bh(&efx->stats_lock); return rc; } =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 215E7C433EF for ; Tue, 19 Jul 2022 13:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242780AbiGSNDy (ORCPT ); Tue, 19 Jul 2022 09:03:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242717AbiGSM73 (ORCPT ); Tue, 19 Jul 2022 08:59:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE4D246D84; Tue, 19 Jul 2022 05:24:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6ED8AB81B36; Tue, 19 Jul 2022 12:24:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9066FC341D3; Tue, 19 Jul 2022 12:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233494; bh=7dVizbUshcZcXEg8DTB9O6088LdUH2iKBxS14dy8z6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wu81fupvCWKx4ShJbouMJZeFbcQlI+psetdNEYpOqsxBtKW4BqeDVLQU1qNA4LHbk Qws0KRxyWmcs3dDyxUCBrCnI8GZxRtCNAMiV5WtCSKnVpP1LNOC7gCE5Iyg6wh9WyG dzyliQw9NiNc3c3bYXIflV7QYTDDbVW1kt2Or7cU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Chia-Lin Kao (AceLan)" , Paolo Abeni , Sasha Levin Subject: [PATCH 5.18 140/231] net: atlantic: remove deep parameter on suspend/resume functions Date: Tue, 19 Jul 2022 13:53:45 +0200 Message-Id: <20220719114726.159402867@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chia-Lin Kao (AceLan) [ Upstream commit 0f33250760384e05c36466b0a2f92f3c6007ba92 ] Below commit claims that atlantic NIC requires to reset the device on pm op, and had set the deep to true for all suspend/resume functions. commit 1809c30b6e5a ("net: atlantic: always deep reset on pm op, fixing up = my null deref regression") So, we could remove deep parameter on suspend/resume functions without any functional change. Fixes: 1809c30b6e5a ("net: atlantic: always deep reset on pm op, fixing up = my null deref regression") Signed-off-by: Chia-Lin Kao (AceLan) Link: https://lore.kernel.org/r/20220713111224.1535938-1-acelan.kao@canonic= al.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- .../ethernet/aquantia/atlantic/aq_pci_func.c | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers= /net/ethernet/aquantia/atlantic/aq_pci_func.c index 831833911a52..dbd5263130f9 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c @@ -379,7 +379,7 @@ static void aq_pci_shutdown(struct pci_dev *pdev) } } =20 -static int aq_suspend_common(struct device *dev, bool deep) +static int aq_suspend_common(struct device *dev) { struct aq_nic_s *nic =3D pci_get_drvdata(to_pci_dev(dev)); =20 @@ -392,17 +392,15 @@ static int aq_suspend_common(struct device *dev, bool= deep) if (netif_running(nic->ndev)) aq_nic_stop(nic); =20 - if (deep) { - aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); - aq_nic_set_power(nic); - } + aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); + aq_nic_set_power(nic); =20 rtnl_unlock(); =20 return 0; } =20 -static int atl_resume_common(struct device *dev, bool deep) +static int atl_resume_common(struct device *dev) { struct pci_dev *pdev =3D to_pci_dev(dev); struct aq_nic_s *nic; @@ -415,10 +413,8 @@ static int atl_resume_common(struct device *dev, bool = deep) pci_set_power_state(pdev, PCI_D0); pci_restore_state(pdev); =20 - if (deep) { - /* Reinitialize Nic/Vecs objects */ - aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); - } + /* Reinitialize Nic/Vecs objects */ + aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); =20 if (netif_running(nic->ndev)) { ret =3D aq_nic_init(nic); @@ -444,22 +440,22 @@ static int atl_resume_common(struct device *dev, bool= deep) =20 static int aq_pm_freeze(struct device *dev) { - return aq_suspend_common(dev, true); + return aq_suspend_common(dev); } =20 static int aq_pm_suspend_poweroff(struct device *dev) { - return aq_suspend_common(dev, true); + return aq_suspend_common(dev); } =20 static int aq_pm_thaw(struct device *dev) { - return atl_resume_common(dev, true); + return atl_resume_common(dev); } =20 static int aq_pm_resume_restore(struct device *dev) { - return atl_resume_common(dev, true); + return atl_resume_common(dev); } =20 static const struct dev_pm_ops aq_pm_ops =3D { --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 974C0C43334 for ; Tue, 19 Jul 2022 13:02:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238619AbiGSNCT (ORCPT ); Tue, 19 Jul 2022 09:02:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242728AbiGSM7b (ORCPT ); Tue, 19 Jul 2022 08:59:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03BC94A81A; Tue, 19 Jul 2022 05:25:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9F9DEB81B08; Tue, 19 Jul 2022 12:24:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4827C385A2; Tue, 19 Jul 2022 12:24:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233497; bh=FX3acsEqsS0HF4T8PaNc5W2h67o+9MYPSUaaw3v9HPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2rzkjcl1oEPxWUk6zIUfoHXYRYOZnIdf4GW+Bl5/WAUhTV1gPN0V4erZoKrRYvEjK m6ktHeqhrFanqV3JdhgwhQucbrMVX95SJt2dpELHfGlmsmOm0M5fHAu/VfQbJ27Mu7 xY3CpRDrJzipN8Volrpu9NG7c3jAfrpKIx6nIgpY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Chia-Lin Kao (AceLan)" , Paolo Abeni , Sasha Levin Subject: [PATCH 5.18 141/231] net: atlantic: remove aq_nic_deinit() when resume Date: Tue, 19 Jul 2022 13:53:46 +0200 Message-Id: <20220719114726.232573347@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chia-Lin Kao (AceLan) [ Upstream commit 2e15c51fefaffaf9f72255eaef4fada05055e4c5 ] aq_nic_deinit() has been called while suspending, so we don't have to call it again on resume. Actually, call it again leads to another hang issue when resuming from S3. Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992345] Call Trace: Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992346] Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992348] aq_nic_deinit+= 0xb4/0xd0 [atlantic] Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992356] aq_pm_thaw+0x7= f/0x100 [atlantic] Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992362] pci_pm_resume+= 0x5c/0x90 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992366] ? pci_pm_thaw+= 0x80/0x80 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992368] dpm_run_callba= ck+0x4e/0x120 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992371] device_resume+= 0xad/0x200 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992373] async_resume+0= x1e/0x40 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992374] async_run_entr= y_fn+0x33/0x120 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992377] process_one_wo= rk+0x220/0x3c0 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992380] worker_thread+= 0x4d/0x3f0 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992382] ? process_one_= work+0x3c0/0x3c0 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992384] kthread+0x12a/= 0x150 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992386] ? set_kthread_= struct+0x40/0x40 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992387] ret_from_fork+= 0x22/0x30 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992391] Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992392] ---[ end trace= 1ec8c79604ed5e0d ]--- Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992394] PM: dpm_run_ca= llback(): pci_pm_resume+0x0/0x90 returns -110 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992397] atlantic 0000:= 02:00.0: PM: failed to resume async: error -110 Fixes: 1809c30b6e5a ("net: atlantic: always deep reset on pm op, fixing up = my null deref regression") Signed-off-by: Chia-Lin Kao (AceLan) Link: https://lore.kernel.org/r/20220713111224.1535938-2-acelan.kao@canonic= al.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers= /net/ethernet/aquantia/atlantic/aq_pci_func.c index dbd5263130f9..8647125d60ae 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c @@ -413,9 +413,6 @@ static int atl_resume_common(struct device *dev) pci_set_power_state(pdev, PCI_D0); pci_restore_state(pdev); =20 - /* Reinitialize Nic/Vecs objects */ - aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); - if (netif_running(nic->ndev)) { ret =3D aq_nic_init(nic); if (ret) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6A5FC433EF for ; Tue, 19 Jul 2022 13:02:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242790AbiGSNCY (ORCPT ); Tue, 19 Jul 2022 09:02:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242758AbiGSM7d (ORCPT ); Tue, 19 Jul 2022 08:59:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 523A82DE; Tue, 19 Jul 2022 05:25:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BED09B81B21; Tue, 19 Jul 2022 12:25:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FD42C341D2; Tue, 19 Jul 2022 12:24:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233500; bh=hPR7UGZlHNNh7LAv9IQnEh4LNU8ATrKxT5SNnVoxbcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=spMu4X+jNqHAbB2n7mvCkQSAR0Y58c4crZeao7bb3uSpfX5E5Eb6UquMLbC1GX9KR BFQgQFzUricQ2xa/h95cZMZBlCI2yAsYJXgQG30+rzZIe6Tghmg8tdVYkhH0yCIwbo 6WriXQwR86rEkJUGzt+TJkQ/Dplubfi1co3KCDms= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+d6caa905917d353f0d07@syzkaller.appspotmail.com, Vitaly Kuznetsov , Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 142/231] KVM: x86: Fully initialize struct kvm_lapic_irq in kvm_pv_kick_cpu_op() Date: Tue, 19 Jul 2022 13:53:47 +0200 Message-Id: <20220719114726.323272746@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vitaly Kuznetsov [ Upstream commit 8a414f943f8b5f94bbaafdec863d6f3dbef33f8a ] 'vector' and 'trig_mode' fields of 'struct kvm_lapic_irq' are left uninitialized in kvm_pv_kick_cpu_op(). While these fields are normally not needed for APIC_DM_REMRD, they're still referenced by __apic_accept_irq() for trace_kvm_apic_accept_irq(). Fully initialize the structure to avoid consuming random stack memory. Fixes: a183b638b61c ("KVM: x86: make apic_accept_irq tracepoint more generi= c") Reported-by: syzbot+d6caa905917d353f0d07@syzkaller.appspotmail.com Signed-off-by: Vitaly Kuznetsov Reviewed-by: Sean Christopherson Message-Id: <20220708125147.593975-1-vkuznets@redhat.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/x86/kvm/x86.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 558d1f2ab5b4..828f5cf1af45 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -9074,15 +9074,17 @@ static int kvm_pv_clock_pairing(struct kvm_vcpu *vc= pu, gpa_t paddr, */ static void kvm_pv_kick_cpu_op(struct kvm *kvm, int apicid) { - struct kvm_lapic_irq lapic_irq; - - lapic_irq.shorthand =3D APIC_DEST_NOSHORT; - lapic_irq.dest_mode =3D APIC_DEST_PHYSICAL; - lapic_irq.level =3D 0; - lapic_irq.dest_id =3D apicid; - lapic_irq.msi_redir_hint =3D false; + /* + * All other fields are unused for APIC_DM_REMRD, but may be consumed by + * common code, e.g. for tracing. Defer initialization to the compiler. + */ + struct kvm_lapic_irq lapic_irq =3D { + .delivery_mode =3D APIC_DM_REMRD, + .dest_mode =3D APIC_DEST_PHYSICAL, + .shorthand =3D APIC_DEST_NOSHORT, + .dest_id =3D apicid, + }; =20 - lapic_irq.delivery_mode =3D APIC_DM_REMRD; kvm_irq_delivery_to_apic(kvm, NULL, &lapic_irq, NULL); } =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F740C433EF for ; Tue, 19 Jul 2022 13:03:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242907AbiGSND6 (ORCPT ); Tue, 19 Jul 2022 09:03:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242779AbiGSM7f (ORCPT ); Tue, 19 Jul 2022 08:59:35 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEC632623; Tue, 19 Jul 2022 05:25:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 24549CE1BCF; Tue, 19 Jul 2022 12:25:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25814C341D1; Tue, 19 Jul 2022 12:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233503; bh=w88KjV2nHe48toTaqFwb8rbs7fnFyPWkrIu4x3ktmtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EGoGvaTkCyToWCaH/WfiVlNTz1ERcVBYYVxxqE+H2iRj4IUq7la1gOLzh3AOUffe2 byi14/CnVpzNdeiAJvPvJGHbzR/6Tit6tpK9GlLLwNPE6bZQoFoSKT09N7WGdeRd+5 5VEf25j5d4k8ukb4ukK4ifDbNlaEu+jxnHbeKF6s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Kicinski , Maxim Mikityanskiy , Tariq Toukan , Sasha Levin Subject: [PATCH 5.18 143/231] net/tls: Check for errors in tls_device_init Date: Tue, 19 Jul 2022 13:53:48 +0200 Message-Id: <20220719114726.401044856@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tariq Toukan [ Upstream commit 3d8c51b25a235e283e37750943bbf356ef187230 ] Add missing error checks in tls_device_init. Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure") Reported-by: Jakub Kicinski Reviewed-by: Maxim Mikityanskiy Signed-off-by: Tariq Toukan Link: https://lore.kernel.org/r/20220714070754.1428-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/net/tls.h | 4 ++-- net/tls/tls_device.c | 4 ++-- net/tls/tls_main.c | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/net/tls.h b/include/net/tls.h index b6968a5b5538..e8764d3da41a 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -708,7 +708,7 @@ int tls_sw_fallback_init(struct sock *sk, struct tls_crypto_info *crypto_info); =20 #ifdef CONFIG_TLS_DEVICE -void tls_device_init(void); +int tls_device_init(void); void tls_device_cleanup(void); void tls_device_sk_destruct(struct sock *sk); int tls_set_device_offload(struct sock *sk, struct tls_context *ctx); @@ -728,7 +728,7 @@ static inline bool tls_is_sk_rx_device_offloaded(struct= sock *sk) return tls_get_ctx(sk)->rx_conf =3D=3D TLS_HW; } #else -static inline void tls_device_init(void) {} +static inline int tls_device_init(void) { return 0; } static inline void tls_device_cleanup(void) {} =20 static inline int diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c index 3919fe2c58c5..3a61bb594544 100644 --- a/net/tls/tls_device.c +++ b/net/tls/tls_device.c @@ -1394,9 +1394,9 @@ static struct notifier_block tls_dev_notifier =3D { .notifier_call =3D tls_dev_event, }; =20 -void __init tls_device_init(void) +int __init tls_device_init(void) { - register_netdevice_notifier(&tls_dev_notifier); + return register_netdevice_notifier(&tls_dev_notifier); } =20 void __exit tls_device_cleanup(void) diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index 5c9697840ef7..13058b0ee4cd 100644 --- a/net/tls/tls_main.c +++ b/net/tls/tls_main.c @@ -993,7 +993,12 @@ static int __init tls_register(void) if (err) return err; =20 - tls_device_init(); + err =3D tls_device_init(); + if (err) { + unregister_pernet_subsys(&tls_proc_ops); + return err; + } + tcp_register_ulp(&tcp_tls_ulp_ops); =20 return 0; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC18BC433EF for ; Tue, 19 Jul 2022 13:02:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242734AbiGSNC3 (ORCPT ); Tue, 19 Jul 2022 09:02:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242806AbiGSM7i (ORCPT ); Tue, 19 Jul 2022 08:59:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CBB363CD; Tue, 19 Jul 2022 05:25:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C60F0B81B21; Tue, 19 Jul 2022 12:25:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B822C341D8; Tue, 19 Jul 2022 12:25:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233506; bh=8eWx/eELbvZZCIShRKaxQ1ohRxKtl/umDcePQo0ppBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z2yRs+lok2gKHp6N5s02bP4UyOa8f7vDuAGlRQ/TXyxqelZm2r6llllPJW0UGZe0A UmaW0KpfcH68JfUxWYXhN8ttVk6Lnb5iDkDaZ1n1al4OvJpK9un4aUz313S7ojmNWQ h3jy5+zbiPBALYpibYasyungjrcZwYKk2peiqWHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Muchun Song , Michal Hocko , Mel Gorman , Luis Chamberlain , Sasha Levin Subject: [PATCH 5.18 144/231] mm: sysctl: fix missing numa_stat when !CONFIG_HUGETLB_PAGE Date: Tue, 19 Jul 2022 13:53:49 +0200 Message-Id: <20220719114726.478705779@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Muchun Song [ Upstream commit 43b5240ca6b33108998810593248186b1e3ae34a ] "numa_stat" should not be included in the scope of CONFIG_HUGETLB_PAGE, if CONFIG_HUGETLB_PAGE is not configured even if CONFIG_NUMA is configured, "numa_stat" is missed form /proc. Move it out of CONFIG_HUGETLB_PAGE to fix it. Fixes: 4518085e127d ("mm, sysctl: make NUMA stats configurable") Signed-off-by: Muchun Song Cc: Acked-by: Michal Hocko Acked-by: Mel Gorman Signed-off-by: Luis Chamberlain Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index f165ea67dd33..c42ba2d669dc 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2466,6 +2466,17 @@ static struct ctl_table vm_table[] =3D { .extra1 =3D SYSCTL_ZERO, .extra2 =3D SYSCTL_TWO_HUNDRED, }, +#ifdef CONFIG_NUMA + { + .procname =3D "numa_stat", + .data =3D &sysctl_vm_numa_stat, + .maxlen =3D sizeof(int), + .mode =3D 0644, + .proc_handler =3D sysctl_vm_numa_stat_handler, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE, + }, +#endif #ifdef CONFIG_HUGETLB_PAGE { .procname =3D "nr_hugepages", @@ -2482,15 +2493,6 @@ static struct ctl_table vm_table[] =3D { .mode =3D 0644, .proc_handler =3D &hugetlb_mempolicy_sysctl_handler, }, - { - .procname =3D "numa_stat", - .data =3D &sysctl_vm_numa_stat, - .maxlen =3D sizeof(int), - .mode =3D 0644, - .proc_handler =3D sysctl_vm_numa_stat_handler, - .extra1 =3D SYSCTL_ZERO, - .extra2 =3D SYSCTL_ONE, - }, #endif { .procname =3D "hugetlb_shm_group", --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 790E6C433EF for ; Tue, 19 Jul 2022 13:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243130AbiGSNH6 (ORCPT ); Tue, 19 Jul 2022 09:07:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243067AbiGSNHV (ORCPT ); Tue, 19 Jul 2022 09:07:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 114C3BA247; Tue, 19 Jul 2022 05:27:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 806986195B; Tue, 19 Jul 2022 12:27:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50CEFC341C6; Tue, 19 Jul 2022 12:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233621; bh=99oYuSj1M8WEb4HdX2609nGaiPr3UQnE0ldIVJt3eB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tD/B/HsXfv6Bq9io5BgWp0LujqRuFrWCLsQBdW+SulnnLyT8vYfMkWMX8CUWpz+fq tVEjzSbiCy1vYSpy9cpFIKoqmkcxVL2IWHOLJ8j29bhmmkoQ4rNy5O05nPUO6mo5I3 U1zKHmp8YYfxQIlopnWYmIZ+5qGqwoRYY9h/xKs8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , Borislav Petkov , Josh Poimboeuf , Sasha Levin Subject: [PATCH 5.18 145/231] x86/kvm: Fix SETcc emulation for return thunks Date: Tue, 19 Jul 2022 13:53:50 +0200 Message-Id: <20220719114726.554097958@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Zijlstra [ Upstream commit af2e140f34208a5dfb6b7a8ad2d56bda88f0524d ] Prepare the SETcc fastop stuff for when RET can be larger still. The tricky bit here is that the expressions should not only be constant C expressions, but also absolute GAS expressions. This means no ?: and 'true' is ~0. Also ensure em_setcc() has the same alignment as the actual FOP_SETCC() ops, this ensures there cannot be an alignment hole between em_setcc() and the first op. Additionally, add a .skip directive to the FOP_SETCC() macro to fill any remaining space with INT3 traps; however the primary purpose of this directive is to generate AS warnings when the remaining space goes negative. Which is a very good indication the alignment magic went side-ways. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Borislav Petkov Reviewed-by: Josh Poimboeuf Signed-off-by: Borislav Petkov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/x86/kvm/emulate.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 89b11e7dca8a..b01437015f99 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -325,13 +325,15 @@ static int fastop(struct x86_emulate_ctxt *ctxt, fast= op_t fop); #define FOP_RET(name) \ __FOP_RET(#name) =20 -#define FOP_START(op) \ +#define __FOP_START(op, align) \ extern void em_##op(struct fastop *fake); \ asm(".pushsection .text, \"ax\" \n\t" \ ".global em_" #op " \n\t" \ - ".align " __stringify(FASTOP_SIZE) " \n\t" \ + ".align " __stringify(align) " \n\t" \ "em_" #op ":\n\t" =20 +#define FOP_START(op) __FOP_START(op, FASTOP_SIZE) + #define FOP_END \ ".popsection") =20 @@ -435,16 +437,15 @@ static int fastop(struct x86_emulate_ctxt *ctxt, fast= op_t fop); /* * Depending on .config the SETcc functions look like: * - * ENDBR [4 bytes; CONFIG_X86_KERNEL_IBT] - * SETcc %al [3 bytes] - * RET [1 byte] - * INT3 [1 byte; CONFIG_SLS] - * - * Which gives possible sizes 4, 5, 8 or 9. When rounded up to the - * next power-of-two alignment they become 4, 8 or 16 resp. + * ENDBR [4 bytes; CONFIG_X86_KERNEL_IBT] + * SETcc %al [3 bytes] + * RET | JMP __x86_return_thunk [1,5 bytes; CONFIG_RETPOLINE] + * INT3 [1 byte; CONFIG_SLS] */ -#define SETCC_LENGTH (ENDBR_INSN_SIZE + 4 + IS_ENABLED(CONFIG_SLS)) -#define SETCC_ALIGN (4 << IS_ENABLED(CONFIG_SLS) << HAS_KERNEL_IBT) +#define RET_LENGTH (1 + (4 * IS_ENABLED(CONFIG_RETPOLINE)) + \ + IS_ENABLED(CONFIG_SLS)) +#define SETCC_LENGTH (ENDBR_INSN_SIZE + 3 + RET_LENGTH) +#define SETCC_ALIGN (4 << ((SETCC_LENGTH > 4) & 1) << ((SETCC_LENGTH > 8) = & 1)) static_assert(SETCC_LENGTH <=3D SETCC_ALIGN); =20 #define FOP_SETCC(op) \ @@ -453,9 +454,10 @@ static_assert(SETCC_LENGTH <=3D SETCC_ALIGN); #op ": \n\t" \ ASM_ENDBR \ #op " %al \n\t" \ - __FOP_RET(#op) + __FOP_RET(#op) \ + ".skip " __stringify(SETCC_ALIGN) " - (.-" #op "), 0xcc \n\t" =20 -FOP_START(setcc) +__FOP_START(setcc, SETCC_ALIGN) FOP_SETCC(seto) FOP_SETCC(setno) FOP_SETCC(setc) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F594C433EF for ; Tue, 19 Jul 2022 13:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242599AbiGSNDA (ORCPT ); Tue, 19 Jul 2022 09:03:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243079AbiGSNAT (ORCPT ); Tue, 19 Jul 2022 09:00:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34C6E4332D; Tue, 19 Jul 2022 05:25:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 39146B81B21; Tue, 19 Jul 2022 12:25:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BD63C341CA; Tue, 19 Jul 2022 12:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233533; bh=WXdrFZOXceROsZm8n4HSd8OiAlCYb1jd9+1Sqz04V6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yDXoTNxeW5gdWpE+O7scFkpS3Dv8Hm2VttHoRKnYVHjmNwMFIsGc6I6VdfLFXqIqO DdKf/wO4JXRgLasIN13CCTZ9YOFByqhtpG9OF9gFViGfIWzRvkaLmBVpmow5voLNVi 3dowD1xSkGZmu1fNvnnJdrMe1UPpz9Pusi3TLNY8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kim Phillips , "Peter Zijlstra (Intel)" , Borislav Petkov , Josh Poimboeuf , Sasha Levin Subject: [PATCH 5.18 146/231] x86/sev: Avoid using __x86_return_thunk Date: Tue, 19 Jul 2022 13:53:51 +0200 Message-Id: <20220719114726.628551296@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kim Phillips [ Upstream commit 0ee9073000e8791f8b134a8ded31bcc767f7f232 ] Specifically, it's because __enc_copy() encrypts the kernel after being relocated outside the kernel in sme_encrypt_execute(), and the RET macro's jmp offset isn't amended prior to execution. Signed-off-by: Kim Phillips Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Borislav Petkov Reviewed-by: Josh Poimboeuf Signed-off-by: Borislav Petkov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/x86/mm/mem_encrypt_boot.S | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/mem_encrypt_boot.S b/arch/x86/mm/mem_encrypt_boot.S index 3d1dba05fce4..d94dea450fa6 100644 --- a/arch/x86/mm/mem_encrypt_boot.S +++ b/arch/x86/mm/mem_encrypt_boot.S @@ -65,7 +65,9 @@ SYM_FUNC_START(sme_encrypt_execute) movq %rbp, %rsp /* Restore original stack pointer */ pop %rbp =20 - RET + /* Offset to __x86_return_thunk would be wrong here */ + ret + int3 SYM_FUNC_END(sme_encrypt_execute) =20 SYM_FUNC_START(__enc_copy) @@ -151,6 +153,8 @@ SYM_FUNC_START(__enc_copy) pop %r12 pop %r15 =20 - RET + /* Offset to __x86_return_thunk would be wrong here */ + ret + int3 .L__enc_copy_end: SYM_FUNC_END(__enc_copy) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAC56C43334 for ; Tue, 19 Jul 2022 13:05:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242868AbiGSNFS (ORCPT ); Tue, 19 Jul 2022 09:05:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242615AbiGSNC6 (ORCPT ); Tue, 19 Jul 2022 09:02:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B12E9509E1; Tue, 19 Jul 2022 05:26:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3524461934; Tue, 19 Jul 2022 12:26:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 073E3C341C6; Tue, 19 Jul 2022 12:26:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233564; bh=39TeME+ASYd2NzHTR3ksqBafQL76sosJp8PdEILGsrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UOoiCJg6IqU9XfWM7dRUvEFP8Ve0qIYBN7PEPoLwTdfJGXECjUeJaIS0vWYslIms6 KshTfcd0boEITUJglcxF5A8znl4K+jnVHR7PORBIsALbAlbwmB4A+vLqKXLIQ4jKDe gZjlvLBW05sLln07wkhDc3gQJ1cC/emguOoxJ01w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kim Phillips , Alexandre Chartre , "Peter Zijlstra (Intel)" , Borislav Petkov , Josh Poimboeuf , Sasha Levin Subject: [PATCH 5.18 147/231] x86/bugs: Report AMD retbleed vulnerability Date: Tue, 19 Jul 2022 13:53:52 +0200 Message-Id: <20220719114726.703659023@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexandre Chartre [ Upstream commit 6b80b59b3555706508008f1f127b5412c89c7fd8 ] Report that AMD x86 CPUs are vulnerable to the RETBleed (Arbitrary Speculative Code Execution with Return Instructions) attack. [peterz: add hygon] [kim: invert parity; fam15h] Co-developed-by: Kim Phillips Signed-off-by: Kim Phillips Signed-off-by: Alexandre Chartre Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Borislav Petkov Reviewed-by: Josh Poimboeuf Signed-off-by: Borislav Petkov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/bugs.c | 13 +++++++++++++ arch/x86/kernel/cpu/common.c | 19 +++++++++++++++++++ drivers/base/cpu.c | 8 ++++++++ include/linux/cpu.h | 2 ++ 5 files changed, 43 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpuf= eatures.h index e17de69faa54..cf5553744e83 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -444,5 +444,6 @@ #define X86_BUG_ITLB_MULTIHIT X86_BUG(23) /* CPU may incur MCE during cer= tain page attribute changes */ #define X86_BUG_SRBDS X86_BUG(24) /* CPU may leak RNG bits if not mitiga= ted */ #define X86_BUG_MMIO_STALE_DATA X86_BUG(25) /* CPU is affected by Process= or MMIO Stale Data vulnerabilities */ +#define X86_BUG_RETBLEED X86_BUG(26) /* CPU is affected by RETBleed */ =20 #endif /* _ASM_X86_CPUFEATURES_H */ diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index a8a9f6406331..425ff2f32669 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1987,6 +1987,11 @@ static ssize_t srbds_show_state(char *buf) return sprintf(buf, "%s\n", srbds_strings[srbds_mitigation]); } =20 +static ssize_t retbleed_show_state(char *buf) +{ + return sprintf(buf, "Vulnerable\n"); +} + static ssize_t cpu_show_common(struct device *dev, struct device_attribute= *attr, char *buf, unsigned int bug) { @@ -2032,6 +2037,9 @@ static ssize_t cpu_show_common(struct device *dev, st= ruct device_attribute *attr case X86_BUG_MMIO_STALE_DATA: return mmio_stale_data_show_state(buf); =20 + case X86_BUG_RETBLEED: + return retbleed_show_state(buf); + default: break; } @@ -2088,4 +2096,9 @@ ssize_t cpu_show_mmio_stale_data(struct device *dev, = struct device_attribute *at { return cpu_show_common(dev, attr, buf, X86_BUG_MMIO_STALE_DATA); } + +ssize_t cpu_show_retbleed(struct device *dev, struct device_attribute *att= r, char *buf) +{ + return cpu_show_common(dev, attr, buf, X86_BUG_RETBLEED); +} #endif diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index af5d0c188f7b..796cc55313f4 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1231,16 +1231,27 @@ static const __initconst struct x86_cpu_id cpu_vuln= _whitelist[] =3D { {} }; =20 +#define VULNBL(vendor, family, model, blacklist) \ + X86_MATCH_VENDOR_FAM_MODEL(vendor, family, model, blacklist) + #define VULNBL_INTEL_STEPPINGS(model, steppings, issues) \ X86_MATCH_VENDOR_FAM_MODEL_STEPPINGS_FEATURE(INTEL, 6, \ INTEL_FAM6_##model, steppings, \ X86_FEATURE_ANY, issues) =20 +#define VULNBL_AMD(family, blacklist) \ + VULNBL(AMD, family, X86_MODEL_ANY, blacklist) + +#define VULNBL_HYGON(family, blacklist) \ + VULNBL(HYGON, family, X86_MODEL_ANY, blacklist) + #define SRBDS BIT(0) /* CPU is affected by X86_BUG_MMIO_STALE_DATA */ #define MMIO BIT(1) /* CPU is affected by Shared Buffers Data Sampling (SBDS), a variant of X8= 6_BUG_MMIO_STALE_DATA */ #define MMIO_SBDS BIT(2) +/* CPU is affected by RETbleed, speculating where you would not expect it = */ +#define RETBLEED BIT(3) =20 static const struct x86_cpu_id cpu_vuln_blacklist[] __initconst =3D { VULNBL_INTEL_STEPPINGS(IVYBRIDGE, X86_STEPPING_ANY, SRBDS), @@ -1273,6 +1284,11 @@ static const struct x86_cpu_id cpu_vuln_blacklist[] = __initconst =3D { VULNBL_INTEL_STEPPINGS(ATOM_TREMONT, X86_STEPPINGS(0x1, 0x1), MMIO | MMIO= _SBDS), VULNBL_INTEL_STEPPINGS(ATOM_TREMONT_D, X86_STEPPING_ANY, MMIO), VULNBL_INTEL_STEPPINGS(ATOM_TREMONT_L, X86_STEPPINGS(0x0, 0x0), MMIO | MM= IO_SBDS), + + VULNBL_AMD(0x15, RETBLEED), + VULNBL_AMD(0x16, RETBLEED), + VULNBL_AMD(0x17, RETBLEED), + VULNBL_HYGON(0x18, RETBLEED), {} }; =20 @@ -1374,6 +1390,9 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x8= 6 *c) !arch_cap_mmio_immune(ia32_cap)) setup_force_cpu_bug(X86_BUG_MMIO_STALE_DATA); =20 + if (cpu_matches(cpu_vuln_blacklist, RETBLEED)) + setup_force_cpu_bug(X86_BUG_RETBLEED); + if (cpu_matches(cpu_vuln_whitelist, NO_MELTDOWN)) return; =20 diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index a97776ea9d99..4c98849577d4 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -570,6 +570,12 @@ ssize_t __weak cpu_show_mmio_stale_data(struct device = *dev, return sysfs_emit(buf, "Not affected\n"); } =20 +ssize_t __weak cpu_show_retbleed(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sysfs_emit(buf, "Not affected\n"); +} + static DEVICE_ATTR(meltdown, 0444, cpu_show_meltdown, NULL); static DEVICE_ATTR(spectre_v1, 0444, cpu_show_spectre_v1, NULL); static DEVICE_ATTR(spectre_v2, 0444, cpu_show_spectre_v2, NULL); @@ -580,6 +586,7 @@ static DEVICE_ATTR(tsx_async_abort, 0444, cpu_show_tsx_= async_abort, NULL); static DEVICE_ATTR(itlb_multihit, 0444, cpu_show_itlb_multihit, NULL); static DEVICE_ATTR(srbds, 0444, cpu_show_srbds, NULL); static DEVICE_ATTR(mmio_stale_data, 0444, cpu_show_mmio_stale_data, NULL); +static DEVICE_ATTR(retbleed, 0444, cpu_show_retbleed, NULL); =20 static struct attribute *cpu_root_vulnerabilities_attrs[] =3D { &dev_attr_meltdown.attr, @@ -592,6 +599,7 @@ static struct attribute *cpu_root_vulnerabilities_attrs= [] =3D { &dev_attr_itlb_multihit.attr, &dev_attr_srbds.attr, &dev_attr_mmio_stale_data.attr, + &dev_attr_retbleed.attr, NULL }; =20 diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 2c7477354744..314802f98b9d 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -68,6 +68,8 @@ extern ssize_t cpu_show_srbds(struct device *dev, struct = device_attribute *attr, extern ssize_t cpu_show_mmio_stale_data(struct device *dev, struct device_attribute *attr, char *buf); +extern ssize_t cpu_show_retbleed(struct device *dev, + struct device_attribute *attr, char *buf); =20 extern __printf(4, 5) struct device *cpu_device_create(struct device *parent, void *drvdata, --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EC56C433EF for ; Tue, 19 Jul 2022 13:05:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242974AbiGSNFv (ORCPT ); Tue, 19 Jul 2022 09:05:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243160AbiGSNEr (ORCPT ); Tue, 19 Jul 2022 09:04:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE2FC9DEF9; Tue, 19 Jul 2022 05:26:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 22EACB81B10; Tue, 19 Jul 2022 12:26:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58133C341C6; Tue, 19 Jul 2022 12:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233595; bh=eiHQRO2eTKAg/yVdtMzvxSG5jzk8ywMUzDNQLp/ZplQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A0Mw8JjApDAF4JXTvTg4D+aju8NLYWrXNHpipyJluGLeFMTr5dEaS6ZHuTZzPwB2i DTjaDfFCWoEUjTgAJEesx5y4rTTE60hQNApU1fCFVuwnV6pMh/LwZhVg6OeJfZT2Om 4c/4uZPqexYChDuDdtM4zIm3xLv6Tci8t5SIxUV0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , Borislav Petkov , Josh Poimboeuf , Sasha Levin Subject: [PATCH 5.18 148/231] objtool: Update Retpoline validation Date: Tue, 19 Jul 2022 13:53:53 +0200 Message-Id: <20220719114726.776451398@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Zijlstra [ Upstream commit 9bb2ec608a209018080ca262f771e6a9ff203b6f ] Update retpoline validation with the new CONFIG_RETPOLINE requirement of not having bare naked RET instructions. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Borislav Petkov Reviewed-by: Josh Poimboeuf Signed-off-by: Borislav Petkov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/x86/include/asm/nospec-branch.h | 6 ++++++ arch/x86/mm/mem_encrypt_boot.S | 2 ++ arch/x86/xen/xen-head.S | 1 + tools/objtool/check.c | 19 +++++++++++++------ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/no= spec-branch.h index da251a5645b0..f1a7ecd0a7c7 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -75,6 +75,12 @@ .popsection .endm =20 +/* + * (ab)use RETPOLINE_SAFE on RET to annotate away 'bare' RET instructions + * vs RETBleed validation. + */ +#define ANNOTATE_UNRET_SAFE ANNOTATE_RETPOLINE_SAFE + /* * JMP_NOSPEC and CALL_NOSPEC macros can be used instead of a simple * indirect jmp/call which may be susceptible to the Spectre variant 2 diff --git a/arch/x86/mm/mem_encrypt_boot.S b/arch/x86/mm/mem_encrypt_boot.S index d94dea450fa6..9de3d900bc92 100644 --- a/arch/x86/mm/mem_encrypt_boot.S +++ b/arch/x86/mm/mem_encrypt_boot.S @@ -66,6 +66,7 @@ SYM_FUNC_START(sme_encrypt_execute) pop %rbp =20 /* Offset to __x86_return_thunk would be wrong here */ + ANNOTATE_UNRET_SAFE ret int3 SYM_FUNC_END(sme_encrypt_execute) @@ -154,6 +155,7 @@ SYM_FUNC_START(__enc_copy) pop %r15 =20 /* Offset to __x86_return_thunk would be wrong here */ + ANNOTATE_UNRET_SAFE ret int3 .L__enc_copy_end: diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S index 13af6fe453e3..ffaa62167f6e 100644 --- a/arch/x86/xen/xen-head.S +++ b/arch/x86/xen/xen-head.S @@ -26,6 +26,7 @@ SYM_CODE_START(hypercall_page) .rept (PAGE_SIZE / 32) UNWIND_HINT_FUNC ANNOTATE_NOENDBR + ANNOTATE_UNRET_SAFE ret /* * Xen will write the hypercall page, and sort out ENDBR. diff --git a/tools/objtool/check.c b/tools/objtool/check.c index f66e4ac0af94..fbe41203fc9b 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2030,8 +2030,9 @@ static int read_retpoline_hints(struct objtool_file *= file) } =20 if (insn->type !=3D INSN_JUMP_DYNAMIC && - insn->type !=3D INSN_CALL_DYNAMIC) { - WARN_FUNC("retpoline_safe hint not an indirect jump/call", + insn->type !=3D INSN_CALL_DYNAMIC && + insn->type !=3D INSN_RETURN) { + WARN_FUNC("retpoline_safe hint not an indirect jump/call/ret", insn->sec, insn->offset); return -1; } @@ -3561,7 +3562,8 @@ static int validate_retpoline(struct objtool_file *fi= le) =20 for_each_insn(file, insn) { if (insn->type !=3D INSN_JUMP_DYNAMIC && - insn->type !=3D INSN_CALL_DYNAMIC) + insn->type !=3D INSN_CALL_DYNAMIC && + insn->type !=3D INSN_RETURN) continue; =20 if (insn->retpoline_safe) @@ -3576,9 +3578,14 @@ static int validate_retpoline(struct objtool_file *f= ile) if (!strcmp(insn->sec->name, ".init.text") && !module) continue; =20 - WARN_FUNC("indirect %s found in RETPOLINE build", - insn->sec, insn->offset, - insn->type =3D=3D INSN_JUMP_DYNAMIC ? "jump" : "call"); + if (insn->type =3D=3D INSN_RETURN) { + WARN_FUNC("'naked' return found in RETPOLINE build", + insn->sec, insn->offset); + } else { + WARN_FUNC("indirect %s found in RETPOLINE build", + insn->sec, insn->offset, + insn->type =3D=3D INSN_JUMP_DYNAMIC ? "jump" : "call"); + } =20 warnings++; } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFFCEC433EF for ; Tue, 19 Jul 2022 13:06:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243098AbiGSNGZ (ORCPT ); Tue, 19 Jul 2022 09:06:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243271AbiGSNE7 (ORCPT ); Tue, 19 Jul 2022 09:04:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 355A99F05A; Tue, 19 Jul 2022 05:26:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E35B7616FB; Tue, 19 Jul 2022 12:26:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC9C9C341C6; Tue, 19 Jul 2022 12:26:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233604; bh=c9nhF8SJnbgT1PcdEw9BhinCExmguSEsqIqZEydceYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KEmqGlrqyHCkmsyrXWW8qZrlO0MfGhc29KQCKWQXigPUDL+AulBeWhwUa31bKpgnL BhEa/emKjjsIkFDgVBQI65mIIn0royfRsc6nbvCWXUG2dwJb55UkoozhRR5HiSXDcH YwUbEDWPW7gDuFPfI6SsItfwQnV+ukq6k9RttFRQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , Borislav Petkov , Josh Poimboeuf , Sasha Levin Subject: [PATCH 5.18 149/231] x86/xen: Rename SYS* entry points Date: Tue, 19 Jul 2022 13:53:54 +0200 Message-Id: <20220719114726.863667223@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Zijlstra [ Upstream commit b75b7f8ef1148be1b9321ffc2f6c19238904b438 ] Native SYS{CALL,ENTER} entry points are called entry_SYS{CALL,ENTER}_{64,compat}, make sure the Xen versions are named consistently. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Borislav Petkov Reviewed-by: Josh Poimboeuf Signed-off-by: Borislav Petkov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/x86/xen/setup.c | 6 +++--- arch/x86/xen/xen-asm.S | 20 ++++++++++---------- arch/x86/xen/xen-ops.h | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 81aa46f770c5..cfa99e8f054b 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -918,7 +918,7 @@ void xen_enable_sysenter(void) if (!boot_cpu_has(sysenter_feature)) return; =20 - ret =3D register_callback(CALLBACKTYPE_sysenter, xen_sysenter_target); + ret =3D register_callback(CALLBACKTYPE_sysenter, xen_entry_SYSENTER_compa= t); if(ret !=3D 0) setup_clear_cpu_cap(sysenter_feature); } @@ -927,7 +927,7 @@ void xen_enable_syscall(void) { int ret; =20 - ret =3D register_callback(CALLBACKTYPE_syscall, xen_syscall_target); + ret =3D register_callback(CALLBACKTYPE_syscall, xen_entry_SYSCALL_64); if (ret !=3D 0) { printk(KERN_ERR "Failed to set syscall callback: %d\n", ret); /* Pretty fatal; 64-bit userspace has no other @@ -936,7 +936,7 @@ void xen_enable_syscall(void) =20 if (boot_cpu_has(X86_FEATURE_SYSCALL32)) { ret =3D register_callback(CALLBACKTYPE_syscall32, - xen_syscall32_target); + xen_entry_SYSCALL_compat); if (ret !=3D 0) setup_clear_cpu_cap(X86_FEATURE_SYSCALL32); } diff --git a/arch/x86/xen/xen-asm.S b/arch/x86/xen/xen-asm.S index caa9bc2fa100..6bf9d45b9178 100644 --- a/arch/x86/xen/xen-asm.S +++ b/arch/x86/xen/xen-asm.S @@ -234,7 +234,7 @@ SYM_CODE_END(xenpv_restore_regs_and_return_to_usermode) */ =20 /* Normal 64-bit system call target */ -SYM_CODE_START(xen_syscall_target) +SYM_CODE_START(xen_entry_SYSCALL_64) UNWIND_HINT_EMPTY ENDBR popq %rcx @@ -249,12 +249,12 @@ SYM_CODE_START(xen_syscall_target) movq $__USER_CS, 1*8(%rsp) =20 jmp entry_SYSCALL_64_after_hwframe -SYM_CODE_END(xen_syscall_target) +SYM_CODE_END(xen_entry_SYSCALL_64) =20 #ifdef CONFIG_IA32_EMULATION =20 /* 32-bit compat syscall target */ -SYM_CODE_START(xen_syscall32_target) +SYM_CODE_START(xen_entry_SYSCALL_compat) UNWIND_HINT_EMPTY ENDBR popq %rcx @@ -269,10 +269,10 @@ SYM_CODE_START(xen_syscall32_target) movq $__USER32_CS, 1*8(%rsp) =20 jmp entry_SYSCALL_compat_after_hwframe -SYM_CODE_END(xen_syscall32_target) +SYM_CODE_END(xen_entry_SYSCALL_compat) =20 /* 32-bit compat sysenter target */ -SYM_CODE_START(xen_sysenter_target) +SYM_CODE_START(xen_entry_SYSENTER_compat) UNWIND_HINT_EMPTY ENDBR /* @@ -291,19 +291,19 @@ SYM_CODE_START(xen_sysenter_target) movq $__USER32_CS, 1*8(%rsp) =20 jmp entry_SYSENTER_compat_after_hwframe -SYM_CODE_END(xen_sysenter_target) +SYM_CODE_END(xen_entry_SYSENTER_compat) =20 #else /* !CONFIG_IA32_EMULATION */ =20 -SYM_CODE_START(xen_syscall32_target) -SYM_CODE_START(xen_sysenter_target) +SYM_CODE_START(xen_entry_SYSCALL_compat) +SYM_CODE_START(xen_entry_SYSENTER_compat) UNWIND_HINT_EMPTY ENDBR lea 16(%rsp), %rsp /* strip %rcx, %r11 */ mov $-ENOSYS, %rax pushq $0 jmp hypercall_iret -SYM_CODE_END(xen_sysenter_target) -SYM_CODE_END(xen_syscall32_target) +SYM_CODE_END(xen_entry_SYSENTER_compat) +SYM_CODE_END(xen_entry_SYSCALL_compat) =20 #endif /* CONFIG_IA32_EMULATION */ diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h index fd0fec6e92f4..9a8bb972193d 100644 --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h @@ -10,10 +10,10 @@ /* These are code, but not functions. Defined in entry.S */ extern const char xen_failsafe_callback[]; =20 -void xen_sysenter_target(void); +void xen_entry_SYSENTER_compat(void); #ifdef CONFIG_X86_64 -void xen_syscall_target(void); -void xen_syscall32_target(void); +void xen_entry_SYSCALL_64(void); +void xen_entry_SYSCALL_compat(void); #endif =20 extern void *xen_initial_gdt; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF433C433EF for ; Tue, 19 Jul 2022 13:06:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242989AbiGSNGi (ORCPT ); Tue, 19 Jul 2022 09:06:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242638AbiGSNFH (ORCPT ); Tue, 19 Jul 2022 09:05:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE28B9FE0F; Tue, 19 Jul 2022 05:26:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C6FEB61950; Tue, 19 Jul 2022 12:26:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7A19C341C6; Tue, 19 Jul 2022 12:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233607; bh=FgL13pl/eneYH4Rd2n+iUoyOvOde9tKcG2PnuEGsLkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rz3zBe3qbRzYqKI+M9hwbuZtjav7fewjrYS8HExk4s2wzazuD2XJgEQCwk9Zqm468 YSW6StEh2yloyDweEJ8bP5H5JMWS8wGjsFRVJx+tYzH9DwTTUBObFRsUtJVWR67TIC 1jD9lr76/eMSAAc3zy28iiadSnlX4yd0BQ6M9SCQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Cooper , "Peter Zijlstra (Intel)" , Borislav Petkov , Josh Poimboeuf , Sasha Levin Subject: [PATCH 5.18 150/231] x86/cpu/amd: Add Spectral Chicken Date: Tue, 19 Jul 2022 13:53:55 +0200 Message-Id: <20220719114726.953787423@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Zijlstra [ Upstream commit d7caac991feeef1b871ee6988fd2c9725df09039 ] Zen2 uarchs have an undocumented, unnamed, MSR that contains a chicken bit for some speculation behaviour. It needs setting. Note: very belatedly AMD released naming; it's now officially called MSR_AMD64_DE_CFG2 and MSR_AMD64_DE_CFG2_SUPPRESS_NOBR_PRED_BIT but shall remain the SPECTRAL CHICKEN. Suggested-by: Andrew Cooper Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Borislav Petkov Reviewed-by: Josh Poimboeuf Signed-off-by: Borislav Petkov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/x86/include/asm/msr-index.h | 3 +++ arch/x86/kernel/cpu/amd.c | 23 ++++++++++++++++++++++- arch/x86/kernel/cpu/cpu.h | 2 ++ arch/x86/kernel/cpu/hygon.c | 6 ++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-in= dex.h index 4425d6773183..d15d0ef6b357 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -552,6 +552,9 @@ /* Fam 17h MSRs */ #define MSR_F17H_IRPERF 0xc00000e9 =20 +#define MSR_ZEN2_SPECTRAL_CHICKEN 0xc00110e3 +#define MSR_ZEN2_SPECTRAL_CHICKEN_BIT BIT_ULL(1) + /* Fam 16h MSRs */ #define MSR_F16H_L2I_PERF_CTL 0xc0010230 #define MSR_F16H_L2I_PERF_CTR 0xc0010231 diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 0c0b09796ced..8cf0659c0521 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -862,6 +862,26 @@ static void init_amd_bd(struct cpuinfo_x86 *c) clear_rdrand_cpuid_bit(c); } =20 +void init_spectral_chicken(struct cpuinfo_x86 *c) +{ + u64 value; + + /* + * On Zen2 we offer this chicken (bit) on the altar of Speculation. + * + * This suppresses speculation from the middle of a basic block, i.e. it + * suppresses non-branch predictions. + * + * We use STIBP as a heuristic to filter out Zen2 from the rest of F17H + */ + if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && cpu_has(c, X86_FEATURE_AMD_STI= BP)) { + if (!rdmsrl_safe(MSR_ZEN2_SPECTRAL_CHICKEN, &value)) { + value |=3D MSR_ZEN2_SPECTRAL_CHICKEN_BIT; + wrmsrl_safe(MSR_ZEN2_SPECTRAL_CHICKEN, value); + } + } +} + static void init_amd_zn(struct cpuinfo_x86 *c) { set_cpu_cap(c, X86_FEATURE_ZEN); @@ -907,7 +927,8 @@ static void init_amd(struct cpuinfo_x86 *c) case 0x12: init_amd_ln(c); break; case 0x15: init_amd_bd(c); break; case 0x16: init_amd_jg(c); break; - case 0x17: fallthrough; + case 0x17: init_spectral_chicken(c); + fallthrough; case 0x19: init_amd_zn(c); break; } =20 diff --git a/arch/x86/kernel/cpu/cpu.h b/arch/x86/kernel/cpu/cpu.h index 2a8e584fc991..7c9b5893c30a 100644 --- a/arch/x86/kernel/cpu/cpu.h +++ b/arch/x86/kernel/cpu/cpu.h @@ -61,6 +61,8 @@ static inline void tsx_init(void) { } static inline void tsx_ap_init(void) { } #endif /* CONFIG_CPU_SUP_INTEL */ =20 +extern void init_spectral_chicken(struct cpuinfo_x86 *c); + extern void get_cpu_cap(struct cpuinfo_x86 *c); extern void get_cpu_address_sizes(struct cpuinfo_x86 *c); extern void cpu_detect_cache_sizes(struct cpuinfo_x86 *c); diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c index 3fcdda4c1e11..21fd425088fe 100644 --- a/arch/x86/kernel/cpu/hygon.c +++ b/arch/x86/kernel/cpu/hygon.c @@ -302,6 +302,12 @@ static void init_hygon(struct cpuinfo_x86 *c) /* get apicid instead of initial apic id from cpuid */ c->apicid =3D hard_smp_processor_id(); =20 + /* + * XXX someone from Hygon needs to confirm this DTRT + * + init_spectral_chicken(c); + */ + set_cpu_cap(c, X86_FEATURE_ZEN); set_cpu_cap(c, X86_FEATURE_CPB); =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8410C433EF for ; Tue, 19 Jul 2022 13:07:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243121AbiGSNHU (ORCPT ); Tue, 19 Jul 2022 09:07:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243067AbiGSNGy (ORCPT ); Tue, 19 Jul 2022 09:06:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8D05A024F; Tue, 19 Jul 2022 05:27:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A197B6195D; Tue, 19 Jul 2022 12:26:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C46CC341C6; Tue, 19 Jul 2022 12:26:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233609; bh=1KmHyOePefQuZwKR3wjta7U25tAiCddu1jgMJvAPAfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PYnCi6hIN9LkTtjNm4z6iDrzCQDwP7NcBUbytXNpc4PqZv1y61NKvPyaxqGNxf+TS uYjOH5Q9BFUtNy982EkMY9OMyGnDiTezAMjqxQrHwekYuUDpMJyiQQWissfNItXX00 E+M5uLfUfxrCqtB3woSJ4Z0n6INlBGw8kB2gQXD8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Linus Walleij , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.18 151/231] ARM: 9211/1: domain: drop modify_domain() Date: Tue, 19 Jul 2022 13:53:56 +0200 Message-Id: <20220719114727.031651925@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit cc45b836388f0ccc6831288a08f77a33845f10b0 ] This function/macro isn't used anywhere in the kernel. The only user was set_fs() and was deleted in the set_fs() removal patch set. Fixes: 8ac6f5d7f84b ("ARM: 9113/1: uaccess: remove set_fs() implementation") Acked-by: Arnd Bergmann Signed-off-by: Linus Walleij Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/include/asm/domain.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h index f1d0a7807cd0..41536feb4392 100644 --- a/arch/arm/include/asm/domain.h +++ b/arch/arm/include/asm/domain.h @@ -112,19 +112,6 @@ static __always_inline void set_domain(unsigned int va= l) } #endif =20 -#ifdef CONFIG_CPU_USE_DOMAINS -#define modify_domain(dom,type) \ - do { \ - unsigned int domain =3D get_domain(); \ - domain &=3D ~domain_mask(dom); \ - domain =3D domain | domain_val(dom, type); \ - set_domain(domain); \ - } while (0) - -#else -static inline void modify_domain(unsigned dom, unsigned type) { } -#endif - /* * Generate the T (user) versions of the LDR/STR and related * instructions (inline assembly) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87BBEC433EF for ; Tue, 19 Jul 2022 13:08:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243175AbiGSNIL (ORCPT ); Tue, 19 Jul 2022 09:08:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243066AbiGSNHn (ORCPT ); Tue, 19 Jul 2022 09:07:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56AA1B9A2E; Tue, 19 Jul 2022 05:27:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8FC7B61921; Tue, 19 Jul 2022 12:26:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82A2CC341C6; Tue, 19 Jul 2022 12:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233612; bh=NHn0yPM9W+29gfs+hlxD9lUActx7AsYKzs0vYg0YH+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rgg+NwymaJGU1YIPq9wOa5HaBKNeQUFKt631VoTMY76DoEsQK5bcyQI54wfbaamkA UWrZe7IwiLRoFCX2TCy/583d2wFAvf7HPEIYv86tGNxRTnvwNPug8py2NYU4Sg6RXb OWrxpW/kN3YTFCIbkGPFm4cAAyPrXqgZwR4EvzF0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Linus Walleij , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.18 152/231] ARM: 9212/1: domain: Modify Kconfig help text Date: Tue, 19 Jul 2022 13:53:57 +0200 Message-Id: <20220719114727.105994758@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit 2bf6204240fddb22cc4940b9e3f40c538390212e ] After the removal of set_fs() the reference to set_fs() is stale. Alter the helptext to reflect what the config option really does. Fixes: 8ac6f5d7f84b ("ARM: 9113/1: uaccess: remove set_fs() implementation") Acked-by: Arnd Bergmann Signed-off-by: Linus Walleij Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/mm/Kconfig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index d30ee26ccc87..6284914f4361 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig @@ -631,7 +631,11 @@ config CPU_USE_DOMAINS bool help This option enables or disables the use of domain switching - via the set_fs() function. + using the DACR (domain access control register) to protect memory + domains from each other. In Linux we use three domains: kernel, user + and IO. The domains are used to protect userspace from kernelspace + and to handle IO-space as a special type of memory by assigning + manager or client roles to running code (such as a process). =20 config CPU_V7M_NUM_IRQ int "Number of external interrupts connected to the NVIC" --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AD2AC43334 for ; Tue, 19 Jul 2022 13:06:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243159AbiGSNGs (ORCPT ); Tue, 19 Jul 2022 09:06:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243109AbiGSNGa (ORCPT ); Tue, 19 Jul 2022 09:06:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55C07A0259; Tue, 19 Jul 2022 05:27:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9904A61978; Tue, 19 Jul 2022 12:26:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59C5CC341D0; Tue, 19 Jul 2022 12:26:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233615; bh=FFOp3TiFjA6X4kN9wrJUlb/4XNEw+QMu8X8lFkJOVCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D0agrEKQWyai5kIrDILY7URGuGsgkE9ycirfTQPGjD/7WWP8+WELpUfhckwHxjcQS FLZ0E0V4R9ssxPJCGiZ1QRcc+ea7fOFFuW3RNKErj5s2jTiNdmDoFYpnKsQoGzNLsz y5p8sEyQy+5FCabkuGF2SkOXdAX5QO7m3iv1xUwU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Krzysztof Kozlowski , Mark Brown , Sasha Levin Subject: [PATCH 5.18 153/231] ASoC: dt-bindings: Fix description for msm8916 Date: Tue, 19 Jul 2022 13:53:58 +0200 Message-Id: <20220719114727.178368901@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bryan O'Donoghue [ Upstream commit 94c65dffd4c4af052b3ea8934fbcb2fa8da276a8 ] For the existing msm8916 bindings the minimum reg/reg-names is 1 not 2. Similarly the minimum interrupt/interrupt-names is 1 not 2. Fixes: f3fc4fbfa2d2 ("ASoC: dt-bindings: Add SC7280 lpass cpu bindings") Signed-off-by: Bryan O'Donoghue Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220629114012.3282945-1-bryan.odonoghue@li= naro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- .../devicetree/bindings/sound/qcom,lpass-cpu.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml b/= Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml index 2c81efb5fa37..47bb67d43ac2 100644 --- a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml @@ -25,12 +25,12 @@ properties: - qcom,sc7280-lpass-cpu =20 reg: - minItems: 2 + minItems: 1 maxItems: 6 description: LPAIF core registers =20 reg-names: - minItems: 2 + minItems: 1 maxItems: 6 =20 clocks: @@ -42,12 +42,12 @@ properties: maxItems: 7 =20 interrupts: - minItems: 2 + minItems: 1 maxItems: 4 description: LPAIF DMA buffer interrupt =20 interrupt-names: - minItems: 2 + minItems: 1 maxItems: 4 =20 qcom,adsp: --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CF5EC43334 for ; Tue, 19 Jul 2022 13:07:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242996AbiGSNHE (ORCPT ); Tue, 19 Jul 2022 09:07:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243066AbiGSNGo (ORCPT ); Tue, 19 Jul 2022 09:06:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 178C5A026A; Tue, 19 Jul 2022 05:27:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 093E0B81B21; Tue, 19 Jul 2022 12:27:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63EDBC341C6; Tue, 19 Jul 2022 12:26:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233618; bh=3+J+jXiwac6CPBiXGQ37Kj8fZs/sHyewEEB+TPIh7go=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SA7HnKBMxYH4CKc2jzcXcTIjpQw2Db7R3Ey5LyccH+/8wk39b8wr6fHcIeXKQdrDK 2IMxFVzm/qPAKSPodQVZLKL/cEvYy5pcorZ1Vl/XDblK/USlZvobwxacepGiKxb49Y 2oI5aL0yrZFwi+G6nLL4JIw8bHMfWki66Rk5hneU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jens Wiklander , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.18 154/231] tee: tee_get_drvdata(): fix description of return value Date: Tue, 19 Jul 2022 13:53:59 +0200 Message-Id: <20220719114727.251309441@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marc Kleine-Budde [ Upstream commit e5ce073c8a1e01b215a5eb32ba48f8d17ded3bd5 ] This patch fixes the description of tee_get_drvdata()'s return value. It actually returns the driver_data pointer supplied to tee_device_alloc() since the TEE subsystem was added to the kernel. Fixes: 967c9cca2cc5 ("tee: generic TEE subsystem") Cc: Jens Wiklander Signed-off-by: Marc Kleine-Budde Signed-off-by: Jens Wiklander Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tee/tee_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c index 8aa1a4836b92..cebe4963ad87 100644 --- a/drivers/tee/tee_core.c +++ b/drivers/tee/tee_core.c @@ -1075,7 +1075,7 @@ EXPORT_SYMBOL_GPL(tee_device_unregister); /** * tee_get_drvdata() - Return driver_data pointer * @teedev: Device containing the driver_data pointer - * @returns the driver_data pointer supplied to tee_register(). + * @returns the driver_data pointer supplied to tee_device_alloc(). */ void *tee_get_drvdata(struct tee_device *teedev) { --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71D42C43334 for ; Tue, 19 Jul 2022 13:02:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242819AbiGSNC5 (ORCPT ); Tue, 19 Jul 2022 09:02:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243095AbiGSNAY (ORCPT ); Tue, 19 Jul 2022 09:00:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86B9E61B01; Tue, 19 Jul 2022 05:25:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 984F461934; Tue, 19 Jul 2022 12:25:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6445FC341C6; Tue, 19 Jul 2022 12:25:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233535; bh=20Wvy7dWanmVA15XdUW1kahzz5ehVrK7I4KjMlxaWlM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f/13cvNg05fDQscSYz6LrEmijZopQZbKNlcN/uc6d8Q07YVJ4VzBfEURhUTmkhvTe QmHwHi+cOaIviW9WAkvFi8CN+mEMZwQqqFRgxfhuQqNuA4J4BVnVMXgLpy3yqCiG3U 4TeyncgY2jWNn4jonRG+6iUNIYz7W+OWfQlrd+kY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hillf Danton , =?UTF-8?q?=E4=B8=80=E5=8F=AA=E7=8B=97?= , Dan Carpenter , Jiri Slaby , Sasha Levin Subject: [PATCH 5.18 155/231] tty: extract tty_flip_buffer_commit() from tty_flip_buffer_push() Date: Tue, 19 Jul 2022 13:54:00 +0200 Message-Id: <20220719114727.324996824@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Slaby [ Upstream commit 716b10580283fda66f2b88140e3964f8a7f9da89 ] We will need this new helper in the next patch. Cc: Hillf Danton Cc: =E4=B8=80=E5=8F=AA=E7=8B=97 Cc: Dan Carpenter Signed-off-by: Jiri Slaby Link: https://lore.kernel.org/r/20220707082558.9250-1-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/tty_buffer.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index bfa431a8e690..303a26c1b821 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -532,6 +532,15 @@ static void flush_to_ldisc(struct work_struct *work) =20 } =20 +static inline void tty_flip_buffer_commit(struct tty_buffer *tail) +{ + /* + * Paired w/ acquire in flush_to_ldisc(); ensures flush_to_ldisc() sees + * buffer data. + */ + smp_store_release(&tail->commit, tail->used); +} + /** * tty_flip_buffer_push - push terminal buffers * @port: tty port to push @@ -546,11 +555,7 @@ void tty_flip_buffer_push(struct tty_port *port) { struct tty_bufhead *buf =3D &port->buf; =20 - /* - * Paired w/ acquire in flush_to_ldisc(); ensures flush_to_ldisc() sees - * buffer data. - */ - smp_store_release(&buf->tail->commit, buf->tail->used); + tty_flip_buffer_commit(buf->tail); queue_work(system_unbound_wq, &buf->work); } EXPORT_SYMBOL(tty_flip_buffer_push); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1AA0C433EF for ; Tue, 19 Jul 2022 13:03:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242827AbiGSNDF (ORCPT ); Tue, 19 Jul 2022 09:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243111AbiGSNA0 (ORCPT ); Tue, 19 Jul 2022 09:00:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19E9561D51; Tue, 19 Jul 2022 05:25:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E5CD61924; Tue, 19 Jul 2022 12:25:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 352FCC341C6; Tue, 19 Jul 2022 12:25:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233538; bh=EoF8bNOEoj8ax9IoyF9CUtfhFvGyLJHKTfdbRXMpLM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SiDiDYoCfYrZ2XpTpUwWRm5dVSTQ7z0oebAP69dGxIjPPsU+yNUkaAnt/4r9AKhOo s6HtobAHIf+8G1kOkj+k2gg6yw+NWpSadV6e1lLajhXPS1TucwWUDg1wE9FrqEV8z4 CQWWmXN56Ut4MN1U/eoAvrq60d1WPrnJPQwCnh8s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?=E4=B8=80=E5=8F=AA=E7=8B=97?= , Dan Carpenter , Hillf Danton , Jiri Slaby , Sasha Levin Subject: [PATCH 5.18 156/231] tty: use new tty_insert_flip_string_and_push_buffer() in pty_write() Date: Tue, 19 Jul 2022 13:54:01 +0200 Message-Id: <20220719114727.397754517@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Slaby [ Upstream commit a501ab75e7624d133a5a3c7ec010687c8b961d23 ] There is a race in pty_write(). pty_write() can be called in parallel with e.g. ioctl(TIOCSTI) or ioctl(TCXONC) which also inserts chars to the buffer. Provided, tty_flip_buffer_push() in pty_write() is called outside the lock, it can commit inconsistent tail. This can lead to out of bounds writes and other issues. See the Link below. To fix this, we have to introduce a new helper called tty_insert_flip_string_and_push_buffer(). It does both tty_insert_flip_string() and tty_flip_buffer_commit() under the port lock. It also calls queue_work(), but outside the lock. See 71a174b39f10 (pty: do tty_flip_buffer_push without port->lock in pty_write) for the reasons. Keep the helper internal-only (in drivers' tty.h). It is not intended to be used widely. Link: https://seclists.org/oss-sec/2022/q2/155 Fixes: 71a174b39f10 (pty: do tty_flip_buffer_push without port->lock in pty= _write) Cc: =E4=B8=80=E5=8F=AA=E7=8B=97 Cc: Dan Carpenter Suggested-by: Hillf Danton Signed-off-by: Jiri Slaby Link: https://lore.kernel.org/r/20220707082558.9250-2-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/pty.c | 14 ++------------ drivers/tty/tty.h | 3 +++ drivers/tty/tty_buffer.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 74bfabe5b453..752dab3356d7 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -111,21 +111,11 @@ static void pty_unthrottle(struct tty_struct *tty) static int pty_write(struct tty_struct *tty, const unsigned char *buf, int= c) { struct tty_struct *to =3D tty->link; - unsigned long flags; =20 - if (tty->flow.stopped) + if (tty->flow.stopped || !c) return 0; =20 - if (c > 0) { - spin_lock_irqsave(&to->port->lock, flags); - /* Stuff the data into the input queue of the other end */ - c =3D tty_insert_flip_string(to->port, buf, c); - spin_unlock_irqrestore(&to->port->lock, flags); - /* And shovel */ - if (c) - tty_flip_buffer_push(to->port); - } - return c; + return tty_insert_flip_string_and_push_buffer(to->port, buf, c); } =20 /** diff --git a/drivers/tty/tty.h b/drivers/tty/tty.h index b710c5ef89ab..f310a8274df1 100644 --- a/drivers/tty/tty.h +++ b/drivers/tty/tty.h @@ -111,4 +111,7 @@ static inline void tty_audit_tiocsti(struct tty_struct = *tty, char ch) =20 ssize_t redirected_tty_write(struct kiocb *, struct iov_iter *); =20 +int tty_insert_flip_string_and_push_buffer(struct tty_port *port, + const unsigned char *chars, size_t cnt); + #endif diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 303a26c1b821..595d8b49c745 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -560,6 +560,37 @@ void tty_flip_buffer_push(struct tty_port *port) } EXPORT_SYMBOL(tty_flip_buffer_push); =20 +/** + * tty_insert_flip_string_and_push_buffer - add characters to the tty buff= er and + * push + * @port: tty port + * @chars: characters + * @size: size + * + * The function combines tty_insert_flip_string() and tty_flip_buffer_push= () + * with the exception of properly holding the @port->lock. + * + * To be used only internally (by pty currently). + * + * Returns: the number added. + */ +int tty_insert_flip_string_and_push_buffer(struct tty_port *port, + const unsigned char *chars, size_t size) +{ + struct tty_bufhead *buf =3D &port->buf; + unsigned long flags; + + spin_lock_irqsave(&port->lock, flags); + size =3D tty_insert_flip_string(port, chars, size); + if (size) + tty_flip_buffer_commit(buf->tail); + spin_unlock_irqrestore(&port->lock, flags); + + queue_work(system_unbound_wq, &buf->work); + + return size; +} + /** * tty_buffer_init - prepare a tty buffer structure * @port: tty port to initialise --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0193CC433EF for ; Tue, 19 Jul 2022 13:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242682AbiGSNDG (ORCPT ); Tue, 19 Jul 2022 09:03:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243158AbiGSNAb (ORCPT ); Tue, 19 Jul 2022 09:00:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59AEF61D9D; Tue, 19 Jul 2022 05:25:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C2DDFB81B82; Tue, 19 Jul 2022 12:25:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AA20C341C6; Tue, 19 Jul 2022 12:25:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233541; bh=8NIaevjtI0s0RjPU5IVi91zMEW1XGTRJCsJb33BsGM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FMURXzd7ncYBp8IJ7zlu7WFw9uYvSRn5m0TmWvQwQfQF7ggAvirXY/tiO2WsbMemd CcNIFL/MZtpFxmLoDla3RUpH8dpqfA2ss6bHCT/L/weMq60hdC3N9Ye5zEtwBmdMy/ CkoM9w12tfq71ohh5aVDSYBo2PRoxuh6j2OrtTAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Lawrence , Sumanth Korikkar , "C. Erastus Toe" , Vasily Gorbik , Alexander Gordeev , Sasha Levin Subject: [PATCH 5.18 157/231] s390/nospec: build expoline.o for modules_prepare target Date: Tue, 19 Jul 2022 13:54:02 +0200 Message-Id: <20220719114727.483669255@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vasily Gorbik [ Upstream commit c4e789572557aa147b13bf7fe09cc99663ed0cf5 ] When CONFIG_EXPOLINE_EXTERN is used expoline thunks are generated from arch/s390/lib/expoline.S and postlinked into every module. This is also true for external modules. Add expoline.o build to the modules_prepare target. Fixes: 1d2ad084800e ("s390/nospec: add an option to use thunk-extern") Reported-by: Joe Lawrence Tested-by: Sumanth Korikkar Acked-by: Sumanth Korikkar Tested-by: C. Erastus Toe Tested-by: Joe Lawrence Link: https://lore.kernel.org/r/patch-1.thread-d13b6c.git-a2387a74dc49.your= -ad-here.call-01656331067-ext-4899@work.hours Signed-off-by: Vasily Gorbik Signed-off-by: Alexander Gordeev Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/s390/Makefile | 8 +++++++- arch/s390/lib/Makefile | 3 ++- arch/s390/lib/expoline/Makefile | 3 +++ arch/s390/lib/{ =3D> expoline}/expoline.S | 0 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 arch/s390/lib/expoline/Makefile rename arch/s390/lib/{ =3D> expoline}/expoline.S (100%) diff --git a/arch/s390/Makefile b/arch/s390/Makefile index eba70d585cb2..5b7e761b2d50 100644 --- a/arch/s390/Makefile +++ b/arch/s390/Makefile @@ -80,7 +80,7 @@ endif =20 ifdef CONFIG_EXPOLINE ifdef CONFIG_EXPOLINE_EXTERN - KBUILD_LDFLAGS_MODULE +=3D arch/s390/lib/expoline.o + KBUILD_LDFLAGS_MODULE +=3D arch/s390/lib/expoline/expoline.o CC_FLAGS_EXPOLINE :=3D -mindirect-branch=3Dthunk-extern CC_FLAGS_EXPOLINE +=3D -mfunction-return=3Dthunk-extern else @@ -162,6 +162,12 @@ vdso_prepare: prepare0 $(Q)$(MAKE) $(build)=3Darch/s390/kernel/vdso64 include/generated/vdso64-o= ffsets.h $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ $(build)=3Darch/s390/kernel/vdso32 include/generated/vdso32-offsets.h) + +ifdef CONFIG_EXPOLINE_EXTERN +modules_prepare: expoline_prepare +expoline_prepare: prepare0 + $(Q)$(MAKE) $(build)=3Darch/s390/lib/expoline arch/s390/lib/expoline/expo= line.o +endif endif =20 # Don't use tabs in echo arguments diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile index 5d415b3db6d1..580d2e3265cb 100644 --- a/arch/s390/lib/Makefile +++ b/arch/s390/lib/Makefile @@ -7,7 +7,6 @@ lib-y +=3D delay.o string.o uaccess.o find.o spinlock.o obj-y +=3D mem.o xor.o lib-$(CONFIG_KPROBES) +=3D probes.o lib-$(CONFIG_UPROBES) +=3D probes.o -obj-$(CONFIG_EXPOLINE_EXTERN) +=3D expoline.o obj-$(CONFIG_S390_KPROBES_SANITY_TEST) +=3D test_kprobes_s390.o test_kprobes_s390-objs +=3D test_kprobes_asm.o test_kprobes.o =20 @@ -22,3 +21,5 @@ obj-$(CONFIG_S390_MODULES_SANITY_TEST) +=3D test_modules.o obj-$(CONFIG_S390_MODULES_SANITY_TEST_HELPERS) +=3D test_modules_helpers.o =20 lib-$(CONFIG_FUNCTION_ERROR_INJECTION) +=3D error-inject.o + +obj-$(CONFIG_EXPOLINE_EXTERN) +=3D expoline/ diff --git a/arch/s390/lib/expoline/Makefile b/arch/s390/lib/expoline/Makef= ile new file mode 100644 index 000000000000..854631d9cb03 --- /dev/null +++ b/arch/s390/lib/expoline/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y +=3D expoline.o diff --git a/arch/s390/lib/expoline.S b/arch/s390/lib/expoline/expoline.S similarity index 100% rename from arch/s390/lib/expoline.S rename to arch/s390/lib/expoline/expoline.S --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33CFAC433EF for ; Tue, 19 Jul 2022 13:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242654AbiGSNDK (ORCPT ); Tue, 19 Jul 2022 09:03:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243181AbiGSNAf (ORCPT ); Tue, 19 Jul 2022 09:00:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B96761DBC; Tue, 19 Jul 2022 05:25:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B7E60B81B38; Tue, 19 Jul 2022 12:25:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5F4EC341CA; Tue, 19 Jul 2022 12:25:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233544; bh=chF6hNHxYwr7S/4cPwX/yypxTGcy93JoJmDViWNqhYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YAlbJG5pD9aN+WSYd+L+Q8yuMv10H3ncO3q5mB6by3QQ3X015Za13QEiOHFPaCmM2 6n1jhZWMowKecQRWXffihyHCa2eiUk1NJ7IlbjrpMApRm6yUWN2aOkw1nGM0dwLnW3 7usj5pcZuRaahBt0DgkFBLTAKfqLO5EhNFlMgjXs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kashyap Desai , sumit.saxena@broadcom.com, chandrakanth.patil@broadcom.com, linux-block@vger.kernel.org, Hannes Reinecke , Guangwu Zhang , Bart Van Assche , Ming Lei , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 158/231] scsi: megaraid: Clear READ queue maps nr_queues Date: Tue, 19 Jul 2022 13:54:03 +0200 Message-Id: <20220719114727.553269401@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Lei [ Upstream commit 8312cd3a7b835ae3033a679e5f0014a40e7891c5 ] The megaraid SCSI driver sets set->nr_maps as 3 if poll_queues is > 0, and blk-mq actually initializes each map's nr_queues as nr_hw_queues. Consequently the driver has to clear READ queue map's nr_queues, otherwise the queue map becomes broken if poll_queues is set as non-zero. Link: https://lore.kernel.org/r/20220706125942.528533-1-ming.lei@redhat.com Fixes: 9e4bec5b2a23 ("scsi: megaraid_sas: mq_poll support") Cc: Kashyap Desai Cc: sumit.saxena@broadcom.com Cc: chandrakanth.patil@broadcom.com Cc: linux-block@vger.kernel.org Cc: Hannes Reinecke Reported-by: Guangwu Zhang Tested-by: Guangwu Zhang Reviewed-by: Bart Van Assche Signed-off-by: Ming Lei Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/scsi/megaraid/megaraid_sas_base.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megar= aid/megaraid_sas_base.c index db6793608447..f5deb0e561a9 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3195,6 +3195,9 @@ static int megasas_map_queues(struct Scsi_Host *shost) qoff +=3D map->nr_queues; offset +=3D map->nr_queues; =20 + /* we never use READ queue, so can't cheat blk-mq */ + shost->tag_set.map[HCTX_TYPE_READ].nr_queues =3D 0; + /* Setup Poll hctx */ map =3D &shost->tag_set.map[HCTX_TYPE_POLL]; map->nr_queues =3D instance->iopoll_q_count; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31C9BC43334 for ; Tue, 19 Jul 2022 13:03:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242843AbiGSNDN (ORCPT ); Tue, 19 Jul 2022 09:03:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243229AbiGSNAk (ORCPT ); Tue, 19 Jul 2022 09:00:40 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D27889A96; Tue, 19 Jul 2022 05:25:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 233C2CE1BE1; Tue, 19 Jul 2022 12:25:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02157C341C6; Tue, 19 Jul 2022 12:25:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233547; bh=d6X8epdJyYdYwTs1Av6IZVYpzkha2ZC1H1i8X3du+K0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W9TCqyuac5uimWh5Wqhs4U9kiLYM7ZhME+pWC2X0LI/zcwae8PZQprSEE0vvCGRNf PKyUnNdHsIRtC0YLML3z3tgMUWlY4bKmLTM5AzojOwVlVwRXMcSTaJhB1DA34fkNxJ muB+7YpPc7Qwoem5eflhFL6iFZ95c2mHK91TRVrk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alim Akhtar , Bean Huo , Bjorn Andersson , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 159/231] scsi: ufs: core: Drop loglevel of WriteBoost message Date: Tue, 19 Jul 2022 13:54:04 +0200 Message-Id: <20220719114727.623214703@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bjorn Andersson [ Upstream commit 2ae57c995003a7840cb6b5ec5f0c06193695321b ] Commit '3b5f3c0d0548 ("scsi: ufs: core: Tidy up WB configuration code")' changed the log level of the write boost enable/disable notification from debug to info. This results in a lot of noise in the kernel log during normal operation. Drop it back to debug level to avoid this. Link: https://lore.kernel.org/r/20220709000027.3929970-1-bjorn.andersson@li= naro.org Fixes: 3b5f3c0d0548 ("scsi: ufs: core: Tidy up WB configuration code") Reviewed-by: Alim Akhtar Acked-by: Bean Huo Signed-off-by: Bjorn Andersson Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 4c9eb4be449c..452ad0612067 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5722,7 +5722,7 @@ int ufshcd_wb_toggle(struct ufs_hba *hba, bool enable) } =20 hba->dev_info.wb_enabled =3D enable; - dev_info(hba->dev, "%s Write Booster %s\n", + dev_dbg(hba->dev, "%s Write Booster %s\n", __func__, enable ? "enabled" : "disabled"); =20 return ret; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C069C433EF for ; Tue, 19 Jul 2022 13:04:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242920AbiGSNED (ORCPT ); Tue, 19 Jul 2022 09:04:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243221AbiGSNAj (ORCPT ); Tue, 19 Jul 2022 09:00:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4368788F25; Tue, 19 Jul 2022 05:25:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 01A816192E; Tue, 19 Jul 2022 12:25:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C48E5C341C6; Tue, 19 Jul 2022 12:25:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233550; bh=iHxXXmstLMpupuDcZJd1p04V9RSVdUvzyRcazmcyTRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DQ2xQ+mDzzAOg4ixEYgRMmKxPbbr5hbjXlPP6Zhvwok8IEq24hBuGHS7Hs6wsotXN 7hqqejNzy0hWip79wfGEZsMGHyWXOjRoMiG2G03YB4h7D3SJLStvfWaekmpIdSB+4k dshyoBdnK09zcum3bFrj9FwHmpx/5iJECHpgtRtM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Israel Rukshin , Keith Busch , Max Gurtovoy , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.18 160/231] nvme: fix block device naming collision Date: Tue, 19 Jul 2022 13:54:05 +0200 Message-Id: <20220719114727.693341695@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Israel Rukshin [ Upstream commit 6961b5e02876b3b47f030a1f1ee8fd3e631ac270 ] The issue exists when multipath is enabled and the namespace is shared, but all the other controller checks at nvme_is_unique_nsid() are false. The reason for this issue is that nvme_is_unique_nsid() returns false when is called from nvme_mpath_alloc_disk() due to an uninitialized value of head->shared. The patch fixes it by setting head->shared before nvme_mpath_alloc_disk() is called. Fixes: 5974ea7ce0f9 ("nvme: allow duplicate NSIDs for private namespaces") Signed-off-by: Israel Rukshin Reviewed-by: Keith Busch Reviewed-by: Max Gurtovoy Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/nvme/host/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index a2862a56fadc..0fef31c935de 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -3726,7 +3726,7 @@ static int nvme_add_ns_cdev(struct nvme_ns *ns) } =20 static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl, - unsigned nsid, struct nvme_ns_ids *ids) + unsigned nsid, struct nvme_ns_ids *ids, bool is_shared) { struct nvme_ns_head *head; size_t size =3D sizeof(*head); @@ -3750,6 +3750,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct= nvme_ctrl *ctrl, head->subsys =3D ctrl->subsys; head->ns_id =3D nsid; head->ids =3D *ids; + head->shared =3D is_shared; kref_init(&head->ref); =20 if (head->ids.csi) { @@ -3830,12 +3831,11 @@ static int nvme_init_ns_head(struct nvme_ns *ns, un= signed nsid, nsid); goto out_unlock; } - head =3D nvme_alloc_ns_head(ctrl, nsid, ids); + head =3D nvme_alloc_ns_head(ctrl, nsid, ids, is_shared); if (IS_ERR(head)) { ret =3D PTR_ERR(head); goto out_unlock; } - head->shared =3D is_shared; } else { ret =3D -EINVAL; if (!is_shared || !head->shared) { --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EBA8C433EF for ; Tue, 19 Jul 2022 13:03:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242851AbiGSNDS (ORCPT ); Tue, 19 Jul 2022 09:03:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243242AbiGSNAn (ORCPT ); Tue, 19 Jul 2022 09:00:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D4978C154; Tue, 19 Jul 2022 05:25:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CCA9861924; Tue, 19 Jul 2022 12:25:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 998F5C341C6; Tue, 19 Jul 2022 12:25:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233553; bh=W6YdQucwnWPTC/znTUpqgn+m+9J1rxn04314aFykl0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mPctHZSTgKE5K/PY9mhDV1VJL//l/KktZrZbYcUPcqm5hseGrriUbjRWgKcQQubA3 wvztT7zFZDniom8HFRyL6JAFpC8whhi3q4wb/n6wYv6XBm1XBCSIJfW5JafDxIiSly tW3HbMdnTeGm9Xs/CixDz7yqBr1if7/EbCi7ollg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Namjae Jeon , Hyunchul Lee , Steve French , Sasha Levin Subject: [PATCH 5.18 161/231] ksmbd: use SOCK_NONBLOCK type for kernel_accept() Date: Tue, 19 Jul 2022 13:54:06 +0200 Message-Id: <20220719114727.763325492@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namjae Jeon [ Upstream commit fe0fde09e1cb83effcf8fafa372533f438d93a1a ] I found that normally it is O_NONBLOCK but there are different value for some arch. /include/linux/net.h: #ifndef SOCK_NONBLOCK #define SOCK_NONBLOCK O_NONBLOCK #endif /arch/alpha/include/asm/socket.h: #define SOCK_NONBLOCK 0x40000000 Use SOCK_NONBLOCK instead of O_NONBLOCK for kernel_accept(). Suggested-by: David Howells Signed-off-by: Namjae Jeon Reviewed-by: Hyunchul Lee Signed-off-by: Steve French Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/ksmbd/transport_tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ksmbd/transport_tcp.c b/fs/ksmbd/transport_tcp.c index 8fef9de787d3..143bba4e4db8 100644 --- a/fs/ksmbd/transport_tcp.c +++ b/fs/ksmbd/transport_tcp.c @@ -230,7 +230,7 @@ static int ksmbd_kthread_fn(void *p) break; } ret =3D kernel_accept(iface->ksmbd_socket, &client_sk, - O_NONBLOCK); + SOCK_NONBLOCK); mutex_unlock(&iface->sock_release_lock); if (ret) { if (ret =3D=3D -EAGAIN) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8C92C43334 for ; Tue, 19 Jul 2022 13:05:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242956AbiGSNEK (ORCPT ); Tue, 19 Jul 2022 09:04:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243316AbiGSNA5 (ORCPT ); Tue, 19 Jul 2022 09:00:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 843019B574; Tue, 19 Jul 2022 05:25:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 34644B81B08; Tue, 19 Jul 2022 12:25:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BFF2C341C6; Tue, 19 Jul 2022 12:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233555; bh=5R47J+25WoueaSlU5nmfgfSL3DFATGk0c8nOn/Bo6FM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RRTqwWnvb0LSZjdejSQviL9ZIvHWthkPtMxh7iTyKMi63DtB4AUJ4ORqByiyCulaq Q+oN7Nuc7T9zvKNNMHnuxwAYVmWFj7yp7z16OrUnRvtdu7LUwSQv1q2D/jxpJmwEPi TXdXgpV5woAYxrL11U4A6EPzlGJ9D3Na4bS2oVq8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Lynch , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 162/231] powerpc/xive/spapr: correct bitmap allocation size Date: Tue, 19 Jul 2022 13:54:07 +0200 Message-Id: <20220719114727.835342808@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Lynch [ Upstream commit 19fc5bb93c6bbdce8292b4d7eed04e2fa118d2fe ] kasan detects access beyond the end of the xibm->bitmap allocation: BUG: KASAN: slab-out-of-bounds in _find_first_zero_bit+0x40/0x140 Read of size 8 at addr c00000001d1d0118 by task swapper/0/1 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.19.0-rc2-00001-g90df023b36dd #28 Call Trace: [c00000001d98f770] [c0000000012baab8] dump_stack_lvl+0xac/0x108 (unreliable) [c00000001d98f7b0] [c00000000068faac] print_report+0x37c/0x710 [c00000001d98f880] [c0000000006902c0] kasan_report+0x110/0x354 [c00000001d98f950] [c000000000692324] __asan_load8+0xa4/0xe0 [c00000001d98f970] [c0000000011c6ed0] _find_first_zero_bit+0x40/0x140 [c00000001d98f9b0] [c0000000000dbfbc] xive_spapr_get_ipi+0xcc/0x260 [c00000001d98fa70] [c0000000000d6d28] xive_setup_cpu_ipi+0x1e8/0x450 [c00000001d98fb30] [c000000004032a20] pSeries_smp_probe+0x5c/0x118 [c00000001d98fb60] [c000000004018b44] smp_prepare_cpus+0x944/0x9ac [c00000001d98fc90] [c000000004009f9c] kernel_init_freeable+0x2d4/0x640 [c00000001d98fd90] [c0000000000131e8] kernel_init+0x28/0x1d0 [c00000001d98fe10] [c00000000000cd54] ret_from_kernel_thread+0x5c/0x64 Allocated by task 0: kasan_save_stack+0x34/0x70 __kasan_kmalloc+0xb4/0xf0 __kmalloc+0x268/0x540 xive_spapr_init+0x4d0/0x77c pseries_init_irq+0x40/0x27c init_IRQ+0x44/0x84 start_kernel+0x2a4/0x538 start_here_common+0x1c/0x20 The buggy address belongs to the object at c00000001d1d0118 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 0 bytes inside of 8-byte region [c00000001d1d0118, c00000001d1d0120) The buggy address belongs to the physical page: page:c00c000000074740 refcount:1 mapcount:0 mapping:0000000000000000 index:= 0xc00000001d1d0558 pfn:0x1d1d flags: 0x7ffff000000200(slab|node=3D0|zone=3D0|lastcpupid=3D0x7ffff) raw: 007ffff000000200 c00000001d0003c8 c00000001d0003c8 c00000001d010480 raw: c00000001d1d0558 0000000001e1000a 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: c00000001d1d0000: fc 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc c00000001d1d0080: fc fc 00 fc fc fc fc fc fc fc fc fc fc fc fc fc >c00000001d1d0100: fc fc fc 02 fc fc fc fc fc fc fc fc fc fc fc fc ^ c00000001d1d0180: fc fc fc fc 04 fc fc fc fc fc fc fc fc fc fc fc c00000001d1d0200: fc fc fc fc fc 04 fc fc fc fc fc fc fc fc fc fc This happens because the allocation uses the wrong unit (bits) when it should pass (BITS_TO_LONGS(count) * sizeof(long)) or equivalent. With small numbers of bits, the allocated object can be smaller than sizeof(long), which results in invalid accesses. Use bitmap_zalloc() to allocate and initialize the irq bitmap, paired with bitmap_free() for consistency. Signed-off-by: Nathan Lynch Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220623182509.3985625-1-nathanl@linux.ibm.= com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/powerpc/sysdev/xive/spapr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/sp= apr.c index 503f544d28e2..b0d36e430dbc 100644 --- a/arch/powerpc/sysdev/xive/spapr.c +++ b/arch/powerpc/sysdev/xive/spapr.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -55,7 +56,7 @@ static int __init xive_irq_bitmap_add(int base, int count) spin_lock_init(&xibm->lock); xibm->base =3D base; xibm->count =3D count; - xibm->bitmap =3D kzalloc(xibm->count, GFP_KERNEL); + xibm->bitmap =3D bitmap_zalloc(xibm->count, GFP_KERNEL); if (!xibm->bitmap) { kfree(xibm); return -ENOMEM; @@ -73,7 +74,7 @@ static void xive_irq_bitmap_remove_all(void) =20 list_for_each_entry_safe(xibm, tmp, &xive_irq_bitmaps, list) { list_del(&xibm->list); - kfree(xibm->bitmap); + bitmap_free(xibm->bitmap); kfree(xibm); } } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6EC1C433EF for ; Tue, 19 Jul 2022 13:05:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242940AbiGSNEH (ORCPT ); Tue, 19 Jul 2022 09:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239253AbiGSNAz (ORCPT ); Tue, 19 Jul 2022 09:00:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FDAB8AB2E; Tue, 19 Jul 2022 05:26:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 88B2561952; Tue, 19 Jul 2022 12:25:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 563DAC341CA; Tue, 19 Jul 2022 12:25:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233558; bh=/S6x7j4GeD6BA8IPzugJ9G79b1PK+pDLuFUQotHkM9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mOSgrgtSofwePLiCfn2JB0Hoj+mHRd9D0EHxIBWop5XwSOwQUWnCqW5bytWaNgJNc gokzrOGH3tRcpk4342CDZyJDEeFGZLBtF0S5QvZWqGOW4HHBaAmHS27z/U6+d0Wp9E +H17aHTPHnEDEA6C0pcY6fXu/iAKsmIucQlHt33Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eli Cohen , "Michael S. Tsirkin" , Jason Wang , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , Sasha Levin Subject: [PATCH 5.18 163/231] vdpa/mlx5: Initialize CVQ vringh only once Date: Tue, 19 Jul 2022 13:54:08 +0200 Message-Id: <20220719114727.905548361@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eli Cohen [ Upstream commit ace9252446ec615cd79a5f77d90edb25c0b9d024 ] Currently, CVQ vringh is initialized inside setup_virtqueues() which is called every time a memory update is done. This is undesirable since it resets all the context of the vring, including the available and used indices. Move the initialization to mlx5_vdpa_set_status() when VIRTIO_CONFIG_S_DRIVER_OK is set. Signed-off-by: Eli Cohen Message-Id: <20220613075958.511064-2-elic@nvidia.com> Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Acked-by: Eugenio P=C3=A9rez Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1965,7 +1965,6 @@ static int verify_driver_features(struct static int setup_virtqueues(struct mlx5_vdpa_dev *mvdev) { struct mlx5_vdpa_net *ndev =3D to_mlx5_vdpa_ndev(mvdev); - struct mlx5_control_vq *cvq =3D &mvdev->cvq; int err; int i; =20 @@ -1975,16 +1974,6 @@ static int setup_virtqueues(struct mlx5_ goto err_vq; } =20 - if (mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ)) { - err =3D vringh_init_iotlb(&cvq->vring, mvdev->actual_features, - MLX5_CVQ_MAX_ENT, false, - (struct vring_desc *)(uintptr_t)cvq->desc_addr, - (struct vring_avail *)(uintptr_t)cvq->driver_addr, - (struct vring_used *)(uintptr_t)cvq->device_addr); - if (err) - goto err_vq; - } - return 0; =20 err_vq: @@ -2257,6 +2246,21 @@ static void clear_vqs_ready(struct mlx5_ ndev->mvdev.cvq.ready =3D false; } =20 +static int setup_cvq_vring(struct mlx5_vdpa_dev *mvdev) +{ + struct mlx5_control_vq *cvq =3D &mvdev->cvq; + int err =3D 0; + + if (mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ)) + err =3D vringh_init_iotlb(&cvq->vring, mvdev->actual_features, + MLX5_CVQ_MAX_ENT, false, + (struct vring_desc *)(uintptr_t)cvq->desc_addr, + (struct vring_avail *)(uintptr_t)cvq->driver_addr, + (struct vring_used *)(uintptr_t)cvq->device_addr); + + return err; +} + static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) { struct mlx5_vdpa_dev *mvdev =3D to_mvdev(vdev); @@ -2269,6 +2273,11 @@ static void mlx5_vdpa_set_status(struct =20 if ((status ^ ndev->mvdev.status) & VIRTIO_CONFIG_S_DRIVER_OK) { if (status & VIRTIO_CONFIG_S_DRIVER_OK) { + err =3D setup_cvq_vring(mvdev); + if (err) { + mlx5_vdpa_warn(mvdev, "failed to setup control VQ vring\n"); + goto err_setup; + } err =3D setup_driver(mvdev); if (err) { mlx5_vdpa_warn(mvdev, "failed to setup driver\n"); From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78FB8CCA47F for ; Tue, 19 Jul 2022 13:05:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242839AbiGSNFN (ORCPT ); Tue, 19 Jul 2022 09:05:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242675AbiGSNBf (ORCPT ); Tue, 19 Jul 2022 09:01:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56A85509C7; Tue, 19 Jul 2022 05:26:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5E021618F1; Tue, 19 Jul 2022 12:26:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D245C341C6; Tue, 19 Jul 2022 12:26:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233561; bh=8ZHzkmLK7hTG93tf9ENQrj40e40dnzUne2DsY5NsBh4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JblmWlPF3JZ7564bWGBOHy7sod8fp4IByFtHiNQasV56RnOjduJG/oIbGgI2PeUQe 0ww9sYLi+oo4jk7ehIvE1ATk5jHbxbcEAjIVbVHqc0lX2g6xkBPhE+V0ApbPnjNFNe SVqqGDmnKotBZdgoxUu07IMDrMrVRxjADTkZgHfo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Parav Pandit , "Michael S. Tsirkin" , Xie Yongji , Jason Wang , Sasha Levin Subject: [PATCH 5.18 164/231] vduse: Tie vduse mgmtdev and its device Date: Tue, 19 Jul 2022 13:54:09 +0200 Message-Id: <20220719114727.976045962@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Parav Pandit [ Upstream commit 0e0348ac3f0a6e6606f1aa5acb1803ada913aa3d ] vduse devices are not backed by any real devices such as PCI. Hence it doesn't have any parent device linked to it. Kernel driver model in [1] suggests to avoid an empty device release callback. Hence tie the mgmtdevice object's life cycle to an allocate dummy struct device instead of static one. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree= /Documentation/core-api/kobject.rst?h=3Dv5.18-rc7#n284 Signed-off-by: Parav Pandit Message-Id: <20220613195223.473966-1-parav@nvidia.com> Signed-off-by: Michael S. Tsirkin Reviewed-by: Xie Yongji Acked-by: Jason Wang Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/vdpa/vdpa_user/vduse_dev.c | 60 ++++++++++++++++++------------ 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vd= use_dev.c index 160e40d03084..02709f8a78bd 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -1475,16 +1475,12 @@ static char *vduse_devnode(struct device *dev, umod= e_t *mode) return kasprintf(GFP_KERNEL, "vduse/%s", dev_name(dev)); } =20 -static void vduse_mgmtdev_release(struct device *dev) -{ -} - -static struct device vduse_mgmtdev =3D { - .init_name =3D "vduse", - .release =3D vduse_mgmtdev_release, +struct vduse_mgmt_dev { + struct vdpa_mgmt_dev mgmt_dev; + struct device dev; }; =20 -static struct vdpa_mgmt_dev mgmt_dev; +static struct vduse_mgmt_dev *vduse_mgmt; =20 static int vduse_dev_init_vdpa(struct vduse_dev *dev, const char *name) { @@ -1509,7 +1505,7 @@ static int vduse_dev_init_vdpa(struct vduse_dev *dev,= const char *name) } set_dma_ops(&vdev->vdpa.dev, &vduse_dev_dma_ops); vdev->vdpa.dma_dev =3D &vdev->vdpa.dev; - vdev->vdpa.mdev =3D &mgmt_dev; + vdev->vdpa.mdev =3D &vduse_mgmt->mgmt_dev; =20 return 0; } @@ -1555,34 +1551,52 @@ static struct virtio_device_id id_table[] =3D { { 0 }, }; =20 -static struct vdpa_mgmt_dev mgmt_dev =3D { - .device =3D &vduse_mgmtdev, - .id_table =3D id_table, - .ops =3D &vdpa_dev_mgmtdev_ops, -}; +static void vduse_mgmtdev_release(struct device *dev) +{ + struct vduse_mgmt_dev *mgmt_dev; + + mgmt_dev =3D container_of(dev, struct vduse_mgmt_dev, dev); + kfree(mgmt_dev); +} =20 static int vduse_mgmtdev_init(void) { int ret; =20 - ret =3D device_register(&vduse_mgmtdev); - if (ret) + vduse_mgmt =3D kzalloc(sizeof(*vduse_mgmt), GFP_KERNEL); + if (!vduse_mgmt) + return -ENOMEM; + + ret =3D dev_set_name(&vduse_mgmt->dev, "vduse"); + if (ret) { + kfree(vduse_mgmt); return ret; + } =20 - ret =3D vdpa_mgmtdev_register(&mgmt_dev); + vduse_mgmt->dev.release =3D vduse_mgmtdev_release; + + ret =3D device_register(&vduse_mgmt->dev); if (ret) - goto err; + goto dev_reg_err; =20 - return 0; -err: - device_unregister(&vduse_mgmtdev); + vduse_mgmt->mgmt_dev.id_table =3D id_table; + vduse_mgmt->mgmt_dev.ops =3D &vdpa_dev_mgmtdev_ops; + vduse_mgmt->mgmt_dev.device =3D &vduse_mgmt->dev; + ret =3D vdpa_mgmtdev_register(&vduse_mgmt->mgmt_dev); + if (ret) + device_unregister(&vduse_mgmt->dev); + + return ret; + +dev_reg_err: + put_device(&vduse_mgmt->dev); return ret; } =20 static void vduse_mgmtdev_exit(void) { - vdpa_mgmtdev_unregister(&mgmt_dev); - device_unregister(&vduse_mgmtdev); + vdpa_mgmtdev_unregister(&vduse_mgmt->mgmt_dev); + device_unregister(&vduse_mgmt->dev); } =20 static int vduse_init(void) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8912FC433EF for ; Tue, 19 Jul 2022 13:06:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243035AbiGSNGJ (ORCPT ); Tue, 19 Jul 2022 09:06:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242544AbiGSNDU (ORCPT ); Tue, 19 Jul 2022 09:03:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4926D509DF; Tue, 19 Jul 2022 05:26:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 734EAB81B89; Tue, 19 Jul 2022 12:26:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D630EC341CA; Tue, 19 Jul 2022 12:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233567; bh=2s+Qy8PAT+eFTqzOukEbXvmcPXQSWYaLsQ5kNH32U4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IfFSc+Dgwvy/P0LR4DK6ukpO1FiIo7MyabNPKcSnrjv50kZu48LA3kOTcY8uD4pxW z+Dn8VrEVC8taPqwvvYf2971bxs/V5K1s4Oo4kzkf3AQCfVpgBefhlqWthNJR0T68D f0WAOSFd/3HNo2cSDzxdbJERpgkJWhjIRKP3xlFc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Pandruvada , Andy Shevchenko , "David E. Box" , Gayatri Kammela , Rajneesh Bhardwaj , Hans de Goede , Sasha Levin Subject: [PATCH 5.18 165/231] platform/x86: intel/pmc: Add Alder Lake N support to PMC core driver Date: Tue, 19 Jul 2022 13:54:10 +0200 Message-Id: <20220719114728.045273325@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gayatri Kammela [ Upstream commit d63eae6747eb8b3192e89712f6553c6aa162f872 ] Add Alder Lake N (ADL-N) to the list of the platforms that Intel's PMC core driver supports. Alder Lake N reuses all the TigerLake PCH IPs. Cc: Srinivas Pandruvada Cc: Andy Shevchenko Cc: David E. Box Signed-off-by: Gayatri Kammela Reviewed-by: Rajneesh Bhardwaj Link: https://lore.kernel.org/r/20220615002751.3371730-1-gayatri.kammela@li= nux.intel.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/platform/x86/intel/pmc/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/i= ntel/pmc/core.c index 8ee15a7252c7..c3ec5dc88bbf 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -1911,6 +1911,7 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = =3D { X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_L, &icl_reg_map), X86_MATCH_INTEL_FAM6_MODEL(ROCKETLAKE, &tgl_reg_map), X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, &tgl_reg_map), + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, &tgl_reg_map), X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, &adl_reg_map), X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, &tgl_reg_map), {} --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6412EC433EF for ; Tue, 19 Jul 2022 13:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242847AbiGSNF3 (ORCPT ); Tue, 19 Jul 2022 09:05:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242938AbiGSNEH (ORCPT ); Tue, 19 Jul 2022 09:04:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAB9F9CE2F; Tue, 19 Jul 2022 05:26:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6187DB81B8A; Tue, 19 Jul 2022 12:26:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A648FC341CB; Tue, 19 Jul 2022 12:26:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233570; bh=03dBgzcmkR/ZZgI2wyRT32ne7whuWwal3v7bzdM0djc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mlxw7TnRfb6RcHoCS6Au4Yzwzzbqu2XNngWsMoUE44vlAPBl5IF2GJoVxMYLtA7EN x/Nps18w1tXNxhjhI4hTV9WyU70rUEuDFLJYMUEJks42TtbOyq1Cbk3a28TpVZCtLx vCLq8YIlSzbTxz6HaqrTCGgMzy6QMVbKC8wAXalo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephan Gerhold , "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 5.18 166/231] virtio_mmio: Add missing PM calls to freeze/restore Date: Tue, 19 Jul 2022 13:54:11 +0200 Message-Id: <20220719114728.120438349@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephan Gerhold [ Upstream commit ed7ac37fde33ccd84e4bd2b9363c191f925364c7 ] Most virtio drivers provide freeze/restore callbacks to finish up device usage before suspend and to reinitialize the virtio device after resume. However, these callbacks are currently only called when using virtio_pci. virtio_mmio does not have any PM ops defined. This causes problems for example after suspend to disk (hibernation), since the virtio devices might lose their state after the VMM is restarted. Calling virtio_device_freeze()/restore() ensures that the virtio devices are re-initialized correctly. Fix this by implementing the dev_pm_ops for virtio_mmio, similar to virtio_pci_common. Signed-off-by: Stephan Gerhold Message-Id: <20220621110621.3638025-2-stephan.gerhold@kernkonzept.com> Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/virtio/virtio_mmio.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 1dd396d4bebb..7522832529dd 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include @@ -543,6 +544,25 @@ static const struct virtio_config_ops virtio_mmio_conf= ig_ops =3D { .get_shm_region =3D vm_get_shm_region, }; =20 +#ifdef CONFIG_PM_SLEEP +static int virtio_mmio_freeze(struct device *dev) +{ + struct virtio_mmio_device *vm_dev =3D dev_get_drvdata(dev); + + return virtio_device_freeze(&vm_dev->vdev); +} + +static int virtio_mmio_restore(struct device *dev) +{ + struct virtio_mmio_device *vm_dev =3D dev_get_drvdata(dev); + + return virtio_device_restore(&vm_dev->vdev); +} + +static const struct dev_pm_ops virtio_mmio_pm_ops =3D { + SET_SYSTEM_SLEEP_PM_OPS(virtio_mmio_freeze, virtio_mmio_restore) +}; +#endif =20 static void virtio_mmio_release_dev(struct device *_d) { @@ -786,6 +806,9 @@ static struct platform_driver virtio_mmio_driver =3D { .name =3D "virtio-mmio", .of_match_table =3D virtio_mmio_match, .acpi_match_table =3D ACPI_PTR(virtio_mmio_acpi_match), +#ifdef CONFIG_PM_SLEEP + .pm =3D &virtio_mmio_pm_ops, +#endif }, }; =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A22E6CCA47F for ; Tue, 19 Jul 2022 13:05:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242916AbiGSNFY (ORCPT ); Tue, 19 Jul 2022 09:05:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242903AbiGSNDv (ORCPT ); Tue, 19 Jul 2022 09:03:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71A279CE04; Tue, 19 Jul 2022 05:26:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1DC5AB81B08; Tue, 19 Jul 2022 12:26:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71B0CC341C6; Tue, 19 Jul 2022 12:26:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233572; bh=aArpVS4VNheVFDiOhTep3qwKK7+LFJJviBSs/dkrB5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YrYtGqCH0WIRI5jC8zIbhI1PsP/iDbEDiGBj4MeotyNGzhQDHPdWLVdSGq1KmYsPg wYeOOsTFNxNg7sqtkjTyMxxbjcEboEjF8+YApLf0HGHcgNOAIuCudnLEd60ufeBTIs DMNW4/nnRhsQZvbtYxLIssw6Rb35z2IJjDlN2CKE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephan Gerhold , "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 5.18 167/231] virtio_mmio: Restore guest page size on resume Date: Tue, 19 Jul 2022 13:54:12 +0200 Message-Id: <20220719114728.202958489@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephan Gerhold [ Upstream commit e0c2ce8217955537dd5434baeba061f209797119 ] Virtio devices might lose their state when the VMM is restarted after a suspend to disk (hibernation) cycle. This means that the guest page size register must be restored for the virtio_mmio legacy interface, since otherwise the virtio queues are not functional. This is particularly problematic for QEMU that currently still defaults to using the legacy interface for virtio_mmio. Write the guest page size register again in virtio_mmio_restore() to make legacy virtio_mmio devices work correctly after hibernation. Signed-off-by: Stephan Gerhold Message-Id: <20220621110621.3638025-3-stephan.gerhold@kernkonzept.com> Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/virtio/virtio_mmio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 7522832529dd..fe696aafaed8 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -556,6 +556,9 @@ static int virtio_mmio_restore(struct device *dev) { struct virtio_mmio_device *vm_dev =3D dev_get_drvdata(dev); =20 + if (vm_dev->version =3D=3D 1) + writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); + return virtio_device_restore(&vm_dev->vdev); } =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EC67C433EF for ; Tue, 19 Jul 2022 13:05:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242983AbiGSNF4 (ORCPT ); Tue, 19 Jul 2022 09:05:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243152AbiGSNEq (ORCPT ); Tue, 19 Jul 2022 09:04:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 340C29DEE2; Tue, 19 Jul 2022 05:26:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0B8B5B81B38; Tue, 19 Jul 2022 12:26:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42B0BC341C6; Tue, 19 Jul 2022 12:26:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233575; bh=2uH50JqlAFrD0o1DsiSvdcxK12eTUlFdFrNXpsSpx+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h5E1GgMcy3YsCvO0B5PLq5MZW4NRTFrSR9m0vV1UHeHfUAszSbpSHPmzT5m1qxIj/ VcourIGZauukeGeNCst0KEg7Am2tnkC8V2Tc9Pya9Avw5psupH3ruOY1Iqd40ze+6J 9Evek3S4tqJqx8aGXtSw+ssogqS3Nk2XK6OJD4lU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso , Florian Westphal , Sasha Levin Subject: [PATCH 5.18 168/231] netfilter: nf_tables: avoid skb access on nf_stolen Date: Tue, 19 Jul 2022 13:54:13 +0200 Message-Id: <20220719114728.292729664@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit e34b9ed96ce3b06c79bf884009b16961ca478f87 ] When verdict is NF_STOLEN, the skb might have been freed. When tracing is enabled, this can result in a use-after-free: 1. access to skb->nf_trace 2. access to skb->mark 3. computation of trace id 4. dump of packet payload To avoid 1, keep a cached copy of skb->nf_trace in the trace state struct. Refresh this copy whenever verdict is !=3D STOLEN. Avoid 2 by skipping skb->mark access if verdict is STOLEN. 3 is avoided by precomputing the trace id. Only dump the packet when verdict is not "STOLEN". Reported-by: Pablo Neira Ayuso Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/net/netfilter/nf_tables.h | 16 ++++++----- net/netfilter/nf_tables_core.c | 24 ++++++++++++++--- net/netfilter/nf_tables_trace.c | 44 +++++++++++++++++-------------- 3 files changed, 55 insertions(+), 29 deletions(-) diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_t= ables.h index f0c3a1ee197c..64cf655c818c 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h @@ -1342,24 +1342,28 @@ void nft_unregister_flowtable_type(struct nf_flowta= ble_type *type); /** * struct nft_traceinfo - nft tracing information and state * + * @trace: other struct members are initialised + * @nf_trace: copy of skb->nf_trace before rule evaluation + * @type: event type (enum nft_trace_types) + * @skbid: hash of skb to be used as trace id + * @packet_dumped: packet headers sent in a previous traceinfo message * @pkt: pktinfo currently processed * @basechain: base chain currently processed * @chain: chain currently processed * @rule: rule that was evaluated * @verdict: verdict given by rule - * @type: event type (enum nft_trace_types) - * @packet_dumped: packet headers sent in a previous traceinfo message - * @trace: other struct members are initialised */ struct nft_traceinfo { + bool trace; + bool nf_trace; + bool packet_dumped; + enum nft_trace_types type:8; + u32 skbid; const struct nft_pktinfo *pkt; const struct nft_base_chain *basechain; const struct nft_chain *chain; const struct nft_rule_dp *rule; const struct nft_verdict *verdict; - enum nft_trace_types type; - bool packet_dumped; - bool trace; }; =20 void nft_trace_init(struct nft_traceinfo *info, const struct nft_pktinfo *= pkt, diff --git a/net/netfilter/nf_tables_core.c b/net/netfilter/nf_tables_core.c index 53f40e473855..3ddce24ac76d 100644 --- a/net/netfilter/nf_tables_core.c +++ b/net/netfilter/nf_tables_core.c @@ -25,9 +25,7 @@ static noinline void __nft_trace_packet(struct nft_tracei= nfo *info, const struct nft_chain *chain, enum nft_trace_types type) { - const struct nft_pktinfo *pkt =3D info->pkt; - - if (!info->trace || !pkt->skb->nf_trace) + if (!info->trace || !info->nf_trace) return; =20 info->chain =3D chain; @@ -42,11 +40,24 @@ static inline void nft_trace_packet(struct nft_traceinf= o *info, enum nft_trace_types type) { if (static_branch_unlikely(&nft_trace_enabled)) { + const struct nft_pktinfo *pkt =3D info->pkt; + + info->nf_trace =3D pkt->skb->nf_trace; info->rule =3D rule; __nft_trace_packet(info, chain, type); } } =20 +static inline void nft_trace_copy_nftrace(struct nft_traceinfo *info) +{ + if (static_branch_unlikely(&nft_trace_enabled)) { + const struct nft_pktinfo *pkt =3D info->pkt; + + if (info->trace) + info->nf_trace =3D pkt->skb->nf_trace; + } +} + static void nft_bitwise_fast_eval(const struct nft_expr *expr, struct nft_regs *regs) { @@ -85,6 +96,7 @@ static noinline void __nft_trace_verdict(struct nft_trace= info *info, const struct nft_chain *chain, const struct nft_regs *regs) { + const struct nft_pktinfo *pkt =3D info->pkt; enum nft_trace_types type; =20 switch (regs->verdict.code) { @@ -92,8 +104,13 @@ static noinline void __nft_trace_verdict(struct nft_tra= ceinfo *info, case NFT_RETURN: type =3D NFT_TRACETYPE_RETURN; break; + case NF_STOLEN: + type =3D NFT_TRACETYPE_RULE; + /* can't access skb->nf_trace; use copy */ + break; default: type =3D NFT_TRACETYPE_RULE; + info->nf_trace =3D pkt->skb->nf_trace; break; } =20 @@ -254,6 +271,7 @@ nft_do_chain(struct nft_pktinfo *pkt, void *priv) switch (regs.verdict.code) { case NFT_BREAK: regs.verdict.code =3D NFT_CONTINUE; + nft_trace_copy_nftrace(&info); continue; case NFT_CONTINUE: nft_trace_packet(&info, chain, rule, diff --git a/net/netfilter/nf_tables_trace.c b/net/netfilter/nf_tables_trac= e.c index 5041725423c2..1163ba9c1401 100644 --- a/net/netfilter/nf_tables_trace.c +++ b/net/netfilter/nf_tables_trace.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include @@ -25,22 +25,6 @@ DEFINE_STATIC_KEY_FALSE(nft_trace_enabled); EXPORT_SYMBOL_GPL(nft_trace_enabled); =20 -static int trace_fill_id(struct sk_buff *nlskb, struct sk_buff *skb) -{ - __be32 id; - - /* using skb address as ID results in a limited number of - * values (and quick reuse). - * - * So we attempt to use as many skb members that will not - * change while skb is with netfilter. - */ - id =3D (__be32)jhash_2words(hash32_ptr(skb), skb_get_hash(skb), - skb->skb_iif); - - return nla_put_be32(nlskb, NFTA_TRACE_ID, id); -} - static int trace_fill_header(struct sk_buff *nlskb, u16 type, const struct sk_buff *skb, int off, unsigned int len) @@ -186,6 +170,7 @@ void nft_trace_notify(struct nft_traceinfo *info) struct nlmsghdr *nlh; struct sk_buff *skb; unsigned int size; + u32 mark =3D 0; u16 event; =20 if (!nfnetlink_has_listeners(nft_net(pkt), NFNLGRP_NFTRACE)) @@ -229,7 +214,7 @@ void nft_trace_notify(struct nft_traceinfo *info) if (nla_put_be32(skb, NFTA_TRACE_TYPE, htonl(info->type))) goto nla_put_failure; =20 - if (trace_fill_id(skb, pkt->skb)) + if (nla_put_u32(skb, NFTA_TRACE_ID, info->skbid)) goto nla_put_failure; =20 if (nla_put_string(skb, NFTA_TRACE_CHAIN, info->chain->name)) @@ -249,16 +234,24 @@ void nft_trace_notify(struct nft_traceinfo *info) case NFT_TRACETYPE_RULE: if (nft_verdict_dump(skb, NFTA_TRACE_VERDICT, info->verdict)) goto nla_put_failure; + + /* pkt->skb undefined iff NF_STOLEN, disable dump */ + if (info->verdict->code =3D=3D NF_STOLEN) + info->packet_dumped =3D true; + else + mark =3D pkt->skb->mark; + break; case NFT_TRACETYPE_POLICY: + mark =3D pkt->skb->mark; + if (nla_put_be32(skb, NFTA_TRACE_POLICY, htonl(info->basechain->policy))) goto nla_put_failure; break; } =20 - if (pkt->skb->mark && - nla_put_be32(skb, NFTA_TRACE_MARK, htonl(pkt->skb->mark))) + if (mark && nla_put_be32(skb, NFTA_TRACE_MARK, htonl(mark))) goto nla_put_failure; =20 if (!info->packet_dumped) { @@ -283,9 +276,20 @@ void nft_trace_init(struct nft_traceinfo *info, const = struct nft_pktinfo *pkt, const struct nft_verdict *verdict, const struct nft_chain *chain) { + static siphash_key_t trace_key __read_mostly; + struct sk_buff *skb =3D pkt->skb; + info->basechain =3D nft_base_chain(chain); info->trace =3D true; + info->nf_trace =3D pkt->skb->nf_trace; info->packet_dumped =3D false; info->pkt =3D pkt; info->verdict =3D verdict; + + net_get_random_once(&trace_key, sizeof(trace_key)); + + info->skbid =3D (u32)siphash_3u32(hash32_ptr(skb), + skb_get_hash(skb), + skb->skb_iif, + &trace_key); } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65E88C433EF for ; Tue, 19 Jul 2022 13:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242965AbiGSNFr (ORCPT ); Tue, 19 Jul 2022 09:05:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243125AbiGSNEo (ORCPT ); Tue, 19 Jul 2022 09:04:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34BEA9DEED; Tue, 19 Jul 2022 05:26:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2DF7A61956; Tue, 19 Jul 2022 12:26:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D9DFC341CE; Tue, 19 Jul 2022 12:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233578; bh=ZWyNL/PLV0KBvNJrAWbcNjFGF/dSsbZ4x/okfB1xgSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2kDtcWDhNeadF3Ltd28/A1D+FVx6cnj6Rp5115M7cHt4YyGd7Ac30yeDyNHjn1AFl 1cUzQYd+W3wknw+Itfe9zklG01zvhzoJOU/BK5IotXEHp6+ElIY0QIoQv5dFtCnSYI htYoC4CwCLYQhHLEzvhzS61m5WV4RN4lO7y/j9Nk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Radim Hrazdil , Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.18 169/231] netfilter: br_netfilter: do not skip all hooks with 0 priority Date: Tue, 19 Jul 2022 13:54:14 +0200 Message-Id: <20220719114728.375573506@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit c2577862eeb0be94f151f2f1fff662b028061b00 ] When br_netfilter module is loaded, skbs may be diverted to the ipv4/ipv6 hooks, just like as if we were routing. Unfortunately, bridge filter hooks with priority 0 may be skipped in this case. Example: 1. an nftables bridge ruleset is loaded, with a prerouting hook that has priority 0. 2. interface is added to the bridge. 3. no tcp packet is ever seen by the bridge prerouting hook. 4. flush the ruleset 5. load the bridge ruleset again. 6. tcp packets are processed as expected. After 1) the only registered hook is the bridge prerouting hook, but its not called yet because the bridge hasn't been brought up yet. After 2), hook order is: 0 br_nf_pre_routing // br_netfilter internal hook 0 chain bridge f prerouting // nftables bridge ruleset The packet is diverted to br_nf_pre_routing. If call-iptables is off, the nftables bridge ruleset is called as expected. But if its enabled, br_nf_hook_thresh() will skip it because it assumes that all 0-priority hooks had been called previously in bridge context. To avoid this, check for the br_nf_pre_routing hook itself, we need to resume directly after it, even if this hook has a priority of 0. Unfortunately, this still results in different packet flow. With this fix, the eval order after in 3) is: 1. br_nf_pre_routing 2. ip(6)tables (if enabled) 3. nftables bridge but after 5 its the much saner: 1. nftables bridge 2. br_nf_pre_routing 3. ip(6)tables (if enabled) Unfortunately I don't see a solution here: It would be possible to move br_nf_pre_routing to a higher priority so that it will be called later in the pipeline, but this also impacts ebtables evaluation order, and would still result in this very ordering problem for all nftables-bridge hooks with the same priority as the br_nf_pre_routing one. Searching back through the git history I don't think this has ever behaved in any other way, hence, no fixes-tag. Reported-by: Radim Hrazdil Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/bridge/br_netfilter_hooks.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hook= s.c index 4fd882686b04..ff4779036649 100644 --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c @@ -1012,9 +1012,24 @@ int br_nf_hook_thresh(unsigned int hook, struct net = *net, return okfn(net, sk, skb); =20 ops =3D nf_hook_entries_get_hook_ops(e); - for (i =3D 0; i < e->num_hook_entries && - ops[i]->priority <=3D NF_BR_PRI_BRNF; i++) - ; + for (i =3D 0; i < e->num_hook_entries; i++) { + /* These hooks have already been called */ + if (ops[i]->priority < NF_BR_PRI_BRNF) + continue; + + /* These hooks have not been called yet, run them. */ + if (ops[i]->priority > NF_BR_PRI_BRNF) + break; + + /* take a closer look at NF_BR_PRI_BRNF. */ + if (ops[i]->hook =3D=3D br_nf_pre_routing) { + /* This hook diverted the skb to this function, + * hooks after this have not been run yet. + */ + i++; + break; + } + } =20 nf_hook_state_init(&state, hook, NFPROTO_BRIDGE, indev, outdev, sk, net, okfn); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1645AC43334 for ; Tue, 19 Jul 2022 13:06:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243089AbiGSNGU (ORCPT ); Tue, 19 Jul 2022 09:06:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243242AbiGSNE4 (ORCPT ); Tue, 19 Jul 2022 09:04:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3B839E461; Tue, 19 Jul 2022 05:26:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E902618F1; Tue, 19 Jul 2022 12:26:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1F14C341C6; Tue, 19 Jul 2022 12:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233581; bh=FTub9thA/XFO0HIXNb1G0/Bw07j1NqKpudxVT0lkUAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wBs9RReNyfA1lQKSKeGuFKfu0IKc3o2Lkj0v5+0PB72+ZuEV0duFsPLh6qYt2Z1rl hVa3HO7lqj8TvGyqWdhBzj2nCUKcVY8t5y3KZM+fcyfL3bTujhgJN10pz6viD3E7w5 02tFaYM7z4VQJ/2PDazBACyXUfDmFPGrHfUHAIVc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 170/231] scsi: hisi_sas: Limit max hw sectors for v3 HW Date: Tue, 19 Jul 2022 13:54:15 +0200 Message-Id: <20220719114728.458610949@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Garry [ Upstream commit fce54ed027577517df1e74b7d54dc2b1bd536887 ] If the controller is behind an IOMMU then the IOMMU IOVA caching range can affect performance, as discussed in [0]. Limit the max HW sectors to not exceed this limit. We need to hardcode the value until a proper DMA mapping API is available. [0] https://lore.kernel.org/linux-iommu/20210129092120.1482-1-thunder.leizh= en@huawei.com/ Link: https://lore.kernel.org/r/1655988119-223714-1-git-send-email-john.gar= ry@huawei.com Signed-off-by: John Garry Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas= /hisi_sas_v3_hw.c index 7d819fc0395e..eb86afb21aab 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -2782,6 +2782,7 @@ static int slave_configure_v3_hw(struct scsi_device *= sdev) struct hisi_hba *hisi_hba =3D shost_priv(shost); struct device *dev =3D hisi_hba->dev; int ret =3D sas_slave_configure(sdev); + unsigned int max_sectors; =20 if (ret) return ret; @@ -2799,6 +2800,12 @@ static int slave_configure_v3_hw(struct scsi_device = *sdev) } } =20 + /* Set according to IOMMU IOVA caching limit */ + max_sectors =3D min_t(size_t, queue_max_hw_sectors(sdev->request_queue), + (PAGE_SIZE * 32) >> SECTOR_SHIFT); + + blk_queue_max_hw_sectors(sdev->request_queue, max_sectors); + return 0; } =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C65DBC433EF for ; Tue, 19 Jul 2022 13:06:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243051AbiGSNGQ (ORCPT ); Tue, 19 Jul 2022 09:06:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243231AbiGSNEx (ORCPT ); Tue, 19 Jul 2022 09:04:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A9D29F040; Tue, 19 Jul 2022 05:26:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8D94BB81B36; Tue, 19 Jul 2022 12:26:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6AB9C341C6; Tue, 19 Jul 2022 12:26:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233584; bh=2tvJ+fipO4VZmFYhZ9As3c1NcfOg4s2bZwVEwvLpA6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w0xm1JlZDNgNKXCG9qJw7yeQHXkN+Uga/WLNZ9zPhxlb/FxAZciyYcicrRoFTmqrm ws17UzFHn4DmKUOyNpfRst9YfOXQQFv6paPigLa1+ht7SSQoMW3wgDNzZfGHSXjeZG sJU/YpG5lSNHUVbK3mDC7OFrqy6BAjMN2F4v81+w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Viresh Kumar , Sasha Levin Subject: [PATCH 5.18 171/231] cpufreq: pmac32-cpufreq: Fix refcount leak bug Date: Tue, 19 Jul 2022 13:54:16 +0200 Message-Id: <20220719114728.539031722@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit ccd7567d4b6cf187fdfa55f003a9e461ee629e36 ] In pmac_cpufreq_init_MacRISC3(), we need to add corresponding of_node_put() for the three node pointers whose refcount have been incremented by of_find_node_by_name(). Signed-off-by: Liang He Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/cpufreq/pmac32-cpufreq.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpuf= req.c index 4f20c6a9108d..8e41fe9ee870 100644 --- a/drivers/cpufreq/pmac32-cpufreq.c +++ b/drivers/cpufreq/pmac32-cpufreq.c @@ -470,6 +470,10 @@ static int pmac_cpufreq_init_MacRISC3(struct device_no= de *cpunode) if (slew_done_gpio_np) slew_done_gpio =3D read_gpio(slew_done_gpio_np); =20 + of_node_put(volt_gpio_np); + of_node_put(freq_gpio_np); + of_node_put(slew_done_gpio_np); + /* If we use the frequency GPIOs, calculate the min/max speeds based * on the bus frequencies */ --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFC7AC433EF for ; Tue, 19 Jul 2022 13:05:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242906AbiGSNFe (ORCPT ); Tue, 19 Jul 2022 09:05:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243038AbiGSNEb (ORCPT ); Tue, 19 Jul 2022 09:04:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CDF49D520; Tue, 19 Jul 2022 05:26:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 34AE1B81B82; Tue, 19 Jul 2022 12:26:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94C92C341C6; Tue, 19 Jul 2022 12:26:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233587; bh=GitRd9YEWePul5rGo7gfgSKkUyHTe2oSCQiqVeiTiec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cr/1VgvEyltW6WHz+k2BM1kKju5Qc49GY3cz7S4rh6Q+KB13ripNIbDaLTGX6/293 RhTftH+0w4wGGSdaHw1zME4lec3HRw0vVdthQPnki0Y0CZdNTgYctISsN9nyDxoOtI TNrR25z9O29kowxPtKzVHjlhLxM4A1uq+kczIvX8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Limonciello , Mark Pearson , Hans de Goede , Sasha Levin Subject: [PATCH 5.18 172/231] platform/x86: thinkpad-acpi: profile capabilities as integer Date: Tue, 19 Jul 2022 13:54:17 +0200 Message-Id: <20220719114728.621505074@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Pearson [ Upstream commit 42504af775361ca2330a2bfde496a5ebc5655c86 ] Currently the active mode (PSC/MMC) is stored in an enum and queried throughout the driver. Other driver changes will enumerate additional submodes that are relevant to be tracked, so instead track PSC/MMC in a single integer variable. Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello Signed-off-by: Mark Pearson Link: https://lore.kernel.org/r/20220603170212.164963-1-markpearson@lenovo.= com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/platform/x86/thinkpad_acpi.c | 45 ++++++++++++++----------------= ----- 1 file changed, 18 insertions(+), 27 deletions(-) --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10300,21 +10300,15 @@ static struct ibm_struct proxsensor_driv #define DYTC_DISABLE_CQL DYTC_SET_COMMAND(DYTC_FUNCTION_CQL, DYTC_MODE_MMC= _BALANCE, 0) #define DYTC_ENABLE_CQL DYTC_SET_COMMAND(DYTC_FUNCTION_CQL, DYTC_MODE_MMC_= BALANCE, 1) =20 -enum dytc_profile_funcmode { - DYTC_FUNCMODE_NONE =3D 0, - DYTC_FUNCMODE_MMC, - DYTC_FUNCMODE_PSC, -}; - -static enum dytc_profile_funcmode dytc_profile_available; static enum platform_profile_option dytc_current_profile; static atomic_t dytc_ignore_event =3D ATOMIC_INIT(0); static DEFINE_MUTEX(dytc_mutex); +static int dytc_capabilities; static bool dytc_mmc_get_available; =20 static int convert_dytc_to_profile(int dytcmode, enum platform_profile_opt= ion *profile) { - if (dytc_profile_available =3D=3D DYTC_FUNCMODE_MMC) { + if (dytc_capabilities & BIT(DYTC_FC_MMC)) { switch (dytcmode) { case DYTC_MODE_MMC_LOWPOWER: *profile =3D PLATFORM_PROFILE_LOW_POWER; @@ -10331,7 +10325,7 @@ static int convert_dytc_to_profile(int d } return 0; } - if (dytc_profile_available =3D=3D DYTC_FUNCMODE_PSC) { + if (dytc_capabilities & BIT(DYTC_FC_PSC)) { switch (dytcmode) { case DYTC_MODE_PSC_LOWPOWER: *profile =3D PLATFORM_PROFILE_LOW_POWER; @@ -10353,21 +10347,21 @@ static int convert_profile_to_dytc(enum { switch (profile) { case PLATFORM_PROFILE_LOW_POWER: - if (dytc_profile_available =3D=3D DYTC_FUNCMODE_MMC) + if (dytc_capabilities & BIT(DYTC_FC_MMC)) *perfmode =3D DYTC_MODE_MMC_LOWPOWER; - else if (dytc_profile_available =3D=3D DYTC_FUNCMODE_PSC) + else if (dytc_capabilities & BIT(DYTC_FC_PSC)) *perfmode =3D DYTC_MODE_PSC_LOWPOWER; break; case PLATFORM_PROFILE_BALANCED: - if (dytc_profile_available =3D=3D DYTC_FUNCMODE_MMC) + if (dytc_capabilities & BIT(DYTC_FC_MMC)) *perfmode =3D DYTC_MODE_MMC_BALANCE; - else if (dytc_profile_available =3D=3D DYTC_FUNCMODE_PSC) + else if (dytc_capabilities & BIT(DYTC_FC_PSC)) *perfmode =3D DYTC_MODE_PSC_BALANCE; break; case PLATFORM_PROFILE_PERFORMANCE: - if (dytc_profile_available =3D=3D DYTC_FUNCMODE_MMC) + if (dytc_capabilities & BIT(DYTC_FC_MMC)) *perfmode =3D DYTC_MODE_MMC_PERFORM; - else if (dytc_profile_available =3D=3D DYTC_FUNCMODE_PSC) + else if (dytc_capabilities & BIT(DYTC_FC_PSC)) *perfmode =3D DYTC_MODE_PSC_PERFORM; break; default: /* Unknown profile */ @@ -10446,7 +10440,7 @@ static int dytc_profile_set(struct platf if (err) goto unlock; =20 - if (dytc_profile_available =3D=3D DYTC_FUNCMODE_MMC) { + if (dytc_capabilities & BIT(DYTC_FC_MMC)) { if (profile =3D=3D PLATFORM_PROFILE_BALANCED) { /* * To get back to balanced mode we need to issue a reset command. @@ -10465,7 +10459,7 @@ static int dytc_profile_set(struct platf goto unlock; } } - if (dytc_profile_available =3D=3D DYTC_FUNCMODE_PSC) { + if (dytc_capabilities & BIT(DYTC_FC_PSC)) { err =3D dytc_command(DYTC_SET_COMMAND(DYTC_FUNCTION_PSC, perfmode, 1), &= output); if (err) goto unlock; @@ -10484,12 +10478,12 @@ static void dytc_profile_refresh(void) int perfmode; =20 mutex_lock(&dytc_mutex); - if (dytc_profile_available =3D=3D DYTC_FUNCMODE_MMC) { + if (dytc_capabilities & BIT(DYTC_FC_MMC)) { if (dytc_mmc_get_available) err =3D dytc_command(DYTC_CMD_MMC_GET, &output); else err =3D dytc_cql_command(DYTC_CMD_GET, &output); - } else if (dytc_profile_available =3D=3D DYTC_FUNCMODE_PSC) + } else if (dytc_capabilities & BIT(DYTC_FC_PSC)) err =3D dytc_command(DYTC_CMD_GET, &output); =20 mutex_unlock(&dytc_mutex); @@ -10518,7 +10512,6 @@ static int tpacpi_dytc_profile_init(stru set_bit(PLATFORM_PROFILE_BALANCED, dytc_profile.choices); set_bit(PLATFORM_PROFILE_PERFORMANCE, dytc_profile.choices); =20 - dytc_profile_available =3D DYTC_FUNCMODE_NONE; err =3D dytc_command(DYTC_CMD_QUERY, &output); if (err) return err; @@ -10531,13 +10524,12 @@ static int tpacpi_dytc_profile_init(stru return -ENODEV; =20 /* Check what capabilities are supported */ - err =3D dytc_command(DYTC_CMD_FUNC_CAP, &output); + err =3D dytc_command(DYTC_CMD_FUNC_CAP, &dytc_capabilities); if (err) return err; =20 - if (output & BIT(DYTC_FC_MMC)) { /* MMC MODE */ - dytc_profile_available =3D DYTC_FUNCMODE_MMC; - + if (dytc_capabilities & BIT(DYTC_FC_MMC)) { /* MMC MODE */ + pr_debug("MMC is supported\n"); /* * Check if MMC_GET functionality available * Version > 6 and return success from MMC_GET command @@ -10548,8 +10540,8 @@ static int tpacpi_dytc_profile_init(stru if (!err && ((output & DYTC_ERR_MASK) =3D=3D DYTC_ERR_SUCCESS)) dytc_mmc_get_available =3D true; } - } else if (output & BIT(DYTC_FC_PSC)) { /* PSC MODE */ - dytc_profile_available =3D DYTC_FUNCMODE_PSC; + } else if (dytc_capabilities & BIT(DYTC_FC_PSC)) { /* PSC MODE */ + pr_debug("PSC is supported\n"); } else { dbg_printk(TPACPI_DBG_INIT, "No DYTC support available\n"); return -ENODEV; @@ -10575,7 +10567,6 @@ static int tpacpi_dytc_profile_init(stru =20 static void dytc_profile_exit(void) { - dytc_profile_available =3D DYTC_FUNCMODE_NONE; platform_profile_remove(); } From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BFE9C43334 for ; Tue, 19 Jul 2022 13:05:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242927AbiGSNFk (ORCPT ); Tue, 19 Jul 2022 09:05:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243078AbiGSNEj (ORCPT ); Tue, 19 Jul 2022 09:04:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87BA09DEC9; Tue, 19 Jul 2022 05:26:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2F84BB81B84; Tue, 19 Jul 2022 12:26:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A969C341C6; Tue, 19 Jul 2022 12:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233589; bh=D6px515p4fHfGMRWHucS0aS5PelcoJ9T+x0su67Ml0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RP/EUcR4gID/Qz1kRVArBN//fG1XHTcSMh1Tfr6duaNeP8JTvJsA9RHCKmQhXbU4k uHVoOXxa8zHyhLs3sfisONzOPjBwQc1qmUUee/rUUqGle5Y2z0FAXAMl/b0u6V1tlr UE9NCyotM798o3iM07KfLczo0fCBcYb+OCanBpzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Pearson , Hans de Goede , Sasha Levin Subject: [PATCH 5.18 173/231] platform/x86: thinkpad_acpi: do not use PSC mode on Intel platforms Date: Tue, 19 Jul 2022 13:54:18 +0200 Message-Id: <20220719114728.711222569@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Pearson [ Upstream commit bce6243f767f7da88aa4674d5d678f9f156eaba9 ] PSC platform profile mode is only supported on Linux for AMD platforms. Some older Intel platforms (e.g T490) are advertising it's capability as Windows uses it - but on Linux we should only be using MMC profile for Intel systems. Add a check to prevent it being enabled incorrectly. Signed-off-by: Mark Pearson Link: https://lore.kernel.org/r/20220627181449.3537-1-markpearson@lenovo.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/platform/x86/thinkpad_acpi.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10541,6 +10541,11 @@ static int tpacpi_dytc_profile_init(stru dytc_mmc_get_available =3D true; } } else if (dytc_capabilities & BIT(DYTC_FC_PSC)) { /* PSC MODE */ + /* Support for this only works on AMD platforms */ + if (boot_cpu_data.x86_vendor !=3D X86_VENDOR_AMD) { + dbg_printk(TPACPI_DBG_INIT, "PSC not support on Intel platforms\n"); + return -ENODEV; + } pr_debug("PSC is supported\n"); } else { dbg_printk(TPACPI_DBG_INIT, "No DYTC support available\n"); From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61202C43334 for ; Tue, 19 Jul 2022 13:05:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242939AbiGSNFo (ORCPT ); Tue, 19 Jul 2022 09:05:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243100AbiGSNEl (ORCPT ); Tue, 19 Jul 2022 09:04:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6657B9DED5; Tue, 19 Jul 2022 05:26:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0C365B81B21; Tue, 19 Jul 2022 12:26:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CA0AC341C6; Tue, 19 Jul 2022 12:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233592; bh=SXBs8PJTooKJkdHbWMfHeTXXHYAQPjBwFTdpDhHDu64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=11XFVIowsMle7tLO1BVYnPlEs2bwE9X7NpSA0dhng3esQBx/XR76v4a+uNLtIxubk MNdt3fTwz+v9SwETA4XfbRhkF7WRPVygIA6PJ0Gat+ebAR8GWrH6qqc+oBfCgCisKE nYhZnpO6lGFiwv821Ol9aCs5lYQl/604bb9NtaF0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jorge Lopez , Kai-Heng Feng , Hans de Goede , Sasha Levin Subject: [PATCH 5.18 174/231] platform/x86: hp-wmi: Ignore Sanitization Mode event Date: Tue, 19 Jul 2022 13:54:19 +0200 Message-Id: <20220719114728.793280561@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kai-Heng Feng [ Upstream commit 9ab762a84b8094540c18a170e5ddd6488632c456 ] After system resume the hp-wmi driver may complain: [ 702.620180] hp_wmi: Unknown event_id - 23 - 0x0 According to HP it means 'Sanitization Mode' and it's harmless to just ignore the event. Cc: Jorge Lopez Signed-off-by: Kai-Heng Feng Link: https://lore.kernel.org/r/20220628123726.250062-1-kai.heng.feng@canon= ical.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/platform/x86/hp-wmi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 0e6ed75c70f3..c63ec1471b84 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c @@ -89,6 +89,7 @@ enum hp_wmi_event_ids { HPWMI_BACKLIT_KB_BRIGHTNESS =3D 0x0D, HPWMI_PEAKSHIFT_PERIOD =3D 0x0F, HPWMI_BATTERY_CHARGE_PERIOD =3D 0x10, + HPWMI_SANITIZATION_MODE =3D 0x17, }; =20 /* @@ -846,6 +847,8 @@ static void hp_wmi_notify(u32 value, void *context) break; case HPWMI_BATTERY_CHARGE_PERIOD: break; + case HPWMI_SANITIZATION_MODE: + break; default: pr_info("Unknown event_id - %d - 0x%x\n", event_id, event_data); break; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57150CCA481 for ; Tue, 19 Jul 2022 13:07:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243061AbiGSNHC (ORCPT ); Tue, 19 Jul 2022 09:07:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242987AbiGSNGi (ORCPT ); Tue, 19 Jul 2022 09:06:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08DF99FE34; Tue, 19 Jul 2022 05:27:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E58D4B81B8A; Tue, 19 Jul 2022 12:26:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 516B9C341C6; Tue, 19 Jul 2022 12:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233598; bh=OrhNMh7u0BUFRUmsuOS9cc2oRviFxpbijjzVLAeCK6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hudXPT6WYC8LKKN8QUERkrR5aYqra9T7p4A6zIu64shjCt6aRqHpOBhl96jpxZ+R2 Mi/YDef9s8oTIYl9yO9tteppRpnwnK7l/U0FpP9O9naVzkta1Va0MwCObsQ/mYiHnn 7nnATqICVPQvC2Y/+R9wxdPs4D2a20yz+OL2LafA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Javier Martinez Canillas , Daniel Vetter , Thomas Zimmermann , Sasha Levin Subject: [PATCH 5.18 175/231] firmware: sysfb: Make sysfb_create_simplefb() return a pdev pointer Date: Tue, 19 Jul 2022 13:54:20 +0200 Message-Id: <20220719114728.880971728@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Javier Martinez Canillas [ Upstream commit 9e121040e54abef9ed5542e5fdfa87911cd96204 ] This function just returned 0 on success or an errno code on error, but it could be useful for sysfb_init() callers to have a pointer to the device. Signed-off-by: Javier Martinez Canillas Reviewed-by: Daniel Vetter Reviewed-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20220607182338.344270-2= -javierm@redhat.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/firmware/sysfb.c | 4 ++-- drivers/firmware/sysfb_simplefb.c | 16 ++++++++-------- include/linux/sysfb.h | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c index 2bfbb05f7d89..b032f40a92de 100644 --- a/drivers/firmware/sysfb.c +++ b/drivers/firmware/sysfb.c @@ -46,8 +46,8 @@ static __init int sysfb_init(void) /* try to create a simple-framebuffer device */ compatible =3D sysfb_parse_mode(si, &mode); if (compatible) { - ret =3D sysfb_create_simplefb(si, &mode); - if (!ret) + pd =3D sysfb_create_simplefb(si, &mode); + if (!IS_ERR(pd)) return 0; } =20 diff --git a/drivers/firmware/sysfb_simplefb.c b/drivers/firmware/sysfb_sim= plefb.c index bda8712bfd8c..a353e27f83f5 100644 --- a/drivers/firmware/sysfb_simplefb.c +++ b/drivers/firmware/sysfb_simplefb.c @@ -57,8 +57,8 @@ __init bool sysfb_parse_mode(const struct screen_info *si, return false; } =20 -__init int sysfb_create_simplefb(const struct screen_info *si, - const struct simplefb_platform_data *mode) +__init struct platform_device *sysfb_create_simplefb(const struct screen_i= nfo *si, + const struct simplefb_platform_data *mode) { struct platform_device *pd; struct resource res; @@ -76,7 +76,7 @@ __init int sysfb_create_simplefb(const struct screen_info= *si, base |=3D (u64)si->ext_lfb_base << 32; if (!base || (u64)(resource_size_t)base !=3D base) { printk(KERN_DEBUG "sysfb: inaccessible VRAM base\n"); - return -EINVAL; + return ERR_PTR(-EINVAL); } =20 /* @@ -93,7 +93,7 @@ __init int sysfb_create_simplefb(const struct screen_info= *si, length =3D mode->height * mode->stride; if (length > size) { printk(KERN_WARNING "sysfb: VRAM smaller than advertised\n"); - return -EINVAL; + return ERR_PTR(-EINVAL); } length =3D PAGE_ALIGN(length); =20 @@ -104,11 +104,11 @@ __init int sysfb_create_simplefb(const struct screen_= info *si, res.start =3D base; res.end =3D res.start + length - 1; if (res.end <=3D res.start) - return -EINVAL; + return ERR_PTR(-EINVAL); =20 pd =3D platform_device_alloc("simple-framebuffer", 0); if (!pd) - return -ENOMEM; + return ERR_PTR(-ENOMEM); =20 sysfb_apply_efi_quirks(pd); =20 @@ -124,10 +124,10 @@ __init int sysfb_create_simplefb(const struct screen_= info *si, if (ret) goto err_put_device; =20 - return 0; + return pd; =20 err_put_device: platform_device_put(pd); =20 - return ret; + return ERR_PTR(ret); } diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h index b0dcfa26d07b..708152e9037b 100644 --- a/include/linux/sysfb.h +++ b/include/linux/sysfb.h @@ -72,8 +72,8 @@ static inline void sysfb_apply_efi_quirks(struct platform= _device *pd) =20 bool sysfb_parse_mode(const struct screen_info *si, struct simplefb_platform_data *mode); -int sysfb_create_simplefb(const struct screen_info *si, - const struct simplefb_platform_data *mode); +struct platform_device *sysfb_create_simplefb(const struct screen_info *si, + const struct simplefb_platform_data *mode); =20 #else /* CONFIG_SYSFB_SIMPLE */ =20 @@ -83,10 +83,10 @@ static inline bool sysfb_parse_mode(const struct screen= _info *si, return false; } =20 -static inline int sysfb_create_simplefb(const struct screen_info *si, - const struct simplefb_platform_data *mode) +static inline struct platform_device *sysfb_create_simplefb(const struct s= creen_info *si, + const struct simplefb_platform_data *mode) { - return -EINVAL; + return ERR_PTR(-EINVAL); } =20 #endif /* CONFIG_SYSFB_SIMPLE */ --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C0C6C43334 for ; Tue, 19 Jul 2022 13:06:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243022AbiGSNGF (ORCPT ); Tue, 19 Jul 2022 09:06:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243184AbiGSNEt (ORCPT ); Tue, 19 Jul 2022 09:04:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4201E9E466; Tue, 19 Jul 2022 05:26:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B4530B81B21; Tue, 19 Jul 2022 12:26:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F64DC341CA; Tue, 19 Jul 2022 12:26:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233601; bh=SuF4v3Uz5uTNz8Vjlm3/PnuewX3rlJ5M1kikWnOZ87c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ez0ntYQlRQ1yCwuMgCz60BnaXmVXWbVs/sIUQu95swXx6r3VZd/xamKIsguAZDr7S 4VaY3mBHndg0RhCF/1UZAfvCZnbpnYXE8usgkHCl6Z4sqdbgHrnnTH5EIVfjl4F805 W86329KMOiQvkzWudVsc4EbUINC1THsqe7Wdn7jw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Javier Martinez Canillas , Sasha Levin Subject: [PATCH 5.18 176/231] firmware: sysfb: Add sysfb_disable() helper function Date: Tue, 19 Jul 2022 13:54:21 +0200 Message-Id: <20220719114728.976344526@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Javier Martinez Canillas [ Upstream commit bde376e9de3c0bc55eedc8956b0f114c05531595 ] This can be used by subsystems to unregister a platform device registered by sysfb and also to disable future platform device registration in sysfb. Suggested-by: Daniel Vetter Signed-off-by: Javier Martinez Canillas Reviewed-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220607182338.344270-3= -javierm@redhat.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- .../driver-api/firmware/other_interfaces.rst | 6 +++ drivers/firmware/sysfb.c | 54 ++++++++++++++++--- include/linux/sysfb.h | 12 +++++ 3 files changed, 66 insertions(+), 6 deletions(-) diff --git a/Documentation/driver-api/firmware/other_interfaces.rst b/Docum= entation/driver-api/firmware/other_interfaces.rst index b81794e0cfbb..06ac89adaafb 100644 --- a/Documentation/driver-api/firmware/other_interfaces.rst +++ b/Documentation/driver-api/firmware/other_interfaces.rst @@ -13,6 +13,12 @@ EDD Interfaces .. kernel-doc:: drivers/firmware/edd.c :internal: =20 +Generic System Framebuffers Interface +------------------------------------- + +.. kernel-doc:: drivers/firmware/sysfb.c + :export: + Intel Stratix10 SoC Service Layer --------------------------------- Some features of the Intel Stratix10 SoC require a level of privilege diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c index b032f40a92de..1f276f108cc9 100644 --- a/drivers/firmware/sysfb.c +++ b/drivers/firmware/sysfb.c @@ -34,21 +34,59 @@ #include #include =20 +static struct platform_device *pd; +static DEFINE_MUTEX(disable_lock); +static bool disabled; + +static bool sysfb_unregister(void) +{ + if (IS_ERR_OR_NULL(pd)) + return false; + + platform_device_unregister(pd); + pd =3D NULL; + + return true; +} + +/** + * sysfb_disable() - disable the Generic System Framebuffers support + * + * This disables the registration of system framebuffer devices that match= the + * generic drivers that make use of the system framebuffer set up by firmw= are. + * + * It also unregisters a device if this was already registered by sysfb_in= it(). + * + * Context: The function can sleep. A @disable_lock mutex is acquired to s= erialize + * against sysfb_init(), that registers a system framebuffer devi= ce. + */ +void sysfb_disable(void) +{ + mutex_lock(&disable_lock); + sysfb_unregister(); + disabled =3D true; + mutex_unlock(&disable_lock); +} +EXPORT_SYMBOL_GPL(sysfb_disable); + static __init int sysfb_init(void) { struct screen_info *si =3D &screen_info; struct simplefb_platform_data mode; - struct platform_device *pd; const char *name; bool compatible; - int ret; + int ret =3D 0; + + mutex_lock(&disable_lock); + if (disabled) + goto unlock_mutex; =20 /* try to create a simple-framebuffer device */ compatible =3D sysfb_parse_mode(si, &mode); if (compatible) { pd =3D sysfb_create_simplefb(si, &mode); if (!IS_ERR(pd)) - return 0; + goto unlock_mutex; } =20 /* if the FB is incompatible, create a legacy framebuffer device */ @@ -60,8 +98,10 @@ static __init int sysfb_init(void) name =3D "platform-framebuffer"; =20 pd =3D platform_device_alloc(name, 0); - if (!pd) - return -ENOMEM; + if (!pd) { + ret =3D -ENOMEM; + goto unlock_mutex; + } =20 sysfb_apply_efi_quirks(pd); =20 @@ -73,9 +113,11 @@ static __init int sysfb_init(void) if (ret) goto err; =20 - return 0; + goto unlock_mutex; err: platform_device_put(pd); +unlock_mutex: + mutex_unlock(&disable_lock); return ret; } =20 diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h index 708152e9037b..8ba8b5be5567 100644 --- a/include/linux/sysfb.h +++ b/include/linux/sysfb.h @@ -55,6 +55,18 @@ struct efifb_dmi_info { int flags; }; =20 +#ifdef CONFIG_SYSFB + +void sysfb_disable(void); + +#else /* CONFIG_SYSFB */ + +static inline void sysfb_disable(void) +{ +} + +#endif /* CONFIG_SYSFB */ + #ifdef CONFIG_EFI =20 extern struct efifb_dmi_info efifb_dmi_list[]; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C484C433EF for ; Tue, 19 Jul 2022 13:11:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243236AbiGSNLL (ORCPT ); Tue, 19 Jul 2022 09:11:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243681AbiGSNJ4 (ORCPT ); Tue, 19 Jul 2022 09:09:56 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 890C8BDA3D; Tue, 19 Jul 2022 05:28:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 21611CE1BEC; Tue, 19 Jul 2022 12:28:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5C73C341DE; Tue, 19 Jul 2022 12:28:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233716; bh=jw+ypiVsWe9hRlxeroVNTCj7pde/eDODxUktKaei0zA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FuULoT7BybgnffE+CcPqlN91G/cNMuCj1WkPAq2yypxQdHl1bR0jZ5Ndg6ED6nUM/ 3QEtvO/HguhUQxZiJaPlbNMDtCPN/dT5b7vnquxcJfJYgvlGGaUn06BgQIo7716GMK AY16/G4xQ6myRCzmU4810QEQ8354djW4qYr4PaIA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Javier Martinez Canillas , Sasha Levin Subject: [PATCH 5.18 177/231] fbdev: Disable sysfb device registration when removing conflicting FBs Date: Tue, 19 Jul 2022 13:54:22 +0200 Message-Id: <20220719114729.070959230@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Javier Martinez Canillas [ Upstream commit ee7a69aa38d87a3bbced7b8245c732c05ed0c6ec ] The platform devices registered by sysfb match with firmware-based DRM or fbdev drivers, that are used to have early graphics using a framebuffer provided by the system firmware. DRM or fbdev drivers later are probed and remove conflicting framebuffers, leading to these platform devices for generic drivers to be unregistered. But the current solution has a race, since the sysfb_init() function could be called after a DRM or fbdev driver is probed and request to unregister the devices for drivers with conflicting framebuffes. To prevent this, disable any future sysfb platform device registration by calling sysfb_disable(), if a driver requests to remove the conflicting framebuffers. Suggested-by: Daniel Vetter Signed-off-by: Javier Martinez Canillas Reviewed-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220607182338.344270-4= -javierm@redhat.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/video/fbdev/core/fbmem.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -1787,6 +1788,17 @@ int remove_conflicting_framebuffers(stru do_free =3D true; } =20 + /* + * If a driver asked to unregister a platform device registered by + * sysfb, then can be assumed that this is a driver for a display + * that is set up by the system firmware and has a generic driver. + * + * Drivers for devices that don't have a generic driver will never + * ask for this, so let's assume that a real driver for the display + * was already probed and prevent sysfb to register devices later. + */ + sysfb_disable(); + mutex_lock(®istration_lock); do_remove_conflicting_framebuffers(a, name, primary); mutex_unlock(®istration_lock); From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 228E6C433EF for ; Tue, 19 Jul 2022 13:06:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242957AbiGSNGv (ORCPT ); Tue, 19 Jul 2022 09:06:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243121AbiGSNGb (ORCPT ); Tue, 19 Jul 2022 09:06:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E8199FE02; Tue, 19 Jul 2022 05:27:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3C92061950; Tue, 19 Jul 2022 12:27:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2213CC385A2; Tue, 19 Jul 2022 12:27:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233624; bh=tHbmYTk29C+tyConO9otde+kD25xesrNCWFelZW3mIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l8LnZZohlFCUeRLgbnY2wSKwHgOX4YpK80E82C22xK558u0CaKHwNhLGeTNpyF8SV hBNeQbD7v7Z7Uel42POK/WRrS165F0y5w6NarjwnNgS0CmLL6tlE+qMo/g3e4IKeUh PBlC7dm3N2qDCBeTOP5ZA6KiwJTIP8vspB0qxscc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Tung Nguyen , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 178/231] net: tipc: fix possible refcount leak in tipc_sk_create() Date: Tue, 19 Jul 2022 13:54:23 +0200 Message-Id: <20220719114729.164097145@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hangyu Hua [ Upstream commit 00aff3590fc0a73bddd3b743863c14e76fd35c0c ] Free sk in case tipc_sk_insert() fails. Signed-off-by: Hangyu Hua Reviewed-by: Tung Nguyen Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/tipc/socket.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 17f8c523e33b..43509c7e90fc 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -502,6 +502,7 @@ static int tipc_sk_create(struct net *net, struct socke= t *sock, sock_init_data(sock, sk); tipc_set_sk_state(sk, TIPC_OPEN); if (tipc_sk_insert(tsk)) { + sk_free(sk); pr_warn("Socket create failed; port number exhausted\n"); return -EINVAL; } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB051C43334 for ; Tue, 19 Jul 2022 13:08:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242945AbiGSNIR (ORCPT ); Tue, 19 Jul 2022 09:08:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243138AbiGSNHn (ORCPT ); Tue, 19 Jul 2022 09:07:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2704DFA0; Tue, 19 Jul 2022 05:27:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9EE316020F; Tue, 19 Jul 2022 12:27:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DC93C341C6; Tue, 19 Jul 2022 12:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233656; bh=2RIulnpy12qPfd61qCeePjC6mrMyrKz5F9JHzlryf7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vyV/66snmrrRMqXOWXeksyywKZQBrReRayBhQaOIyxKZmeTtAtuo5Z0r8RNkU5kE9 1p95piaIJRocDKtQ28VD/2lgxhYV4lY8hGsw6HtnLT1Rie5fIRXfIO6vPcjdM8SFR/ bmXhsnpikEclOqD+du3+9SEdGpfhf/FRODYKC7mo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Krzysztof Kozlowski , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 179/231] NFC: nxp-nci: dont print header length mismatch on i2c error Date: Tue, 19 Jul 2022 13:54:24 +0200 Message-Id: <20220719114729.260805577@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Walle [ Upstream commit 9577fc5fdc8b07b891709af6453545db405e24ad ] Don't print a misleading header length mismatch error if the i2c call returns an error. Instead just return the error code without any error message. Signed-off-by: Michael Walle Reviewed-by: Krzysztof Kozlowski Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/nfc/nxp-nci/i2c.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/nfc/nxp-nci/i2c.c +++ b/drivers/nfc/nxp-nci/i2c.c @@ -122,7 +122,9 @@ static int nxp_nci_i2c_fw_read(struct nx skb_put_data(*skb, &header, NXP_NCI_FW_HDR_LEN); =20 r =3D i2c_master_recv(client, skb_put(*skb, frame_len), frame_len); - if (r !=3D frame_len) { + if (r < 0) { + goto fw_read_exit_free_skb; + } else if (r !=3D frame_len) { nfc_err(&client->dev, "Invalid frame length: %u (expected %zu)\n", r, frame_len); @@ -166,7 +168,9 @@ static int nxp_nci_i2c_nci_read(struct n return 0; =20 r =3D i2c_master_recv(client, skb_put(*skb, header.plen), header.plen); - if (r !=3D header.plen) { + if (r < 0) { + goto nci_read_exit_free_skb; + } else if (r !=3D header.plen) { nfc_err(&client->dev, "Invalid frame payload length: %u (expected %u)\n", r, header.plen); From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CF07C43334 for ; Tue, 19 Jul 2022 13:10:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243209AbiGSNJH (ORCPT ); Tue, 19 Jul 2022 09:09:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242968AbiGSNIn (ORCPT ); Tue, 19 Jul 2022 09:08:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 836B551413; Tue, 19 Jul 2022 05:28:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1DC5A6090A; Tue, 19 Jul 2022 12:28:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4C50C341C6; Tue, 19 Jul 2022 12:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233688; bh=0tB/LX5tbGmxD7/pJ3RV12uRuMbISjx0rX5KmfklPqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QloKiFyNfkVujndCLsG2/grMR/ObaBb9WYVNVBLiV+HSu2WoFKjb/Z5CcTLQRgULs T4qeodEuvRvr7WltlywqVu9v/dl6bNnVu9j/ckhw4OqVC18VawqbVLQ8LWi4rekHOl 13ZZuh+JnHHDuJGdnWGAsUoo1Bp6qzt0yzuuclfg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wagner , Sagi Grimberg , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.18 180/231] nvme-tcp: always fail a request when sending it failed Date: Tue, 19 Jul 2022 13:54:25 +0200 Message-Id: <20220719114729.353520239@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sagi Grimberg [ Upstream commit 41d07df7de841bfbc32725ce21d933ad358f2844 ] queue stoppage and inflight requests cancellation is fully fenced from io_work and thus failing a request from this context. Hence we don't need to try to guess from the socket retcode if this failure is because the queue is about to be torn down or not. We are perfectly safe to just fail it, the request will not be cancelled later on. This solves possible very long shutdown delays when the users issues a 'nvme disconnect-all' Reported-by: Daniel Wagner Signed-off-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/nvme/host/tcp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index ad3a2bf2f1e9..e44d0570e694 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -1180,8 +1180,7 @@ static int nvme_tcp_try_send(struct nvme_tcp_queue *q= ueue) } else if (ret < 0) { dev_err(queue->ctrl->ctrl.device, "failed to send request %d\n", ret); - if (ret !=3D -EPIPE && ret !=3D -ECONNRESET) - nvme_tcp_fail_request(queue->request); + nvme_tcp_fail_request(queue->request); nvme_tcp_done_send_req(queue); } return ret; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B83D8C433EF for ; Tue, 19 Jul 2022 13:11:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236793AbiGSNK7 (ORCPT ); Tue, 19 Jul 2022 09:10:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243464AbiGSNJ3 (ORCPT ); Tue, 19 Jul 2022 09:09:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B758D64E2C; Tue, 19 Jul 2022 05:28:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E5ED360908; Tue, 19 Jul 2022 12:28:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C485DC341CA; Tue, 19 Jul 2022 12:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233697; bh=evHbPrbLErwFnenjaPOjmPLeCXe9hedm/8y5RIUGgxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0K7D+CEo/MJqo6YyynWw+omvcGNIKdC1hA8My/rgAeUm7F+V+gUw5btSwLH/plsB3 4lKucXOEp+Awwo0yCYorQLoq/vmD+8wXizvZwAI/++FVO7gmcIXj/wCvnb8gH3uvQ1 yGqYSTzQeQ0ivVy90j7jkJWPlcY48JZNZSTqgudI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ruozhu Li , Sagi Grimberg , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.18 181/231] nvme: fix regression when disconnect a recovering ctrl Date: Tue, 19 Jul 2022 13:54:26 +0200 Message-Id: <20220719114729.438020723@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ruozhu Li [ Upstream commit f7f70f4aa09dc43d7455c060143e86a017c30548 ] We encountered a problem that the disconnect command hangs. After analyzing the log and stack, we found that the triggering process is as follows: CPU0 CPU1 nvme_rdma_error_recovery_work nvme_rdma_teardown_io_queues nvme_do_delete_ctrl nvme_stop_queues nvme_remove_namespaces --clear ctrl->namespaces nvme_start_queues --no ns in ctrl->namespaces nvme_ns_remove return(because ctrl is deleting) blk_freeze_queue blk_mq_freeze_queue_wait --wait for ns to unquiesce to clean infligt IO, hang forever This problem was not found in older kernels because we will flush err work in nvme_stop_ctrl before nvme_remove_namespaces.It does not seem to be modified for functional reasons, the patch can be revert to solve the problem. Revert commit 794a4cb3d2f7 ("nvme: remove the .stop_ctrl callout") Signed-off-by: Ruozhu Li Reviewed-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/nvme/host/core.c | 2 ++ drivers/nvme/host/nvme.h | 1 + drivers/nvme/host/rdma.c | 12 +++++++++--- drivers/nvme/host/tcp.c | 10 +++++++--- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 0fef31c935de..c9831daafbc6 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -4519,6 +4519,8 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl) nvme_stop_failfast_work(ctrl); flush_work(&ctrl->async_event_work); cancel_work_sync(&ctrl->fw_act_work); + if (ctrl->ops->stop_ctrl) + ctrl->ops->stop_ctrl(ctrl); } EXPORT_SYMBOL_GPL(nvme_stop_ctrl); =20 diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index a2b53ca63335..337ae1e3ad25 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -501,6 +501,7 @@ struct nvme_ctrl_ops { void (*free_ctrl)(struct nvme_ctrl *ctrl); void (*submit_async_event)(struct nvme_ctrl *ctrl); void (*delete_ctrl)(struct nvme_ctrl *ctrl); + void (*stop_ctrl)(struct nvme_ctrl *ctrl); int (*get_address)(struct nvme_ctrl *ctrl, char *buf, int size); }; =20 diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index d9f19d901313..5aef2b81dbec 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -1048,6 +1048,14 @@ static void nvme_rdma_teardown_io_queues(struct nvme= _rdma_ctrl *ctrl, } } =20 +static void nvme_rdma_stop_ctrl(struct nvme_ctrl *nctrl) +{ + struct nvme_rdma_ctrl *ctrl =3D to_rdma_ctrl(nctrl); + + cancel_work_sync(&ctrl->err_work); + cancel_delayed_work_sync(&ctrl->reconnect_work); +} + static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl) { struct nvme_rdma_ctrl *ctrl =3D to_rdma_ctrl(nctrl); @@ -2255,9 +2263,6 @@ static const struct blk_mq_ops nvme_rdma_admin_mq_ops= =3D { =20 static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shut= down) { - cancel_work_sync(&ctrl->err_work); - cancel_delayed_work_sync(&ctrl->reconnect_work); - nvme_rdma_teardown_io_queues(ctrl, shutdown); nvme_stop_admin_queue(&ctrl->ctrl); if (shutdown) @@ -2307,6 +2312,7 @@ static const struct nvme_ctrl_ops nvme_rdma_ctrl_ops = =3D { .submit_async_event =3D nvme_rdma_submit_async_event, .delete_ctrl =3D nvme_rdma_delete_ctrl, .get_address =3D nvmf_get_address, + .stop_ctrl =3D nvme_rdma_stop_ctrl, }; =20 /* diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index e44d0570e694..1fb4f9b1621e 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -2193,9 +2193,6 @@ static void nvme_tcp_error_recovery_work(struct work_= struct *work) =20 static void nvme_tcp_teardown_ctrl(struct nvme_ctrl *ctrl, bool shutdown) { - cancel_work_sync(&to_tcp_ctrl(ctrl)->err_work); - cancel_delayed_work_sync(&to_tcp_ctrl(ctrl)->connect_work); - nvme_tcp_teardown_io_queues(ctrl, shutdown); nvme_stop_admin_queue(ctrl); if (shutdown) @@ -2235,6 +2232,12 @@ static void nvme_reset_ctrl_work(struct work_struct = *work) nvme_tcp_reconnect_or_remove(ctrl); } =20 +static void nvme_tcp_stop_ctrl(struct nvme_ctrl *ctrl) +{ + cancel_work_sync(&to_tcp_ctrl(ctrl)->err_work); + cancel_delayed_work_sync(&to_tcp_ctrl(ctrl)->connect_work); +} + static void nvme_tcp_free_ctrl(struct nvme_ctrl *nctrl) { struct nvme_tcp_ctrl *ctrl =3D to_tcp_ctrl(nctrl); @@ -2559,6 +2562,7 @@ static const struct nvme_ctrl_ops nvme_tcp_ctrl_ops = =3D { .submit_async_event =3D nvme_tcp_submit_async_event, .delete_ctrl =3D nvme_tcp_delete_ctrl, .get_address =3D nvmf_get_address, + .stop_ctrl =3D nvme_tcp_stop_ctrl, }; =20 static bool --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A2F7C433EF for ; Tue, 19 Jul 2022 13:10:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243241AbiGSNKa (ORCPT ); Tue, 19 Jul 2022 09:10:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243264AbiGSNJM (ORCPT ); Tue, 19 Jul 2022 09:09:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6ACAD62A67; Tue, 19 Jul 2022 05:28:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F2E8960E08; Tue, 19 Jul 2022 12:28:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA51AC341CB; Tue, 19 Jul 2022 12:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233700; bh=5TmI5gMFDp/IwdORJQ6PYCQAsR0ZEQfsy0HobI+u69Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gMMaJTuoO3Ugyoy0Uahw9q1mwE+P97egtVL91euEIdSsqzr/j86Cl9dRUMxdsB3Zg yhDxevqpHWXQ39lGmYjr02QzdjPEPMEPrpZDa83f97qIZloJQpndCJqJervw61G+Uj jliG2/ldgLer8+vYK2OjVjyX9wQ1+VJwbC3g0cvI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , "Russell King (Oracle)" , Paolo Abeni , Sasha Levin Subject: [PATCH 5.18 182/231] net: sfp: fix memory leak in sfp_probe() Date: Tue, 19 Jul 2022 13:54:27 +0200 Message-Id: <20220719114729.522834109@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jianglei Nie [ Upstream commit 0a18d802d65cf662644fd1d369c86d84a5630652 ] sfp_probe() allocates a memory chunk from sfp with sfp_alloc(). When devm_add_action() fails, sfp is not freed, which leads to a memory leak. We should use devm_add_action_or_reset() instead of devm_add_action(). Signed-off-by: Jianglei Nie Reviewed-by: Russell King (Oracle) Link: https://lore.kernel.org/r/20220629075550.2152003-1-niejianglei2021@16= 3.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/phy/sfp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 9a5d5a10560f..e7b0e12cc75b 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -2516,7 +2516,7 @@ static int sfp_probe(struct platform_device *pdev) =20 platform_set_drvdata(pdev, sfp); =20 - err =3D devm_add_action(sfp->dev, sfp_cleanup, sfp); + err =3D devm_add_action_or_reset(sfp->dev, sfp_cleanup, sfp); if (err < 0) return err; =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89679C433EF for ; Tue, 19 Jul 2022 13:10:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243350AbiGSNKh (ORCPT ); Tue, 19 Jul 2022 09:10:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243304AbiGSNJP (ORCPT ); Tue, 19 Jul 2022 09:09:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D64151A19; Tue, 19 Jul 2022 05:28:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 99021B81B32; Tue, 19 Jul 2022 12:28:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C63E1C341DB; Tue, 19 Jul 2022 12:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233703; bh=+pwhI5DseAVUweaksDK2NMrC+e9Ib1UwCS+TtiDZy7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lHAyN0hd0ojMNsJ6yYvwuCYHe73SjDmFPUcpYCVE2umVX2wrECZYogA2N7kil3kvo hkEX8Pwpvkzy3TvAUvZeKoa7oLTtdcX9jOAJ/HgMXsqw/mFo4Yh0xZfZUPyhOn3CHW yilGiNuC/KZS+Ekns+PECHYHlbL+Wujobfbb32mQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Sasha Levin Subject: [PATCH 5.18 183/231] ASoC: ops: Fix off by one in range control validation Date: Tue, 19 Jul 2022 13:54:28 +0200 Message-Id: <20220719114729.617862702@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Brown [ Upstream commit 5871321fb4558c55bf9567052b618ff0be6b975e ] We currently report that range controls accept a range of 0..(max-min) but accept writes in the range 0..(max-min+1). Remove that extra +1. Signed-off-by: Mark Brown Link: https://lore.kernel.org/r/20220604105246.4055214-1-broonie@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/soc-ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index e693070f51fe..d867f449d82d 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -526,7 +526,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontr= ol, return -EINVAL; if (mc->platform_max && tmp > mc->platform_max) return -EINVAL; - if (tmp > mc->max - mc->min + 1) + if (tmp > mc->max - mc->min) return -EINVAL; =20 if (invert) @@ -547,7 +547,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontr= ol, return -EINVAL; if (mc->platform_max && tmp > mc->platform_max) return -EINVAL; - if (tmp > mc->max - mc->min + 1) + if (tmp > mc->max - mc->min) return -EINVAL; =20 if (invert) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA98AC43334 for ; Tue, 19 Jul 2022 13:10:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239666AbiGSNKr (ORCPT ); Tue, 19 Jul 2022 09:10:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243364AbiGSNJU (ORCPT ); Tue, 19 Jul 2022 09:09:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE84289654; Tue, 19 Jul 2022 05:28:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BF37FB81B08; Tue, 19 Jul 2022 12:28:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BDCFC385A2; Tue, 19 Jul 2022 12:28:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233706; bh=I/S6MXKj+pJExOorvIiThOlDOL37GW0RHtgnBej/vcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e5Qv8zGhFb3rWniKmnvtNLxBMobpYhenIgzFGxEvpJ9YPwAVcc1kaDJJ540vNjNMj vvt2YsYQBfFZZzJ9gWt0Jt+318u8rbQ5NkskxUpAcfZPtqy/CaD4GwmOzkeHhTTG3K qrkn8jdFZ6fq+0QihHybN9oyS3z8adjr3nG7QF0k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haowen Bai , Linus Walleij , Sasha Levin Subject: [PATCH 5.18 184/231] pinctrl: aspeed: Fix potential NULL dereference in aspeed_pinmux_set_mux() Date: Tue, 19 Jul 2022 13:54:29 +0200 Message-Id: <20220719114729.692357696@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Haowen Bai [ Upstream commit 84a85d3fef2e75b1fe9fc2af6f5267122555a1ed ] pdesc could be null but still dereference pdesc->name and it will lead to a null pointer access. So we move a null check before dereference. Signed-off-by: Haowen Bai Link: https://lore.kernel.org/r/1650508019-22554-1-git-send-email-baihaowen= @meizu.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/pinctrl/aspeed/pinctrl-aspeed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspe= ed/pinctrl-aspeed.c index c94e24aadf92..83d47ff1cea8 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c @@ -236,11 +236,11 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev= , unsigned int function, const struct aspeed_sig_expr **funcs; const struct aspeed_sig_expr ***prios; =20 - pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name); - if (!pdesc) return -EINVAL; =20 + pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name); + prios =3D pdesc->prios; =20 if (!prios) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F3B2C43334 for ; Tue, 19 Jul 2022 13:11:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239838AbiGSNLI (ORCPT ); Tue, 19 Jul 2022 09:11:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243605AbiGSNJr (ORCPT ); Tue, 19 Jul 2022 09:09:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BBAE89A58; Tue, 19 Jul 2022 05:28:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 57C0360DE9; Tue, 19 Jul 2022 12:28:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1B34C341DD; Tue, 19 Jul 2022 12:28:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233709; bh=9AtmS7MJo/F/gSRs5FTXzgQ+tcpV+q3+k2tQxaBfwyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v8to1/OCceGu5p01RAOSDD/mDFC97CCT3qzdU8jHRHKk9hrDa/FEtaDlg65xRP2qG EdurdJH7wb8GSH9HKWDghMmrB9nmSAo8QyCMk+Qj+bRo5F6tX25S0G/k/my13vvr5y fMfzZM2SErdcJP+hFOwaK35LVZARe4NsS1qsfqw8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Rander Wang , Bard Liao , Mark Brown , Sasha Levin Subject: [PATCH 5.18 185/231] ASoC: Realtek/Maxim SoundWire codecs: disable pm_runtime on remove Date: Tue, 19 Jul 2022 13:54:30 +0200 Message-Id: <20220719114729.766987117@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit ac63716da3070f8cb6baaba3a058a0c7f22aeb5b ] When binding/unbinding codec drivers, the following warnings are thrown: [ 107.266879] rt715-sdca sdw:3:025d:0714:01: Unbalanced pm_runtime_enable! [ 306.879700] rt711-sdca sdw:0:025d:0711:01: Unbalanced pm_runtime_enable! Add a remove callback for all Realtek/Maxim SoundWire codecs and remove this warning. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220606203752.144159-2-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/max98373-sdw.c | 12 +++++++++++- sound/soc/codecs/rt1308-sdw.c | 11 +++++++++++ sound/soc/codecs/rt1316-sdw.c | 11 +++++++++++ sound/soc/codecs/rt5682-sdw.c | 5 ++++- sound/soc/codecs/rt700-sdw.c | 6 +++++- sound/soc/codecs/rt711-sdca-sdw.c | 6 +++++- sound/soc/codecs/rt711-sdw.c | 6 +++++- sound/soc/codecs/rt715-sdca-sdw.c | 12 ++++++++++++ sound/soc/codecs/rt715-sdw.c | 12 ++++++++++++ 9 files changed, 76 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/max98373-sdw.c b/sound/soc/codecs/max98373-sd= w.c index f47e956d4f55..97b64477dde6 100644 --- a/sound/soc/codecs/max98373-sdw.c +++ b/sound/soc/codecs/max98373-sdw.c @@ -862,6 +862,16 @@ static int max98373_sdw_probe(struct sdw_slave *slave, return max98373_init(slave, regmap); } =20 +static int max98373_sdw_remove(struct sdw_slave *slave) +{ + struct max98373_priv *max98373 =3D dev_get_drvdata(&slave->dev); + + if (max98373->first_hw_init) + pm_runtime_disable(&slave->dev); + + return 0; +} + #if defined(CONFIG_OF) static const struct of_device_id max98373_of_match[] =3D { { .compatible =3D "maxim,max98373", }, @@ -893,7 +903,7 @@ static struct sdw_driver max98373_sdw_driver =3D { .pm =3D &max98373_pm, }, .probe =3D max98373_sdw_probe, - .remove =3D NULL, + .remove =3D max98373_sdw_remove, .ops =3D &max98373_slave_ops, .id_table =3D max98373_id, }; diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c index 1ef836a68a56..e42a63ee07f4 100644 --- a/sound/soc/codecs/rt1308-sdw.c +++ b/sound/soc/codecs/rt1308-sdw.c @@ -690,6 +690,16 @@ static int rt1308_sdw_probe(struct sdw_slave *slave, return 0; } =20 +static int rt1308_sdw_remove(struct sdw_slave *slave) +{ + struct rt1308_sdw_priv *rt1308 =3D dev_get_drvdata(&slave->dev); + + if (rt1308->first_hw_init) + pm_runtime_disable(&slave->dev); + + return 0; +} + static const struct sdw_device_id rt1308_id[] =3D { SDW_SLAVE_ENTRY_EXT(0x025d, 0x1308, 0x2, 0, 0), {}, @@ -749,6 +759,7 @@ static struct sdw_driver rt1308_sdw_driver =3D { .pm =3D &rt1308_pm, }, .probe =3D rt1308_sdw_probe, + .remove =3D rt1308_sdw_remove, .ops =3D &rt1308_slave_ops, .id_table =3D rt1308_id, }; diff --git a/sound/soc/codecs/rt1316-sdw.c b/sound/soc/codecs/rt1316-sdw.c index c66d7b20cb4d..1e04aa8ab166 100644 --- a/sound/soc/codecs/rt1316-sdw.c +++ b/sound/soc/codecs/rt1316-sdw.c @@ -675,6 +675,16 @@ static int rt1316_sdw_probe(struct sdw_slave *slave, return rt1316_sdw_init(&slave->dev, regmap, slave); } =20 +static int rt1316_sdw_remove(struct sdw_slave *slave) +{ + struct rt1316_sdw_priv *rt1316 =3D dev_get_drvdata(&slave->dev); + + if (rt1316->first_hw_init) + pm_runtime_disable(&slave->dev); + + return 0; +} + static const struct sdw_device_id rt1316_id[] =3D { SDW_SLAVE_ENTRY_EXT(0x025d, 0x1316, 0x3, 0x1, 0), {}, @@ -734,6 +744,7 @@ static struct sdw_driver rt1316_sdw_driver =3D { .pm =3D &rt1316_pm, }, .probe =3D rt1316_sdw_probe, + .remove =3D rt1316_sdw_remove, .ops =3D &rt1316_slave_ops, .id_table =3D rt1316_id, }; diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c index 248257a2e4e0..f04e18c32489 100644 --- a/sound/soc/codecs/rt5682-sdw.c +++ b/sound/soc/codecs/rt5682-sdw.c @@ -719,9 +719,12 @@ static int rt5682_sdw_remove(struct sdw_slave *slave) { struct rt5682_priv *rt5682 =3D dev_get_drvdata(&slave->dev); =20 - if (rt5682 && rt5682->hw_init) + if (rt5682->hw_init) cancel_delayed_work_sync(&rt5682->jack_detect_work); =20 + if (rt5682->first_hw_init) + pm_runtime_disable(&slave->dev); + return 0; } =20 diff --git a/sound/soc/codecs/rt700-sdw.c b/sound/soc/codecs/rt700-sdw.c index bda594899664..f7439e40ca8b 100644 --- a/sound/soc/codecs/rt700-sdw.c +++ b/sound/soc/codecs/rt700-sdw.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include "rt700.h" @@ -463,11 +464,14 @@ static int rt700_sdw_remove(struct sdw_slave *slave) { struct rt700_priv *rt700 =3D dev_get_drvdata(&slave->dev); =20 - if (rt700 && rt700->hw_init) { + if (rt700->hw_init) { cancel_delayed_work_sync(&rt700->jack_detect_work); cancel_delayed_work_sync(&rt700->jack_btn_check_work); } =20 + if (rt700->first_hw_init) + pm_runtime_disable(&slave->dev); + return 0; } =20 diff --git a/sound/soc/codecs/rt711-sdca-sdw.c b/sound/soc/codecs/rt711-sdc= a-sdw.c index aaf5af153d3f..c722a2b0041f 100644 --- a/sound/soc/codecs/rt711-sdca-sdw.c +++ b/sound/soc/codecs/rt711-sdca-sdw.c @@ -11,6 +11,7 @@ #include #include #include +#include =20 #include "rt711-sdca.h" #include "rt711-sdca-sdw.h" @@ -364,11 +365,14 @@ static int rt711_sdca_sdw_remove(struct sdw_slave *sl= ave) { struct rt711_sdca_priv *rt711 =3D dev_get_drvdata(&slave->dev); =20 - if (rt711 && rt711->hw_init) { + if (rt711->hw_init) { cancel_delayed_work_sync(&rt711->jack_detect_work); cancel_delayed_work_sync(&rt711->jack_btn_check_work); } =20 + if (rt711->first_hw_init) + pm_runtime_disable(&slave->dev); + return 0; } =20 diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c index bda2cc9439c9..f49c94baa37c 100644 --- a/sound/soc/codecs/rt711-sdw.c +++ b/sound/soc/codecs/rt711-sdw.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include "rt711.h" @@ -464,12 +465,15 @@ static int rt711_sdw_remove(struct sdw_slave *slave) { struct rt711_priv *rt711 =3D dev_get_drvdata(&slave->dev); =20 - if (rt711 && rt711->hw_init) { + if (rt711->hw_init) { cancel_delayed_work_sync(&rt711->jack_detect_work); cancel_delayed_work_sync(&rt711->jack_btn_check_work); cancel_work_sync(&rt711->calibration_work); } =20 + if (rt711->first_hw_init) + pm_runtime_disable(&slave->dev); + return 0; } =20 diff --git a/sound/soc/codecs/rt715-sdca-sdw.c b/sound/soc/codecs/rt715-sdc= a-sdw.c index a5c673f43d82..0f4354eafef2 100644 --- a/sound/soc/codecs/rt715-sdca-sdw.c +++ b/sound/soc/codecs/rt715-sdca-sdw.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include "rt715-sdca.h" @@ -195,6 +196,16 @@ static int rt715_sdca_sdw_probe(struct sdw_slave *slav= e, return rt715_sdca_init(&slave->dev, mbq_regmap, regmap, slave); } =20 +static int rt715_sdca_sdw_remove(struct sdw_slave *slave) +{ + struct rt715_sdca_priv *rt715 =3D dev_get_drvdata(&slave->dev); + + if (rt715->first_hw_init) + pm_runtime_disable(&slave->dev); + + return 0; +} + static const struct sdw_device_id rt715_sdca_id[] =3D { SDW_SLAVE_ENTRY_EXT(0x025d, 0x715, 0x3, 0x1, 0), SDW_SLAVE_ENTRY_EXT(0x025d, 0x714, 0x3, 0x1, 0), @@ -269,6 +280,7 @@ static struct sdw_driver rt715_sdw_driver =3D { .pm =3D &rt715_pm, }, .probe =3D rt715_sdca_sdw_probe, + .remove =3D rt715_sdca_sdw_remove, .ops =3D &rt715_sdca_slave_ops, .id_table =3D rt715_sdca_id, }; diff --git a/sound/soc/codecs/rt715-sdw.c b/sound/soc/codecs/rt715-sdw.c index a7b21b03c08b..b047bf87a100 100644 --- a/sound/soc/codecs/rt715-sdw.c +++ b/sound/soc/codecs/rt715-sdw.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -514,6 +515,16 @@ static int rt715_sdw_probe(struct sdw_slave *slave, return 0; } =20 +static int rt715_sdw_remove(struct sdw_slave *slave) +{ + struct rt715_priv *rt715 =3D dev_get_drvdata(&slave->dev); + + if (rt715->first_hw_init) + pm_runtime_disable(&slave->dev); + + return 0; +} + static const struct sdw_device_id rt715_id[] =3D { SDW_SLAVE_ENTRY_EXT(0x025d, 0x714, 0x2, 0, 0), SDW_SLAVE_ENTRY_EXT(0x025d, 0x715, 0x2, 0, 0), @@ -575,6 +586,7 @@ static struct sdw_driver rt715_sdw_driver =3D { .pm =3D &rt715_pm, }, .probe =3D rt715_sdw_probe, + .remove =3D rt715_sdw_remove, .ops =3D &rt715_slave_ops, .id_table =3D rt715_id, }; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD1FFC433EF for ; Tue, 19 Jul 2022 13:10:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243239AbiGSNKw (ORCPT ); Tue, 19 Jul 2022 09:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243403AbiGSNJX (ORCPT ); Tue, 19 Jul 2022 09:09:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 023E264E01; Tue, 19 Jul 2022 05:28:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BBDC660DF8; Tue, 19 Jul 2022 12:28:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5549EC341DD; Tue, 19 Jul 2022 12:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233712; bh=DX8GnNXoZmg5Xm54obL/bmHPMlMYP2TaYkBJHhzBO74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JQGtSENbSCteUHjwzcR7DvulCrjg2NtMLv1YIaHi433rouqNqn+KBJrG3evTZE2uT A+Jq7QoJqatuf27bZvyfsqzkUwYtHJYypzHhMgQR3PO2bNiEgzYtUNhhXyvHBs5JiJ Iwhz89BMVnXFf6TBidm6inMHLfvR5LUMvSNPcnis= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Rander Wang , Bard Liao , Mark Brown , Sasha Levin Subject: [PATCH 5.18 186/231] ASoC: rt711-sdca-sdw: fix calibrate mutex initialization Date: Tue, 19 Jul 2022 13:54:31 +0200 Message-Id: <20220719114729.840207773@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit ed0a7fb29c9fd4f53eeb37d1fe2354df7a038047 ] In codec driver bind/unbind test, the following warning is thrown: DEBUG_LOCKS_WARN_ON(lock->magic !=3D lock) ... [ 699.182495] rt711_sdca_jack_init+0x1b/0x1d0 [snd_soc_rt711_sdca] [ 699.182498] rt711_sdca_set_jack_detect+0x3b/0x90 [snd_soc_rt711_sdca] [ 699.182500] snd_soc_component_set_jack+0x24/0x50 [snd_soc_core] A quick check in the code shows that the 'calibrate_mutex' used by this driver are not initialized at probe time. Moving the initialization to the probe removes the issue. BugLink: https://github.com/thesofproject/linux/issues/3644 Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220606203752.144159-3-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/rt711-sdca-sdw.c | 3 +++ sound/soc/codecs/rt711-sdca.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) --- a/sound/soc/codecs/rt711-sdca-sdw.c +++ b/sound/soc/codecs/rt711-sdca-sdw.c @@ -373,6 +373,9 @@ static int rt711_sdca_sdw_remove(struct if (rt711->first_hw_init) pm_runtime_disable(&slave->dev); =20 + mutex_destroy(&rt711->calibrate_mutex); + mutex_destroy(&rt711->disable_irq_lock); + return 0; } =20 --- a/sound/soc/codecs/rt711-sdca.c +++ b/sound/soc/codecs/rt711-sdca.c @@ -1414,6 +1414,7 @@ int rt711_sdca_init(struct device *dev, rt711->regmap =3D regmap; rt711->mbq_regmap =3D mbq_regmap; =20 + mutex_init(&rt711->calibrate_mutex); mutex_init(&rt711->disable_irq_lock); =20 /* @@ -1552,7 +1553,6 @@ int rt711_sdca_io_init(struct device *de rt711_sdca_jack_detect_handler); INIT_DELAYED_WORK(&rt711->jack_btn_check_work, rt711_sdca_btn_check_handler); - mutex_init(&rt711->calibrate_mutex); } =20 /* calibration */ From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00F54C433EF for ; Tue, 19 Jul 2022 13:08:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243092AbiGSNII (ORCPT ); Tue, 19 Jul 2022 09:08:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243002AbiGSNHi (ORCPT ); Tue, 19 Jul 2022 09:07:38 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B17E1408D; Tue, 19 Jul 2022 05:27:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 1015FCE1BE1; Tue, 19 Jul 2022 12:27:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0799CC341C6; Tue, 19 Jul 2022 12:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233627; bh=RSnp9C2IndBNx40Bwal1Q5B/rLmbGmA+LVLBOoQj7bo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kJnCEEB/NtalAfwQq5kwbRcm9Ms5lEmTN/seQCr9rMfQjVkgX01rLVSCW4twv4JkD fi0BCUhGl+bFh+5RzECa08ID4SLrDavI8plDsGfWSjQCjXOXSAaN0+u2NEQGSFslq3 pv0ZQzyj+kdd8cLnN3bCWf4wawQft9eMt7XDlAH8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Rander Wang , Bard Liao , Mark Brown , Sasha Levin Subject: [PATCH 5.18 187/231] ASoC: Intel: sof_sdw: handle errors on card registration Date: Tue, 19 Jul 2022 13:54:32 +0200 Message-Id: <20220719114729.927181646@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit fe154c4ff376bc31041c6441958a08243df09c99 ] If the card registration fails, typically because of deferred probes, the device properties added for headset codecs are not removed, which leads to kernel oopses in driver bind/unbind tests. We already clean-up the device properties when the card is removed, this code can be moved as a helper and called upon card registration errors. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220606203752.144159-4-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/intel/boards/sof_sdw.c | 51 ++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_= sdw.c index 1f00679b4240..ad826ad82d51 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1398,6 +1398,33 @@ static struct snd_soc_card card_sof_sdw =3D { .late_probe =3D sof_sdw_card_late_probe, }; =20 +static void mc_dailink_exit_loop(struct snd_soc_card *card) +{ + struct snd_soc_dai_link *link; + int ret; + int i, j; + + for (i =3D 0; i < ARRAY_SIZE(codec_info_list); i++) { + if (!codec_info_list[i].exit) + continue; + /* + * We don't need to call .exit function if there is no matched + * dai link found. + */ + for_each_card_prelinks(card, j, link) { + if (!strcmp(link->codecs[0].dai_name, + codec_info_list[i].dai_name)) { + ret =3D codec_info_list[i].exit(card, link); + if (ret) + dev_warn(card->dev, + "codec exit failed %d\n", + ret); + break; + } + } + } +} + static int mc_probe(struct platform_device *pdev) { struct snd_soc_card *card =3D &card_sof_sdw; @@ -1462,6 +1489,7 @@ static int mc_probe(struct platform_device *pdev) ret =3D devm_snd_soc_register_card(&pdev->dev, card); if (ret) { dev_err(card->dev, "snd_soc_register_card failed %d\n", ret); + mc_dailink_exit_loop(card); return ret; } =20 @@ -1473,29 +1501,8 @@ static int mc_probe(struct platform_device *pdev) static int mc_remove(struct platform_device *pdev) { struct snd_soc_card *card =3D platform_get_drvdata(pdev); - struct snd_soc_dai_link *link; - int ret; - int i, j; =20 - for (i =3D 0; i < ARRAY_SIZE(codec_info_list); i++) { - if (!codec_info_list[i].exit) - continue; - /* - * We don't need to call .exit function if there is no matched - * dai link found. - */ - for_each_card_prelinks(card, j, link) { - if (!strcmp(link->codecs[0].dai_name, - codec_info_list[i].dai_name)) { - ret =3D codec_info_list[i].exit(card, link); - if (ret) - dev_warn(&pdev->dev, - "codec exit failed %d\n", - ret); - break; - } - } - } + mc_dailink_exit_loop(card); =20 return 0; } --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1600C433EF for ; Tue, 19 Jul 2022 13:08:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243042AbiGSNIC (ORCPT ); Tue, 19 Jul 2022 09:08:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242990AbiGSNHX (ORCPT ); Tue, 19 Jul 2022 09:07:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 902F9863C0; Tue, 19 Jul 2022 05:27:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8E540B81B38; Tue, 19 Jul 2022 12:27:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA9D6C341C6; Tue, 19 Jul 2022 12:27:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233630; bh=PGWSdhX/3zv4TJ/w6fn2AbCsBncBUGQHcN7CV7vZPls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SjwqbJUp7O8ix6+eRTPr3chouvuHf6e1WlDV1hm67616MQ1LJ4Q+HgWGDxW4xr5JJ /I4UHzkgDWQ0usqTLftR4wBGUW4b4OZOwzWj1Jx/gIwH1edcbncQuWn1Mm0BLfQe0Y q8+qMr2ORxXCKf3XgCZKxi7rQKyqZkuvSyXC4AbU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Rander Wang , Bard Liao , Mark Brown , Sasha Levin Subject: [PATCH 5.18 188/231] ASoC: rt711: fix calibrate mutex initialization Date: Tue, 19 Jul 2022 13:54:33 +0200 Message-Id: <20220719114730.015578035@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit 08bb5dc6ce02374169213cea772b1c297eaf32d5 ] Follow the same flow as rt711-sdca and initialize all mutexes at probe time. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220606203752.144159-5-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/rt711-sdw.c | 3 +++ sound/soc/codecs/rt711.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) --- a/sound/soc/codecs/rt711-sdw.c +++ b/sound/soc/codecs/rt711-sdw.c @@ -474,6 +474,9 @@ static int rt711_sdw_remove(struct sdw_s if (rt711->first_hw_init) pm_runtime_disable(&slave->dev); =20 + mutex_destroy(&rt711->calibrate_mutex); + mutex_destroy(&rt711->disable_irq_lock); + return 0; } =20 --- a/sound/soc/codecs/rt711.c +++ b/sound/soc/codecs/rt711.c @@ -1206,6 +1206,7 @@ int rt711_init(struct device *dev, struc rt711->sdw_regmap =3D sdw_regmap; rt711->regmap =3D regmap; =20 + mutex_init(&rt711->calibrate_mutex); mutex_init(&rt711->disable_irq_lock); =20 /* @@ -1320,7 +1321,6 @@ int rt711_io_init(struct device *dev, st rt711_jack_detect_handler); INIT_DELAYED_WORK(&rt711->jack_btn_check_work, rt711_btn_check_handler); - mutex_init(&rt711->calibrate_mutex); INIT_WORK(&rt711->calibration_work, rt711_calibration_work); schedule_work(&rt711->calibration_work); } From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4407EC433EF for ; Tue, 19 Jul 2022 13:07:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236360AbiGSNHN (ORCPT ); Tue, 19 Jul 2022 09:07:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243126AbiGSNGs (ORCPT ); Tue, 19 Jul 2022 09:06:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58DF1106C7F; Tue, 19 Jul 2022 05:27:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D139861961; Tue, 19 Jul 2022 12:27:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B033CC341C6; Tue, 19 Jul 2022 12:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233633; bh=rWWBt7+PCOVJsLerpEIQnrCp9fpC9AdK50wZj8RXc8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UlDGEaakP2TGLPYbazZ0sOBqxzyzky5d6ad9Qa2SaPMikntt3NFSuag8qGbumSkEP 1QOfXs2c0DLh4zeUGx3t6zVjP95OHG+JOiJ6oTnJIthYfRH0SsO2F/qaR6nm3w9WhW GXKagnBn32viTzSXd2EV5RpT085Wxvazu5uQpOwA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Rander Wang , Bard Liao , Mark Brown , Sasha Levin Subject: [PATCH 5.18 189/231] ASoC: rt7*-sdw: harden jack_detect_handler Date: Tue, 19 Jul 2022 13:54:34 +0200 Message-Id: <20220719114730.083544650@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit 0484271ab0ce50649329fa9dc23c50853c5b26a4 ] Realtek headset codec drivers typically check if the card is instantiated before proceeding with the jack detection. The rt700, rt711 and rt711-sdca are however missing a check on the card pointer, which can lead to NULL dereferences encountered in driver bind/unbind tests. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220606203752.144159-6-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/rt700.c | 2 +- sound/soc/codecs/rt711-sdca.c | 2 +- sound/soc/codecs/rt711.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/rt700.c b/sound/soc/codecs/rt700.c index 360d61a36c35..b16fbde02986 100644 --- a/sound/soc/codecs/rt700.c +++ b/sound/soc/codecs/rt700.c @@ -162,7 +162,7 @@ static void rt700_jack_detect_handler(struct work_struc= t *work) if (!rt700->hs_jack) return; =20 - if (!rt700->component->card->instantiated) + if (!rt700->component->card || !rt700->component->card->instantiated) return; =20 reg =3D RT700_VERB_GET_PIN_SENSE | RT700_HP_OUT; diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c index 8a0b74d3fa9e..83e4c4e4d1e2 100644 --- a/sound/soc/codecs/rt711-sdca.c +++ b/sound/soc/codecs/rt711-sdca.c @@ -294,7 +294,7 @@ static void rt711_sdca_jack_detect_handler(struct work_= struct *work) if (!rt711->hs_jack) return; =20 - if (!rt711->component->card->instantiated) + if (!rt711->component->card || !rt711->component->card->instantiated) return; =20 /* SDW_SCP_SDCA_INT_SDCA_0 is used for jack detection */ diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c index db70d8073c0b..18a0de77c477 100644 --- a/sound/soc/codecs/rt711.c +++ b/sound/soc/codecs/rt711.c @@ -242,7 +242,7 @@ static void rt711_jack_detect_handler(struct work_struc= t *work) if (!rt711->hs_jack) return; =20 - if (!rt711->component->card->instantiated) + if (!rt711->component->card || !rt711->component->card->instantiated) return; =20 if (pm_runtime_status_suspended(rt711->slave->dev.parent)) { --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBFAECCA47F for ; Tue, 19 Jul 2022 13:07:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242966AbiGSNH2 (ORCPT ); Tue, 19 Jul 2022 09:07:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242960AbiGSNHA (ORCPT ); Tue, 19 Jul 2022 09:07:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1155680F60; Tue, 19 Jul 2022 05:27:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 66699B81B36; Tue, 19 Jul 2022 12:27:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9890BC36AE3; Tue, 19 Jul 2022 12:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233636; bh=VA4K+y68qUHY/W7GPWrViPQWc1eAbJLdB8OnYT08+T8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fDBlH+PQ65WYiNqfZd6k0afjxvu1Zxrk/crsTp4RhAnY+/NjKeyDwH6qVx3BqoKy+ P5BrSDbLLcZoe+Gu71n4+oQbnQVErAFhExhOh6qziOW+fz2tyAyJK0L6v5T8nb7IIQ kpplJDrq0OYT4+fhE6Js1XnR7nZpsfbJ0Qcu7AFM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Rander Wang , Bard Liao , Mark Brown , Sasha Levin Subject: [PATCH 5.18 190/231] ASoC: codecs: rt700/rt711/rt711-sdca: initialize workqueues in probe Date: Tue, 19 Jul 2022 13:54:35 +0200 Message-Id: <20220719114730.152731875@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit ba98d7d8b60ba410aa03834f6aa48fd3b2e68478 ] The workqueues are initialized in the io_init functions, which isn't quite right. In some tests, this leads to warnings throw from __queue_delayed_work() WARN_ON_FUNCTION_MISMATCH(timer->function, delayed_work_timer_fn); Move all the initializations to the probe functions. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220606203752.144159-7-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/rt700.c | 12 +++++------- sound/soc/codecs/rt711-sdca.c | 10 +++------- sound/soc/codecs/rt711.c | 12 +++++------- 3 files changed, 13 insertions(+), 21 deletions(-) --- a/sound/soc/codecs/rt700.c +++ b/sound/soc/codecs/rt700.c @@ -1124,6 +1124,11 @@ int rt700_init(struct device *dev, struc =20 mutex_init(&rt700->disable_irq_lock); =20 + INIT_DELAYED_WORK(&rt700->jack_detect_work, + rt700_jack_detect_handler); + INIT_DELAYED_WORK(&rt700->jack_btn_check_work, + rt700_btn_check_handler); + /* * Mark hw_init to false * HW init will be performed when device reports present @@ -1218,13 +1223,6 @@ int rt700_io_init(struct device *dev, st /* Finish Initial Settings, set power to D3 */ regmap_write(rt700->regmap, RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D3); =20 - if (!rt700->first_hw_init) { - INIT_DELAYED_WORK(&rt700->jack_detect_work, - rt700_jack_detect_handler); - INIT_DELAYED_WORK(&rt700->jack_btn_check_work, - rt700_btn_check_handler); - } - /* * if set_jack callback occurred early than io_init, * we set up the jack detection function now --- a/sound/soc/codecs/rt711-sdca.c +++ b/sound/soc/codecs/rt711-sdca.c @@ -1417,6 +1417,9 @@ int rt711_sdca_init(struct device *dev, mutex_init(&rt711->calibrate_mutex); mutex_init(&rt711->disable_irq_lock); =20 + INIT_DELAYED_WORK(&rt711->jack_detect_work, rt711_sdca_jack_detect_handle= r); + INIT_DELAYED_WORK(&rt711->jack_btn_check_work, rt711_sdca_btn_check_handl= er); + /* * Mark hw_init to false * HW init will be performed when device reports present @@ -1548,13 +1551,6 @@ int rt711_sdca_io_init(struct device *de rt711_sdca_index_update_bits(rt711, RT711_VENDOR_HDA_CTL, RT711_PUSH_BTN_INT_CTL0, 0x20, 0x00); =20 - if (!rt711->first_hw_init) { - INIT_DELAYED_WORK(&rt711->jack_detect_work, - rt711_sdca_jack_detect_handler); - INIT_DELAYED_WORK(&rt711->jack_btn_check_work, - rt711_sdca_btn_check_handler); - } - /* calibration */ ret =3D rt711_sdca_calibration(rt711); if (ret < 0) --- a/sound/soc/codecs/rt711.c +++ b/sound/soc/codecs/rt711.c @@ -1209,6 +1209,10 @@ int rt711_init(struct device *dev, struc mutex_init(&rt711->calibrate_mutex); mutex_init(&rt711->disable_irq_lock); =20 + INIT_DELAYED_WORK(&rt711->jack_detect_work, rt711_jack_detect_handler); + INIT_DELAYED_WORK(&rt711->jack_btn_check_work, rt711_btn_check_handler); + INIT_WORK(&rt711->calibration_work, rt711_calibration_work); + /* * Mark hw_init to false * HW init will be performed when device reports present @@ -1316,14 +1320,8 @@ int rt711_io_init(struct device *dev, st =20 if (rt711->first_hw_init) rt711_calibration(rt711); - else { - INIT_DELAYED_WORK(&rt711->jack_detect_work, - rt711_jack_detect_handler); - INIT_DELAYED_WORK(&rt711->jack_btn_check_work, - rt711_btn_check_handler); - INIT_WORK(&rt711->calibration_work, rt711_calibration_work); + else schedule_work(&rt711->calibration_work); - } =20 /* * if set_jack callback occurred early than io_init, From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20590C43334 for ; Tue, 19 Jul 2022 13:07:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242638AbiGSNHY (ORCPT ); Tue, 19 Jul 2022 09:07:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242566AbiGSNG6 (ORCPT ); Tue, 19 Jul 2022 09:06:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B961B9A06; Tue, 19 Jul 2022 05:27:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E921360908; Tue, 19 Jul 2022 12:27:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4BC8C341C6; Tue, 19 Jul 2022 12:27:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233639; bh=c2vRCdCE/w30i27ikE5xtULEsIKmoQzS+QUEF+S9oEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O0DSQcWeN/5pDQ9Br0q7B83xsLgJQLCSMWXamcFJ1xitbhgy/Cma1Y0RHtuteurdR hvUqM7uBci9fo0Fcg7I2RJARKPL9HAsjAFeIiyffrPX6Et+vF0fcHQeQt8z27N96mc URASLrWhp+yjVe62cnnU/6uZV77S666TUNoPfUeQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Pierre-Louis Bossart , Bard Liao , Ranjani Sridharan , Mark Brown , Sasha Levin Subject: [PATCH 5.18 191/231] ASoC: SOF: Intel: hda-dsp: Expose hda_dsp_core_power_up() Date: Tue, 19 Jul 2022 13:54:36 +0200 Message-Id: <20220719114730.222766233@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Ujfalusi [ Upstream commit 08f8a93198e300dff9649bbae424cd805d313326 ] The hda_dsp_core_power_up() needs to be exposed so that it can be used in hda-loader.c to correct the boot flow. The first step must not unstall the core, it should only power up the core(s). Add sanity check for the core_mask while exposing it to be safe. Complements: 2a68ff846164 ("ASoC: SOF: Intel: hda: Revisit IMR boot sequenc= e") Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Bard Liao Reviewed-by: Ranjani Sridharan Link: https://lore.kernel.org/r/20220609085949.29062-2-peter.ujfalusi@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/sof/intel/hda-dsp.c | 10 +++++++++- sound/soc/sof/intel/hda.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c index 8ddde60c56b3..68a8074c956a 100644 --- a/sound/soc/sof/intel/hda-dsp.c +++ b/sound/soc/sof/intel/hda-dsp.c @@ -181,12 +181,20 @@ int hda_dsp_core_run(struct snd_sof_dev *sdev, unsign= ed int core_mask) * Power Management. */ =20 -static int hda_dsp_core_power_up(struct snd_sof_dev *sdev, unsigned int co= re_mask) +int hda_dsp_core_power_up(struct snd_sof_dev *sdev, unsigned int core_mask) { + struct sof_intel_hda_dev *hda =3D sdev->pdata->hw_pdata; + const struct sof_intel_dsp_desc *chip =3D hda->desc; unsigned int cpa; u32 adspcs; int ret; =20 + /* restrict core_mask to host managed cores mask */ + core_mask &=3D chip->host_managed_cores_mask; + /* return if core_mask is not valid */ + if (!core_mask) + return 0; + /* update bits */ snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPCS, HDA_DSP_ADSPCS_SPA_MASK(core_mask), diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 196494ba1245..db066d094afa 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -490,6 +490,7 @@ struct sof_intel_hda_stream { */ int hda_dsp_probe(struct snd_sof_dev *sdev); int hda_dsp_remove(struct snd_sof_dev *sdev); +int hda_dsp_core_power_up(struct snd_sof_dev *sdev, unsigned int core_mask= ); int hda_dsp_core_run(struct snd_sof_dev *sdev, unsigned int core_mask); int hda_dsp_enable_core(struct snd_sof_dev *sdev, unsigned int core_mask); int hda_dsp_core_reset_power_down(struct snd_sof_dev *sdev, --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C7FAC433EF for ; Tue, 19 Jul 2022 13:07:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242498AbiGSNHs (ORCPT ); Tue, 19 Jul 2022 09:07:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243037AbiGSNHM (ORCPT ); Tue, 19 Jul 2022 09:07:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE6A9B9A15; Tue, 19 Jul 2022 05:27:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B376E6020F; Tue, 19 Jul 2022 12:27:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94551C341CB; Tue, 19 Jul 2022 12:27:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233642; bh=Nu25KeaHG2mnQyV9qxyD+sSs3aEncDCtP3ul7XyJKUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U2MK59tKZPlru2QYjxAmc6XuA6V1aCf8JZpjUAAwLk+OwZibIoyfloTQOsG05R7xW p6WVIcVBraaBKLgBQsh+rdgVh+1FKfepEVejOt09zzRVGqTyMIza9vjfcm/rxHQeXB j7/7bRWbesoEPv2mqbJs6SY5RNdN/sQBvwY4wfM4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Pierre-Louis Bossart , Bard Liao , Ranjani Sridharan , Mark Brown , Sasha Levin Subject: [PATCH 5.18 192/231] ASoC: SOF: Intel: hda-loader: Make sure that the fw load sequence is followed Date: Tue, 19 Jul 2022 13:54:37 +0200 Message-Id: <20220719114730.293222807@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Ujfalusi [ Upstream commit c31691e0d126ec5d60d2b6b03f699c11b613b219 ] The hda_dsp_enable_core() is powering up _and_ unstall the core in one call while the first step of the firmware loading must not unstall the core. The core can be unstalled only after the set cpb_cfp and the configuration of the IPC register for the ROM_CONTROL message. Complements: 2a68ff846164 ("ASoC: SOF: Intel: hda: Revisit IMR boot sequenc= e") Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Bard Liao Reviewed-by: Ranjani Sridharan Link: https://lore.kernel.org/r/20220609085949.29062-3-peter.ujfalusi@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/sof/intel/hda-loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loa= der.c index 2ac5d9d0719b..9f624a84182b 100644 --- a/sound/soc/sof/intel/hda-loader.c +++ b/sound/soc/sof/intel/hda-loader.c @@ -112,7 +112,7 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int st= ream_tag) int ret; =20 /* step 1: power up corex */ - ret =3D hda_dsp_enable_core(sdev, chip->host_managed_cores_mask); + ret =3D hda_dsp_core_power_up(sdev, chip->host_managed_cores_mask); if (ret < 0) { if (hda->boot_iteration =3D=3D HDA_FW_BOOT_ATTEMPTS) dev_err(sdev->dev, "error: dsp core 0/1 power up failed\n"); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59D10C433EF for ; Tue, 19 Jul 2022 13:07:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243079AbiGSNHl (ORCPT ); Tue, 19 Jul 2022 09:07:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243066AbiGSNHL (ORCPT ); Tue, 19 Jul 2022 09:07:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09606A6; Tue, 19 Jul 2022 05:27:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AE9FB609E9; Tue, 19 Jul 2022 12:27:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62012C341CA; Tue, 19 Jul 2022 12:27:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233644; bh=14XCnMkq1arqiNi6FR7twGUnaj1vfw1y++YI1I9tfEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bhRAMNnuT7n1h+xf4tj5yXtZxqvYSl5G7VX968ExNVFWsriNRbfnm5+IswQneQ8bF LXDCxsoP48/NstV3oPUbpfxvjwa+Pi9XVW6EWXZ5oR4ChfsK0c7ZiS1np7PHUyo1xb Ma2Ioo8/8wImo7zhP413LvmHP9M17Q5Fgk4uBNS0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Pierre-Louis Bossart , Bard Liao , Ranjani Sridharan , Mark Brown , Sasha Levin Subject: [PATCH 5.18 193/231] ASoC: SOF: Intel: hda-loader: Clarify the cl_dsp_init() flow Date: Tue, 19 Jul 2022 13:54:38 +0200 Message-Id: <20220719114730.366889902@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Ujfalusi [ Upstream commit bbfef046c6613404c01aeb9e9928bebb78dd327a ] Update the comment for the cl_dsp_init() to clarify what is done by the function and use the chip->init_core_mask instead of BIT(0) when unstalling/running the init core. Complements: 2a68ff846164 ("ASoC: SOF: Intel: hda: Revisit IMR boot sequenc= e") Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Bard Liao Reviewed-by: Ranjani Sridharan Link: https://lore.kernel.org/r/20220609085949.29062-4-peter.ujfalusi@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/sof/intel/hda-loader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loa= der.c index 9f624a84182b..88d23924e1bf 100644 --- a/sound/soc/sof/intel/hda-loader.c +++ b/sound/soc/sof/intel/hda-loader.c @@ -97,9 +97,9 @@ static struct hdac_ext_stream *cl_stream_prepare(struct s= nd_sof_dev *sdev, unsig } =20 /* - * first boot sequence has some extra steps. core 0 waits for power - * status on core 1, so power up core 1 also momentarily, keep it in - * reset/stall and then turn it off + * first boot sequence has some extra steps. + * power on all host managed cores and only unstall/run the boot core to b= oot the + * DSP then turn off all non boot cores (if any) is powered on. */ static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag) { @@ -127,7 +127,7 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int st= ream_tag) ((stream_tag - 1) << 9))); =20 /* step 3: unset core 0 reset state & unstall/run core 0 */ - ret =3D hda_dsp_core_run(sdev, BIT(0)); + ret =3D hda_dsp_core_run(sdev, chip->init_core_mask); if (ret < 0) { if (hda->boot_iteration =3D=3D HDA_FW_BOOT_ATTEMPTS) dev_err(sdev->dev, --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F606C43334 for ; Tue, 19 Jul 2022 13:08:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242949AbiGSNIl (ORCPT ); Tue, 19 Jul 2022 09:08:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243090AbiGSNIM (ORCPT ); Tue, 19 Jul 2022 09:08:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49C83BB5DD; Tue, 19 Jul 2022 05:27:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 15E13B81B08; Tue, 19 Jul 2022 12:27:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71072C341C6; Tue, 19 Jul 2022 12:27:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233647; bh=iA9/mffzugg5arwehs0PfA8MRLkpYI57QgbLR0O4YSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SAE7vuHxdnsQxQxLRDN5rarr4pRSztLCgcVsWnsHcc0SLJo3e4YsFmaBH7cdJCWG3 i6KmqrVIrvwlHmz5v3aVAT18FTTPakGrV0tpgns7LdYpgp5Tz0l9MlyrNyIPpR68D3 8j26khow727DtM15KrqENIbAd/U80NzuVb2E5/Go= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yassine Oudjana , Mark Brown , Sasha Levin Subject: [PATCH 5.18 194/231] ASoC: wcd9335: Remove RX channel from old list before adding it to a new one Date: Tue, 19 Jul 2022 13:54:39 +0200 Message-Id: <20220719114730.438303506@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yassine Oudjana [ Upstream commit be6dd72edb216f20fc80e426ece9fe9b8aabf033 ] Currently in slim_rx_mux_put, an RX channel gets added to a new list even if it is already in one. This can mess up links and make either it, the new list head, or both, get linked to the wrong entries. This can cause an entry to link to itself which in turn ends up making list_for_each_entry in other functions loop infinitely. To avoid issues, always remove the RX channel from any list it's in before adding it to a new list. Signed-off-by: Yassine Oudjana Link: https://lore.kernel.org/r/20220606152226.149164-1-y.oudjana@protonmai= l.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/wcd9335.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index 1e60db4056ad..12be043ee9a3 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -1289,9 +1289,12 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc, =20 wcd->rx_port_value[port_id] =3D ucontrol->value.enumerated.item[0]; =20 + /* Remove channel from any list it's in before adding it to a new one */ + list_del_init(&wcd->rx_chs[port_id].list); + switch (wcd->rx_port_value[port_id]) { case 0: - list_del_init(&wcd->rx_chs[port_id].list); + /* Channel already removed from lists. Nothing to do here */ break; case 1: list_add_tail(&wcd->rx_chs[port_id].list, --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E36CC433EF for ; Tue, 19 Jul 2022 13:08:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243139AbiGSNIw (ORCPT ); Tue, 19 Jul 2022 09:08:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243160AbiGSNId (ORCPT ); Tue, 19 Jul 2022 09:08:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AF1ABB8D8; Tue, 19 Jul 2022 05:28:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 846F46090A; Tue, 19 Jul 2022 12:27:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F05DC341C6; Tue, 19 Jul 2022 12:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233650; bh=dt8pDqk8iKTyANiXWzkfAhvww3xMsxUF+gbazu59Dis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SYdPlMl3NM4aPqqM+nXWqZZzgnq1O9/ytPJzFt45I573QufAP0dVFZHOqLNufAkk9 z06gbpFzpLnA7bVTAoKIlhovlpvd5Sn5JCazKR3Zc6wwdfFNEqrbJZ5sTuTkk6ZA9p s9x8WYfXQcVgUXxl/Np22pKh9HJzZJ9rXms9iKww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Sasha Levin Subject: [PATCH 5.18 195/231] ASoC: wcd9335: Fix spurious event generation Date: Tue, 19 Jul 2022 13:54:40 +0200 Message-Id: <20220719114730.508351043@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Brown [ Upstream commit a7786cbae4b2732815da98efa39df96746b5bd0d ] The slimbus mux put operation unconditionally reports a change in value which means that spurious events are generated. Fix this by exiting early in that case. Signed-off-by: Mark Brown Link: https://lore.kernel.org/r/20220603124609.4024666-1-broonie@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/wcd9335.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index 12be043ee9a3..aa685980a97b 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -1287,6 +1287,9 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc, struct snd_soc_dapm_update *update =3D NULL; u32 port_id =3D w->shift; =20 + if (wcd->rx_port_value[port_id] =3D=3D ucontrol->value.enumerated.item[0]) + return 0; + wcd->rx_port_value[port_id] =3D ucontrol->value.enumerated.item[0]; =20 /* Remove channel from any list it's in before adding it to a new one */ --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A346C43334 for ; Tue, 19 Jul 2022 13:08:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243182AbiGSNIX (ORCPT ); Tue, 19 Jul 2022 09:08:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243126AbiGSNH5 (ORCPT ); Tue, 19 Jul 2022 09:07:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4F0C863CB; Tue, 19 Jul 2022 05:27:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CA8D7B81B29; Tue, 19 Jul 2022 12:27:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26398C341C6; Tue, 19 Jul 2022 12:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233653; bh=OuR2fE51Nw9KFMYwaWsMlNUb5eNbAno7VLPZUKUduTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FqTfZxofvrzCyy1Mv4xumjyyRTh+4APYr8QxtEiFWTwqJ9MP+Ml3l5LuDa4GTiMJ6 HKaWLT6Pi3VAR5iowlkF1fdq7ZoO/sENwYkzjrL85jF7V5978EYCx8fTUppDSGeUQI ATms5e1kp6dVRS+vixRMDxdC1/o9Ye4mKwMAdCow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , kernel test robot , Sasha Levin Subject: [PATCH 5.18 196/231] ASoC: wcd938x: Fix event generation for some controls Date: Tue, 19 Jul 2022 13:54:41 +0200 Message-Id: <20220719114730.577806095@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Brown [ Upstream commit 10e7ff0047921e32b919ecee7be706dd33c107f8 ] Currently wcd938x_*_put() unconditionally report that the value of the control changed, resulting in spurious events being generated. Return 0 in that case instead as we should. There is still an issue in the compander control which is a bit more complex. Signed-off-by: Mark Brown Reported-by: kernel test robot Link: https://lore.kernel.org/r/20220603122526.3914942-1-broonie@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/wcd938x.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index 898b2887fa63..088cfda767cc 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -2519,6 +2519,9 @@ static int wcd938x_tx_mode_put(struct snd_kcontrol *k= control, struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; int path =3D e->shift_l; =20 + if (wcd938x->tx_mode[path] =3D=3D ucontrol->value.enumerated.item[0]) + return 0; + wcd938x->tx_mode[path] =3D ucontrol->value.enumerated.item[0]; =20 return 1; @@ -2541,6 +2544,9 @@ static int wcd938x_rx_hph_mode_put(struct snd_kcontro= l *kcontrol, struct snd_soc_component *component =3D snd_soc_kcontrol_component(kcontr= ol); struct wcd938x_priv *wcd938x =3D snd_soc_component_get_drvdata(component); =20 + if (wcd938x->hph_mode =3D=3D ucontrol->value.enumerated.item[0]) + return 0; + wcd938x->hph_mode =3D ucontrol->value.enumerated.item[0]; =20 return 1; @@ -2632,6 +2638,9 @@ static int wcd938x_ldoh_put(struct snd_kcontrol *kcon= trol, struct snd_soc_component *component =3D snd_soc_kcontrol_component(kcontr= ol); struct wcd938x_priv *wcd938x =3D snd_soc_component_get_drvdata(component); =20 + if (wcd938x->ldoh =3D=3D ucontrol->value.integer.value[0]) + return 0; + wcd938x->ldoh =3D ucontrol->value.integer.value[0]; =20 return 1; @@ -2654,6 +2663,9 @@ static int wcd938x_bcs_put(struct snd_kcontrol *kcont= rol, struct snd_soc_component *component =3D snd_soc_kcontrol_component(kcontr= ol); struct wcd938x_priv *wcd938x =3D snd_soc_component_get_drvdata(component); =20 + if (wcd938x->bcs_dis =3D=3D ucontrol->value.integer.value[0]) + return 0; + wcd938x->bcs_dis =3D ucontrol->value.integer.value[0]; =20 return 1; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFC45C433EF for ; Tue, 19 Jul 2022 13:10:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236631AbiGSNKQ (ORCPT ); Tue, 19 Jul 2022 09:10:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243224AbiGSNIp (ORCPT ); Tue, 19 Jul 2022 09:08:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB536550DF; Tue, 19 Jul 2022 05:28:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D2AD6B81B84; Tue, 19 Jul 2022 12:27:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48858C341C6; Tue, 19 Jul 2022 12:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233659; bh=U3MgG21b5SazhZDFf0lLfuAYMuBp9MqEc7e1BPZoKXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kE1sG8GKhYrTqbMn6/qqxfRXTMRM2g/E7S/jNLf0vc607z7flew4EdxMPIF3ZfNsT ALNmyIe235SdqZyagNDq5+E7ynCdYjCiftURJz4S8fU+EEG4AAOa7ZKDmi7NO1LrK9 OT+lmPqT55HJpya0nLNHwHd44NtaDwyMzjCOhOEA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.18 197/231] ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem Date: Tue, 19 Jul 2022 13:54:42 +0200 Message-Id: <20220719114730.648078383@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 4e07479eab8a044cc9542414ccb4aeb8eb033bde ] The "wlf,spkvdd-ena" GPIO needed by the bytcr_wm5102 driver is made available through a gpio-lookup table. This gpio-lookup table is registered by drivers/mfd/arizona-spi.c, which may get probed after the bytcr_wm5102 driver. If the gpio-lookup table has not registered yet then the gpiod_get() will return -ENOENT. Treat -ENOENT as -EPROBE_DEFER to still keep things working in this case. Signed-off-by: Hans de Goede Acked-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220612155652.107310-1-hdegoede@redhat.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/intel/boards/bytcr_wm5102.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/boards/bytcr_wm5102.c b/sound/soc/intel/boards= /bytcr_wm5102.c index 8d8e96e3cd2d..f6d0cef1b28c 100644 --- a/sound/soc/intel/boards/bytcr_wm5102.c +++ b/sound/soc/intel/boards/bytcr_wm5102.c @@ -421,8 +421,17 @@ static int snd_byt_wm5102_mc_probe(struct platform_dev= ice *pdev) priv->spkvdd_en_gpio =3D gpiod_get(codec_dev, "wlf,spkvdd-ena", GPIOD_OUT= _LOW); put_device(codec_dev); =20 - if (IS_ERR(priv->spkvdd_en_gpio)) - return dev_err_probe(dev, PTR_ERR(priv->spkvdd_en_gpio), "getting spkvdd= -GPIO\n"); + if (IS_ERR(priv->spkvdd_en_gpio)) { + ret =3D PTR_ERR(priv->spkvdd_en_gpio); + /* + * The spkvdd gpio-lookup is registered by: drivers/mfd/arizona-spi.c, + * so -ENOENT means that arizona-spi hasn't probed yet. + */ + if (ret =3D=3D -ENOENT) + ret =3D -EPROBE_DEFER; + + return dev_err_probe(dev, ret, "getting spkvdd-GPIO\n"); + } =20 /* override platform name, if required */ byt_wm5102_card.dev =3D dev; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 148E9C43334 for ; Tue, 19 Jul 2022 13:10:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243204AbiGSNKW (ORCPT ); Tue, 19 Jul 2022 09:10:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243200AbiGSNI7 (ORCPT ); Tue, 19 Jul 2022 09:08:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E828BB8E4; Tue, 19 Jul 2022 05:28:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AEE2CB81B36; Tue, 19 Jul 2022 12:27:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2182EC341C6; Tue, 19 Jul 2022 12:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233662; bh=21nWqJIuJuPyc3MGE2rDN2XazBAGhO1m2aDnsDAArdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aW9tjYyqw1g+44ylGU122aVVJHm4TU1R0rl3bg6goB77FHwF58leo8b+0oiNAd9eN XLhIJrqcrWY1Giu1WDDIByJDpEtBp/ktVceSZ2ZGN8WA0UDFOBL6FrA419WkdGlMuw rpk3rp/YEGmIcCtsN8yhqzjwEbT6KBOLSt6Tz5eE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 198/231] ASoC: wm_adsp: Fix event for preloader Date: Tue, 19 Jul 2022 13:54:43 +0200 Message-Id: <20220719114730.718305101@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit 9896c029f0df628c6cb108253d09b1d61f1d4a88 ] The preloader controls on ADSP should return a value of 1 if the preloader value was changed, update to correct this. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220621102041.1713504-1-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/wm_adsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 9cfd4f18493f..d3ecff3bdef2 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -997,7 +997,7 @@ int wm_adsp2_preloader_put(struct snd_kcontrol *kcontro= l, snd_soc_dapm_sync(dapm); } =20 - return 0; + return 1; } EXPORT_SYMBOL_GPL(wm_adsp2_preloader_put); =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F7A2C433EF for ; Tue, 19 Jul 2022 13:08:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243169AbiGSNIf (ORCPT ); Tue, 19 Jul 2022 09:08:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243026AbiGSNII (ORCPT ); Tue, 19 Jul 2022 09:08:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B287021E19; Tue, 19 Jul 2022 05:27:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 234D8609FB; Tue, 19 Jul 2022 12:27:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 021BEC341C6; Tue, 19 Jul 2022 12:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233665; bh=URhcXxTWUNtIzStOAzJURnj/9iuxRya7GBYaj5eiSz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gUSgJkGTPuJGtAhRlF79frdMl37EObYn9U9TVh8lai4SG0VM3v8ewhnYzVCkmtX3+ mT7/35jtlOFo3jtfUb3aWcwhjzixYTOrSE7sGiNkHKweS/qqK64mphGz2qIvINFVMn gwoHUxkz6Dm3IVXRRS7KigJDVK0SSGd01oVc31/Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 199/231] ASoC: wm5110: Fix DRE control Date: Tue, 19 Jul 2022 13:54:44 +0200 Message-Id: <20220719114730.787286403@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit 0bc0ae9a5938d512fd5d44f11c9c04892dcf4961 ] The DRE controls on wm5110 should return a value of 1 if the DRE state is actually changed, update to fix this. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220621102041.1713504-2-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/wm5110.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index 4973ba1ed779..4ab7a672f8de 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -413,6 +413,7 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol, unsigned int rnew =3D (!!ucontrol->value.integer.value[1]) << mc->rshift; unsigned int lold, rold; unsigned int lena, rena; + bool change =3D false; int ret; =20 snd_soc_dapm_mutex_lock(dapm); @@ -440,8 +441,8 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol, goto err; } =20 - ret =3D regmap_update_bits(arizona->regmap, ARIZONA_DRE_ENABLE, - mask, lnew | rnew); + ret =3D regmap_update_bits_check(arizona->regmap, ARIZONA_DRE_ENABLE, + mask, lnew | rnew, &change); if (ret) { dev_err(arizona->dev, "Failed to set DRE: %d\n", ret); goto err; @@ -454,6 +455,9 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol, if (!rnew && rold) wm5110_clear_pga_volume(arizona, mc->rshift); =20 + if (change) + ret =3D 1; + err: snd_soc_dapm_mutex_unlock(dapm); =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 415BAC43334 for ; Tue, 19 Jul 2022 13:10:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243307AbiGSNKf (ORCPT ); Tue, 19 Jul 2022 09:10:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243284AbiGSNJO (ORCPT ); Tue, 19 Jul 2022 09:09:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C48EC62A73; Tue, 19 Jul 2022 05:28:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9A4F6B81B10; Tue, 19 Jul 2022 12:27:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E602BC341C6; Tue, 19 Jul 2022 12:27:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233668; bh=uwPXRMAA96VqSh+TZh2f80g4MkVZh92p9R/dw4aDIT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DvfVPqd3W/a3VGH+PbAZ5g/V39Y78nkf20+OSciZAzy1Ermn4wmvO2X5D1N9Yxe6g 1hoWC3/Fp8UPit5CJlO1VOUHNRQWLVDQKw9KSbtrEHojRe774hl0Yhl/BsFJYrGIi0 ovEbAW03kTb2/6wnGunAGTtL/GoC0yWNj4TTRbiY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 200/231] ASoC: cs35l41: Correct some control names Date: Tue, 19 Jul 2022 13:54:45 +0200 Message-Id: <20220719114730.857350006@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit c6a5f22f9b4fd5f21414be690ce34046d9712f05 ] Various boolean controls on cs35l41 are missing the required "Switch" in the name, add these. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220621102041.1713504-3-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/cs35l41.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c index 6b784a62df0c..20c76a53a508 100644 --- a/sound/soc/codecs/cs35l41.c +++ b/sound/soc/codecs/cs35l41.c @@ -392,7 +392,7 @@ static const struct snd_kcontrol_new cs35l41_aud_contro= ls[] =3D { SOC_SINGLE("HW Noise Gate Enable", CS35L41_NG_CFG, 8, 63, 0), SOC_SINGLE("HW Noise Gate Delay", CS35L41_NG_CFG, 4, 7, 0), SOC_SINGLE("HW Noise Gate Threshold", CS35L41_NG_CFG, 0, 7, 0), - SOC_SINGLE("Aux Noise Gate CH1 Enable", + SOC_SINGLE("Aux Noise Gate CH1 Switch", CS35L41_MIXER_NGATE_CH1_CFG, 16, 1, 0), SOC_SINGLE("Aux Noise Gate CH1 Entry Delay", CS35L41_MIXER_NGATE_CH1_CFG, 8, 15, 0), @@ -400,15 +400,15 @@ static const struct snd_kcontrol_new cs35l41_aud_cont= rols[] =3D { CS35L41_MIXER_NGATE_CH1_CFG, 0, 7, 0), SOC_SINGLE("Aux Noise Gate CH2 Entry Delay", CS35L41_MIXER_NGATE_CH2_CFG, 8, 15, 0), - SOC_SINGLE("Aux Noise Gate CH2 Enable", + SOC_SINGLE("Aux Noise Gate CH2 Switch", CS35L41_MIXER_NGATE_CH2_CFG, 16, 1, 0), SOC_SINGLE("Aux Noise Gate CH2 Threshold", CS35L41_MIXER_NGATE_CH2_CFG, 0, 7, 0), - SOC_SINGLE("SCLK Force", CS35L41_SP_FORMAT, CS35L41_SCLK_FRC_SHIFT, 1, 0), - SOC_SINGLE("LRCLK Force", CS35L41_SP_FORMAT, CS35L41_LRCLK_FRC_SHIFT, 1, = 0), - SOC_SINGLE("Invert Class D", CS35L41_AMP_DIG_VOL_CTRL, + SOC_SINGLE("SCLK Force Switch", CS35L41_SP_FORMAT, CS35L41_SCLK_FRC_SHIFT= , 1, 0), + SOC_SINGLE("LRCLK Force Switch", CS35L41_SP_FORMAT, CS35L41_LRCLK_FRC_SHI= FT, 1, 0), + SOC_SINGLE("Invert Class D Switch", CS35L41_AMP_DIG_VOL_CTRL, CS35L41_AMP_INV_PCM_SHIFT, 1, 0), - SOC_SINGLE("Amp Gain ZC", CS35L41_AMP_GAIN_CTRL, + SOC_SINGLE("Amp Gain ZC Switch", CS35L41_AMP_GAIN_CTRL, CS35L41_AMP_GAIN_ZC_SHIFT, 1, 0), WM_ADSP2_PRELOAD_SWITCH("DSP1", 1), WM_ADSP_FW_CONTROL("DSP1", 0), --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B00CC43334 for ; Tue, 19 Jul 2022 13:11:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238527AbiGSNLh (ORCPT ); Tue, 19 Jul 2022 09:11:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243277AbiGSNJN (ORCPT ); Tue, 19 Jul 2022 09:09:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E14488127; Tue, 19 Jul 2022 05:28:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6DA87B81B29; Tue, 19 Jul 2022 12:27:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9D15C341CA; Tue, 19 Jul 2022 12:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233671; bh=Ss5Bd5y921XiglrVJj7GF+bCma+YJpq9Toc4NGFfIDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qQmYPBenb5qvPL93UFryWGn/nMtLUCfb5OqQJy8NrI9tLpMdleunKGPrhPEVI7LeG pT+LcvqWzWsBYcvVMbdNOGSKFLKzn9ffUq3ndzorMZK1MV6xv+1xZOqhW99hHpUiQk BfiLUnSQNXgMUtspk1HGYz64ubcGkFg6FNXLWUj4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuming Fan , Mark Brown , Sasha Levin Subject: [PATCH 5.18 201/231] ASoC: rt711-sdca: fix kernel NULL pointer dereference when IO error Date: Tue, 19 Jul 2022 13:54:46 +0200 Message-Id: <20220719114730.926631192@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shuming Fan [ Upstream commit 1df793d479bef546569fc2e409ff8bb3f0fb8e99 ] The initial settings will be written before the codec probe function. But, the rt711->component doesn't be assigned yet. If IO error happened during initial settings operations, it will cause the = kernel panic. This patch changed component->dev to slave->dev to fix this issue. Signed-off-by: Shuming Fan Link: https://lore.kernel.org/r/20220621090719.30558-1-shumingf@realtek.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/rt711-sdca.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c index dfe3c9299ebd..5ad53bbc8528 100644 --- a/sound/soc/codecs/rt711-sdca.c +++ b/sound/soc/codecs/rt711-sdca.c @@ -34,7 +34,7 @@ static int rt711_sdca_index_write(struct rt711_sdca_priv = *rt711, =20 ret =3D regmap_write(regmap, addr, value); if (ret < 0) - dev_err(rt711->component->dev, + dev_err(&rt711->slave->dev, "Failed to set private value: %06x <=3D %04x ret=3D%d\n", addr, value, ret); =20 @@ -50,7 +50,7 @@ static int rt711_sdca_index_read(struct rt711_sdca_priv *= rt711, =20 ret =3D regmap_read(regmap, addr, value); if (ret < 0) - dev_err(rt711->component->dev, + dev_err(&rt711->slave->dev, "Failed to get private value: %06x =3D> %04x ret=3D%d\n", addr, *value, ret); =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 955ADC43334 for ; Tue, 19 Jul 2022 13:10:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243005AbiGSNKp (ORCPT ); Tue, 19 Jul 2022 09:10:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243346AbiGSNJR (ORCPT ); Tue, 19 Jul 2022 09:09:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B113BB8EB; Tue, 19 Jul 2022 05:28:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C561D60C8C; Tue, 19 Jul 2022 12:27:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A20BEC341C6; Tue, 19 Jul 2022 12:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233674; bh=vG5/S0jHNPkDTGbunE+u84kCtFkDf6SxU2TdPXyQjuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VaaBrmVPFeVzlTX0DP/yjZXPKGLkWkkwahGhxFYUHfNu8PsBJwGbaKJBqmYK6julC hw5UdHnaFxGbFmhTMzkNJpJgy/REWkpIDDqx1By7K62nG3ELfnTXEhUqa9C/LsMMUe DU5p48Sw2J2pBTnxcwzBNq8Ngp/xOewlcY8PuLGE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 202/231] ASoC: dapm: Initialise kcontrol data for mux/demux controls Date: Tue, 19 Jul 2022 13:54:47 +0200 Message-Id: <20220719114730.997536321@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit 11d7a12f7f50baa5af9090b131c9b03af59503e7 ] DAPM keeps a copy of the current value of mux/demux controls, however this value is only initialised in the case of autodisable controls. This leads to false notification events when first modifying a DAPM kcontrol that has a non-zero default. Autodisable controls are left as they are, since they already initialise the value, and there would be more work required to support autodisable muxes where the first option isn't disabled and/or that isn't the default. Technically this issue could affect mixer/switch elements as well, although not on any of the devices I am currently running. There is also a little more work to do to address the issue there due to that side supporting stereo controls, so that has not been tackled in this patch. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220623105120.1981154-1-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/soc-dapm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 869c76506b66..a8e842e02cdc 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -62,6 +62,8 @@ struct snd_soc_dapm_widget * snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, const struct snd_soc_dapm_widget *widget); =20 +static unsigned int soc_dapm_read(struct snd_soc_dapm_context *dapm, int r= eg); + /* dapm power sequences - make this per codec in the future */ static int dapm_up_seq[] =3D { [snd_soc_dapm_pre] =3D 1, @@ -442,6 +444,9 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm= _widget *widget, =20 snd_soc_dapm_add_path(widget->dapm, data->widget, widget, NULL, NULL); + } else if (e->reg !=3D SND_SOC_NOPM) { + data->value =3D soc_dapm_read(widget->dapm, e->reg) & + (e->mask << e->shift_l); } break; default: --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADC46CCA481 for ; Tue, 19 Jul 2022 13:08:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243074AbiGSNIs (ORCPT ); Tue, 19 Jul 2022 09:08:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243055AbiGSNIa (ORCPT ); Tue, 19 Jul 2022 09:08:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F29ABB8C7; Tue, 19 Jul 2022 05:27:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9251360693; Tue, 19 Jul 2022 12:27:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74AC4C341C6; Tue, 19 Jul 2022 12:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233676; bh=pOS5a7puDGZ/iWqaJdM1223AaUj8iUfebzf3eXEB9Z8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2k6Y92IPJBt/pJplCtMjv+iVf55V8YgEYd3A0epv6wMbp82zadCxe13/FDQlucdZC 2SjY6HyfvqABI6Sv+BEFsE41pGI0YwG/dCLLniePOAsUxGmzBy6Rxq/F3sJkPSMiRc j6cV4bPe1bmi9rv262FVIPzTisltDrnvl03PLVeI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 203/231] ASoC: cs35l41: Add ASP TX3/4 source to register patch Date: Tue, 19 Jul 2022 13:54:48 +0200 Message-Id: <20220719114731.066776089@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit 46b0d050c8c7df6dfb2c376aaa149bf2cfc5ca3e ] The mixer controls for ASP TX3/4 are set to values that are not included in their enumeration control. This will cause spurious event notifications when the controls are first changed, as the register value changes whilst the actual visible enumeration value does not. Use the register patch to set them to a known value, zero, which equates to zero fill, thereby avoiding the spurious notifications. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220623105120.1981154-2-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/cs35l41-lib.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/cs35l41-lib.c b/sound/soc/codecs/cs35l41-lib.c index 17cf782f39af..538b5c4d3abf 100644 --- a/sound/soc/codecs/cs35l41-lib.c +++ b/sound/soc/codecs/cs35l41-lib.c @@ -36,8 +36,8 @@ static const struct reg_default cs35l41_reg[] =3D { { CS35L41_DAC_PCM1_SRC, 0x00000008 }, { CS35L41_ASP_TX1_SRC, 0x00000018 }, { CS35L41_ASP_TX2_SRC, 0x00000019 }, - { CS35L41_ASP_TX3_SRC, 0x00000020 }, - { CS35L41_ASP_TX4_SRC, 0x00000021 }, + { CS35L41_ASP_TX3_SRC, 0x00000000 }, + { CS35L41_ASP_TX4_SRC, 0x00000000 }, { CS35L41_DSP1_RX1_SRC, 0x00000008 }, { CS35L41_DSP1_RX2_SRC, 0x00000009 }, { CS35L41_DSP1_RX3_SRC, 0x00000018 }, @@ -643,6 +643,8 @@ static const struct reg_sequence cs35l41_reva0_errata_p= atch[] =3D { { CS35L41_DSP1_XM_ACCEL_PL0_PRI, 0x00000000 }, { CS35L41_PWR_CTRL2, 0x00000000 }, { CS35L41_AMP_GAIN_CTRL, 0x00000000 }, + { CS35L41_ASP_TX3_SRC, 0x00000000 }, + { CS35L41_ASP_TX4_SRC, 0x00000000 }, }; =20 static const struct reg_sequence cs35l41_revb0_errata_patch[] =3D { @@ -654,6 +656,8 @@ static const struct reg_sequence cs35l41_revb0_errata_p= atch[] =3D { { CS35L41_DSP1_XM_ACCEL_PL0_PRI, 0x00000000 }, { CS35L41_PWR_CTRL2, 0x00000000 }, { CS35L41_AMP_GAIN_CTRL, 0x00000000 }, + { CS35L41_ASP_TX3_SRC, 0x00000000 }, + { CS35L41_ASP_TX4_SRC, 0x00000000 }, }; =20 static const struct reg_sequence cs35l41_revb2_errata_patch[] =3D { @@ -665,6 +669,8 @@ static const struct reg_sequence cs35l41_revb2_errata_p= atch[] =3D { { CS35L41_DSP1_XM_ACCEL_PL0_PRI, 0x00000000 }, { CS35L41_PWR_CTRL2, 0x00000000 }, { CS35L41_AMP_GAIN_CTRL, 0x00000000 }, + { CS35L41_ASP_TX3_SRC, 0x00000000 }, + { CS35L41_ASP_TX4_SRC, 0x00000000 }, }; =20 static const struct cs35l41_otp_map_element_t cs35l41_otp_map_map[] =3D { --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EA6AC43334 for ; Tue, 19 Jul 2022 13:08:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243193AbiGSNI6 (ORCPT ); Tue, 19 Jul 2022 09:08:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243189AbiGSNId (ORCPT ); Tue, 19 Jul 2022 09:08:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B90ABB8DA; Tue, 19 Jul 2022 05:28:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E2AE5B81B8D; Tue, 19 Jul 2022 12:28:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F693C341C6; Tue, 19 Jul 2022 12:27:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233679; bh=Nw9GIA0IvSM+nBcMCdX3mSHyRJJF5jJYhfuCJ1FOG6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v0AACTXQgh6AfZWGhj5yvbTbIMk3A49tz4GRMtVL22EQs/j8Ui/nA/5ix8toD/hGB dWb++7bdEst85FnwJcL7/n6+IhouFH7l55yz2I1m0qy+RUIPkIDcrXzGnZC9uvgqwL 20GTzaigYWdWFZuIvOtnlt4/dbpC7z/xOh1UwddQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 204/231] ASoC: cs47l15: Fix event generation for low power mux control Date: Tue, 19 Jul 2022 13:54:49 +0200 Message-Id: <20220719114731.136622723@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit 7f103af4a10f375b9b346b4d0b730f6a66b8c451 ] cs47l15_in1_adc_put always returns zero regardless of if the control value was updated. This results in missing notifications to user-space of the control change. Update the handling to return 1 when the value is changed. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220623105120.1981154-3-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/cs47l15.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/cs47l15.c b/sound/soc/codecs/cs47l15.c index 391fd7da331f..1c7d52bef893 100644 --- a/sound/soc/codecs/cs47l15.c +++ b/sound/soc/codecs/cs47l15.c @@ -122,6 +122,9 @@ static int cs47l15_in1_adc_put(struct snd_kcontrol *kco= ntrol, snd_soc_kcontrol_component(kcontrol); struct cs47l15 *cs47l15 =3D snd_soc_component_get_drvdata(component); =20 + if (!!ucontrol->value.integer.value[0] =3D=3D cs47l15->in1_lp_mode) + return 0; + switch (ucontrol->value.integer.value[0]) { case 0: /* Set IN1 to normal mode */ @@ -150,7 +153,7 @@ static int cs47l15_in1_adc_put(struct snd_kcontrol *kco= ntrol, break; } =20 - return 0; + return 1; } =20 static const struct snd_kcontrol_new cs47l15_snd_controls[] =3D { --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3D50C433EF for ; Tue, 19 Jul 2022 13:10:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243362AbiGSNKz (ORCPT ); Tue, 19 Jul 2022 09:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243411AbiGSNJZ (ORCPT ); Tue, 19 Jul 2022 09:09:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0272D8967B; Tue, 19 Jul 2022 05:28:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4264860DE0; Tue, 19 Jul 2022 12:28:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 138CDC341C6; Tue, 19 Jul 2022 12:28:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233682; bh=2LOjYje2bLXGWMOvXmaOsvyq6QYDfSUX/nqUmPJDAgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VbIP5h3PjSDL56nkO+6HmzX7F/06DyLZeDIRWFJJ+bmDsI29fE/9Hhg1UdgEfhlqb PtaU1a5Cjkwl9gFF7PkFwSbZgmpdfoPTXEi5ucXsRgoU/pGoChU2bN3MGQCtX4s5HK uBwNj7dYMrtShQvml1RIVINAhPhR5oArJZWDcVN4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 205/231] ASoC: madera: Fix event generation for OUT1 demux Date: Tue, 19 Jul 2022 13:54:50 +0200 Message-Id: <20220719114731.206510208@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit e3cabbef3db8269207a6b8808f510137669f8deb ] madera_out1_demux_put returns the value of snd_soc_dapm_mux_update_power, which returns a 1 if a path was found for the kcontrol. This is obviously different to the expected return a 1 if the control was updated value. This results in spurious notifications to user-space. Update the handling to only return a 1 when the value is changed. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220623105120.1981154-4-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/madera.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/madera.c b/sound/soc/codecs/madera.c index 272041c6236a..8095a87117cf 100644 --- a/sound/soc/codecs/madera.c +++ b/sound/soc/codecs/madera.c @@ -618,7 +618,13 @@ int madera_out1_demux_put(struct snd_kcontrol *kcontro= l, end: snd_soc_dapm_mutex_unlock(dapm); =20 - return snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); + ret =3D snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); + if (ret < 0) { + dev_err(madera->dev, "Failed to update demux power state: %d\n", ret); + return ret; + } + + return change; } EXPORT_SYMBOL_GPL(madera_out1_demux_put); =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFD10C433EF for ; Tue, 19 Jul 2022 13:09:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243229AbiGSNJC (ORCPT ); Tue, 19 Jul 2022 09:09:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243099AbiGSNIk (ORCPT ); Tue, 19 Jul 2022 09:08:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04B944B0DD; Tue, 19 Jul 2022 05:28:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C32460908; Tue, 19 Jul 2022 12:28:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC259C341CA; Tue, 19 Jul 2022 12:28:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233685; bh=wOFnb+h38ZHkQ71ZrI57raY9yE4kjjI4LOL96pxBNUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=krF9xmZvhmsKdz0XjOdLM9N8uwlXWQdpUF4HmtXO0++KqHuR33pVqEz6Rw4ySe51c lqjUaoycIr+ZYm2Bsxph3tAfgl8un1o3NcHyXN5b+Ugj+nQI6rc3TEPOm6l3H+K/nZ lBc1QyEjxy/+Gpp7hxY+m8DxfqU3XYe1Hh84d/ys= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 206/231] ASoC: madera: Fix event generation for rate controls Date: Tue, 19 Jul 2022 13:54:51 +0200 Message-Id: <20220719114731.275818416@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit 980555e95f7cabdc9c80a07107622b097ba23703 ] madera_adsp_rate_put always returns zero regardless of if the control value was updated. This results in missing notifications to user-space of the control change. Update the handling to return 1 when the value is changed. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220623105120.1981154-5-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/madera.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/madera.c b/sound/soc/codecs/madera.c index 8095a87117cf..b9f19fbd2911 100644 --- a/sound/soc/codecs/madera.c +++ b/sound/soc/codecs/madera.c @@ -899,7 +899,7 @@ static int madera_adsp_rate_put(struct snd_kcontrol *kc= ontrol, struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; const int adsp_num =3D e->shift_l; const unsigned int item =3D ucontrol->value.enumerated.item[0]; - int ret; + int ret =3D 0; =20 if (item >=3D e->items) return -EINVAL; @@ -916,10 +916,10 @@ static int madera_adsp_rate_put(struct snd_kcontrol *= kcontrol, "Cannot change '%s' while in use by active audio paths\n", kcontrol->id.name); ret =3D -EBUSY; - } else { + } else if (priv->adsp_rate_cache[adsp_num] !=3D e->values[item]) { /* Volatile register so defer until the codec is powered up */ priv->adsp_rate_cache[adsp_num] =3D e->values[item]; - ret =3D 0; + ret =3D 1; } =20 mutex_unlock(&priv->rate_lock); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1739CCCA481 for ; Tue, 19 Jul 2022 13:10:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238570AbiGSNKK (ORCPT ); Tue, 19 Jul 2022 09:10:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243154AbiGSNIs (ORCPT ); Tue, 19 Jul 2022 09:08:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4521D550E4; Tue, 19 Jul 2022 05:28:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 321266020F; Tue, 19 Jul 2022 12:28:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA306C341C6; Tue, 19 Jul 2022 12:28:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233691; bh=TqZD68mi36gm9aiOSQeCq3F2D3ZSF1PXzG4Ef1OaD6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sfw4Fp2TPm6VnP3fIJTSxQ+U7nW+OvMcnyeC7ZIGqjIGQgZqv4R8SsMDMcOc13Txw lw9UJHsoNltYU25Ms7SdEUkKIkK/fk4O6ocr2frHcT6xlEvklzxPtfDBL6TA8mGJ6X lwl4ZnP+OnqU9Gm26SGSyzhsYrJEYWJCS4Q3j4JE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Stafford Horne , Sasha Levin Subject: [PATCH 5.18 207/231] irqchip: or1k-pic: Undefine mask_ack for level triggered hardware Date: Tue, 19 Jul 2022 13:54:52 +0200 Message-Id: <20220719114731.345635622@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stafford Horne [ Upstream commit 8520501346ed8d1c4a6dfa751cb57328a9c843f1 ] The mask_ack operation clears the interrupt by writing to the PICSR register. This we don't want for level triggered interrupt because it does not actually clear the interrupt on the source hardware. This was causing issues in qemu with multi core setups where interrupts would continue to fire even though they had been cleared in PICSR. Just remove the mask_ack operation. Acked-by: Marc Zyngier Signed-off-by: Stafford Horne Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/irqchip/irq-or1k-pic.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/irqchip/irq-or1k-pic.c b/drivers/irqchip/irq-or1k-pic.c index 49b47e787644..f289ccd95291 100644 --- a/drivers/irqchip/irq-or1k-pic.c +++ b/drivers/irqchip/irq-or1k-pic.c @@ -66,7 +66,6 @@ static struct or1k_pic_dev or1k_pic_level =3D { .name =3D "or1k-PIC-level", .irq_unmask =3D or1k_pic_unmask, .irq_mask =3D or1k_pic_mask, - .irq_mask_ack =3D or1k_pic_mask_ack, }, .handle =3D handle_level_irq, .flags =3D IRQ_LEVEL | IRQ_NOPROBE, --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8911FC43334 for ; Tue, 19 Jul 2022 13:10:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236275AbiGSNK0 (ORCPT ); Tue, 19 Jul 2022 09:10:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243268AbiGSNJM (ORCPT ); Tue, 19 Jul 2022 09:09:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D56962A41; Tue, 19 Jul 2022 05:28:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 10E4A60DEB; Tue, 19 Jul 2022 12:28:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8C1FC341C6; Tue, 19 Jul 2022 12:28:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233694; bh=mlyiupWzoaqCGlzd2A4M2PlghwEdsgGXG2cqiizqiTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=diFMR5WnXqQFF6QizKasJ+ZoDmO26Bn/E79oURuqLGw4AMWKvoiYQVbEKsho0kUQF bKl473+IU+QDfPwyCGlmThX9uEq1kU6oI4VBkjbnKKebYOdi+PHWB4+iJPNPc6uEXd pZ+cjgKXCW3n81I42JN9oGugzL6IUk3uYeymr5tg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacky Bai , Linus Walleij , Sasha Levin Subject: [PATCH 5.18 208/231] pinctrl: imx: Add the zero base flag for imx93 Date: Tue, 19 Jul 2022 13:54:53 +0200 Message-Id: <20220719114731.416809654@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jacky Bai [ Upstream commit fbc24ebc65507feb9728dc38197f90486148dda0 ] On i.MX93, the pin mux reg offset is from 0x0, so need to add the 'ZERO_OFFSET_VALID' flag to make sure the pin at mux offset 0 can be found. Signed-off-by: Jacky Bai Link: https://lore.kernel.org/r/20220613031854.1571357-1-ping.bai@nxp.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/pinctrl/freescale/pinctrl-imx93.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pinctrl/freescale/pinctrl-imx93.c b/drivers/pinctrl/fr= eescale/pinctrl-imx93.c index c0630f69e995..417e41b37a6f 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx93.c +++ b/drivers/pinctrl/freescale/pinctrl-imx93.c @@ -239,6 +239,7 @@ static const struct pinctrl_pin_desc imx93_pinctrl_pads= [] =3D { static const struct imx_pinctrl_soc_info imx93_pinctrl_info =3D { .pins =3D imx93_pinctrl_pads, .npins =3D ARRAY_SIZE(imx93_pinctrl_pads), + .flags =3D ZERO_OFFSET_VALID, .gpr_compatible =3D "fsl,imx93-iomuxc-gpr", }; =20 --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86927C433EF for ; Tue, 19 Jul 2022 13:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243336AbiGSNNR (ORCPT ); Tue, 19 Jul 2022 09:13:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243313AbiGSNMM (ORCPT ); Tue, 19 Jul 2022 09:12:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58BE8419B9; Tue, 19 Jul 2022 05:29:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E392B60DE0; Tue, 19 Jul 2022 12:29:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF68FC341C6; Tue, 19 Jul 2022 12:29:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233784; bh=1rsOjCzTzZZGjsOkD4VV/Yi0b4wpzhVrNjevvk3ABTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B7YiVPHPq+/BIewCuIuothP172iHYQpS4WpgY+BiRyEsPrZrSHoWvDxhgtaHGzrWO JLjif9vG2qINdlggH3PF8/eDELsTQ+/OGgkeWqdrWPI3Jxft/90t4J9JdDmrln+8wt WwzzNjxzkpYsugtuThhxPb6IxQres3zz6d/05xOQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Borislav Petkov , Sasha Levin Subject: [PATCH 5.18 209/231] x86: Clear .brk area at early boot Date: Tue, 19 Jul 2022 13:54:54 +0200 Message-Id: <20220719114731.488525670@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Juergen Gross [ Upstream commit 38fa5479b41376dc9d7f57e71c83514285a25ca0 ] The .brk section has the same properties as .bss: it is an alloc-only section and should be cleared before being used. Not doing so is especially a problem for Xen PV guests, as the hypervisor will validate page tables (check for writable page tables and hypervisor private bits) before accepting them to be used. Make sure .brk is initially zero by letting clear_bss() clear the brk area, too. Signed-off-by: Juergen Gross Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20220630071441.28576-3-jgross@suse.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/x86/kernel/head64.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 2e10a33778cf..92eae95f1a0b 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -425,6 +425,8 @@ void __init clear_bss(void) { memset(__bss_start, 0, (unsigned long) __bss_stop - (unsigned long) __bss_start); + memset(__brk_base, 0, + (unsigned long) __brk_limit - (unsigned long) __brk_base); } =20 static unsigned long get_cmd_line_ptr(void) --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5574DC43334 for ; Tue, 19 Jul 2022 13:11:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239820AbiGSNLD (ORCPT ); Tue, 19 Jul 2022 09:11:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243493AbiGSNJh (ORCPT ); Tue, 19 Jul 2022 09:09:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E17E16554E; Tue, 19 Jul 2022 05:28:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B4E8BB81B29; Tue, 19 Jul 2022 12:28:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F32AFC341D7; Tue, 19 Jul 2022 12:28:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233719; bh=8oR8txlHLyxmwdMdLQFzwIKBinSn6adtCLJySAog5fk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eFI6SGoSC89cLqRGLbQd3JmzoCYHRErP10ZIWt9QOOhRj9m0dPW8586EvSE1h4r9r Tslh8W/7VGMb+rUvvibhc36Qx5hyZuXYNIKm4z6E0P3anhSJvLUensj647MjaSb43M jv2Xa4rXi8soXP8xPf5umPp8g99SxaZuCD/KIQh4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Arnd Bergmann , Sasha Levin Subject: [PATCH 5.18 210/231] soc: ixp4xx/npe: Fix unused match warning Date: Tue, 19 Jul 2022 13:54:55 +0200 Message-Id: <20220719114731.558015819@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit 620f83b8326ce9706b1118334f0257ae028ce045 ] The kernel test robot found this inconsistency: drivers/soc/ixp4xx/ixp4xx-npe.c:737:34: warning: 'ixp4xx_npe_of_match' defined but not used [-Wunused-const-variable=3D] 737 | static const struct of_device_id ixp4xx_npe_of_match[] =3D { This is because the match is enclosed in the of_match_ptr() which compiles into NULL when OF is disabled and this is unnecessary. Fix it by dropping of_match_ptr() around the match. Signed-off-by: Linus Walleij Link: https://lore.kernel.org/r/20220626074315.61209-1-linus.walleij@linaro= .org' Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/soc/ixp4xx/ixp4xx-npe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-np= e.c index 613935cb6a48..58240e320c13 100644 --- a/drivers/soc/ixp4xx/ixp4xx-npe.c +++ b/drivers/soc/ixp4xx/ixp4xx-npe.c @@ -758,7 +758,7 @@ static const struct of_device_id ixp4xx_npe_of_match[] = =3D { static struct platform_driver ixp4xx_npe_driver =3D { .driver =3D { .name =3D "ixp4xx-npe", - .of_match_table =3D of_match_ptr(ixp4xx_npe_of_match), + .of_match_table =3D ixp4xx_npe_of_match, }, .probe =3D ixp4xx_npe_probe, .remove =3D ixp4xx_npe_remove, --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 577A3C433EF for ; Tue, 19 Jul 2022 13:12:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243440AbiGSNMX (ORCPT ); Tue, 19 Jul 2022 09:12:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243253AbiGSNLR (ORCPT ); Tue, 19 Jul 2022 09:11:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 676B64B48B; Tue, 19 Jul 2022 05:29:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C00ED60C8C; Tue, 19 Jul 2022 12:29:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A8CFC341C6; Tue, 19 Jul 2022 12:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233751; bh=AoIdOdQMCNQyvzKxG2A08TlFLQ92xZ/YgmSCnmD8ppA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xsYe4cruiIdFxLdfE5IsaU7gTCEL8FxHEqJkZXG0JRfo6SvdGcFtX8J5c5jFS8SFq 3f5+68FWmaKi11JOg603nGbSgTR2wgk3vIsx26Pk2bwSqjus0sDoyuvcsO1LqH1s6F UE6D/J0wOU5bfMbvrHBzrUWChY6Sar9HwX8u8kIg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gabriel Fernandez , Alexandre Torgue , Sasha Levin Subject: [PATCH 5.18 211/231] ARM: dts: stm32: use the correct clock source for CEC on stm32mp151 Date: Tue, 19 Jul 2022 13:54:56 +0200 Message-Id: <20220719114731.628159300@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gabriel Fernandez [ Upstream commit 78ece8cce1ba0c3f3e5a7c6c1b914b3794f04c44 ] The peripheral clock of CEC is not LSE but CEC. Signed-off-by: Gabriel Fernandez Signed-off-by: Alexandre Torgue Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/boot/dts/stm32mp151.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/stm32mp151.dtsi b/arch/arm/boot/dts/stm32mp1= 51.dtsi index 9c2bbf115f4c..de4d651f9575 100644 --- a/arch/arm/boot/dts/stm32mp151.dtsi +++ b/arch/arm/boot/dts/stm32mp151.dtsi @@ -565,7 +565,7 @@ compatible =3D "st,stm32-cec"; reg =3D <0x40016000 0x400>; interrupts =3D ; - clocks =3D <&rcc CEC_K>, <&clk_lse>; + clocks =3D <&rcc CEC_K>, <&rcc CEC>; clock-names =3D "cec", "hdmi-cec"; status =3D "disabled"; }; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84275C43334 for ; Tue, 19 Jul 2022 13:12:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243459AbiGSNMg (ORCPT ); Tue, 19 Jul 2022 09:12:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243357AbiGSNLx (ORCPT ); Tue, 19 Jul 2022 09:11:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B757467159; Tue, 19 Jul 2022 05:29:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4C29060DD0; Tue, 19 Jul 2022 12:29:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18236C341C6; Tue, 19 Jul 2022 12:29:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233763; bh=YGB2Y6+ruG1k6sJM1H3ucWmg5fcVAC+DaG+pHm9VLSM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yr2Jlck/NdMwFhxaNJG696fq7gyyqMwF6ykpKbZsysoQ4xpYUkmvbjB8EXNxXjkM3 neS7BqGEqU1gUm+PA7mM/mcLHorkSJi7nOGTyNQRsNANk4lA0tZz/4Kp3pdJn/XBQJ Jl2qiXgtDyzHJoJ+u6d+jD2ZhN6TIuUdLb18xnPM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Neeli , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.18 212/231] Revert "can: xilinx_can: Limit CANFD brp to 2" Date: Tue, 19 Jul 2022 13:54:57 +0200 Message-Id: <20220719114731.697702498@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Srinivas Neeli [ Upstream commit c6da4590fe819dfe28a4f8037a8dc1e056542fb4 ] This reverts commit 05ca14fdb6fe65614e0652d03e44b02748d25af7. On early silicon engineering samples observed bit shrinking issue when we use brp as 1. Hence updated brp_min as 2. As in production silicon this issue is fixed, so reverting the patch. Link: https://lore.kernel.org/all/20220609082433.1191060-2-srinivas.neeli@x= ilinx.com Signed-off-by: Srinivas Neeli Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/can/xilinx_can.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 43f0c6a064ba..75b4db4d050b 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -259,7 +259,7 @@ static const struct can_bittiming_const xcan_bittiming_= const_canfd2 =3D { .tseg2_min =3D 1, .tseg2_max =3D 128, .sjw_max =3D 128, - .brp_min =3D 2, + .brp_min =3D 1, .brp_max =3D 256, .brp_inc =3D 1, }; @@ -272,7 +272,7 @@ static const struct can_bittiming_const xcan_data_bitti= ming_const_canfd2 =3D { .tseg2_min =3D 1, .tseg2_max =3D 16, .sjw_max =3D 16, - .brp_min =3D 2, + .brp_min =3D 1, .brp_max =3D 256, .brp_inc =3D 1, }; --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB57BC43334 for ; Tue, 19 Jul 2022 13:12:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243412AbiGSNMm (ORCPT ); Tue, 19 Jul 2022 09:12:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240144AbiGSNMA (ORCPT ); Tue, 19 Jul 2022 09:12:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFD9A67581; Tue, 19 Jul 2022 05:29:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4441260693; Tue, 19 Jul 2022 12:29:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03D6BC341C6; Tue, 19 Jul 2022 12:29:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233766; bh=o97yyzqXtkAi9dD3IykIm+0aHWiYI1dIxHa/BFEbvjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=POQNdwGWIbcKycLgJ/1c+h66YSYo87hqs9vxuBh4shPqTpMe4be1Hmn+WeihDJtzx NtwPbCp4EKMvE3ADYqd2UCtXW3YzQFapwjpoG3kkUyXxIJr5Vu16o5OqCS0QHnwP8d oyMHL4Cgdzj1Wa/XsnZPCvsvDJsY9dhzRL7zJKSE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Veness , Takashi Iwai , Sasha Levin Subject: [PATCH 5.18 213/231] ALSA: usb-audio: Add quirks for MacroSilicon MS2100/MS2106 devices Date: Tue, 19 Jul 2022 13:54:58 +0200 Message-Id: <20220719114731.767273548@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Veness [ Upstream commit 6e2c9105e0b743c92a157389d40f00b81bdd09fe ] Treat the claimed 96kHz 1ch in the descriptors as 48kHz 2ch, so that the audio stream doesn't sound mono. Also fix initial stream alignment, so that left and right channels are in the correct order. Signed-off-by: John Veness Link: https://lore.kernel.org/r/20220624140757.28758-1-john-linux@pelago.or= g.uk Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/usb/quirks-table.h | 48 ++++++++++++++++++++++++++++++++++++++++++= +++++ sound/usb/quirks.c | 3 ++ 2 files changed, 51 insertions(+) --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -3803,6 +3803,54 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, =20 /* + * MacroSilicon MS2100/MS2106 based AV capture cards + * + * These claim 96kHz 1ch in the descriptors, but are actually 48kHz 2ch. + * They also need QUIRK_FLAG_ALIGN_TRANSFER, which makes one wonder if + * they pretend to be 96kHz mono as a workaround for stereo being broken + * by that... + * + * They also have an issue with initial stream alignment that causes the + * channels to be swapped and out of phase, which is dealt with in quirks.= c. + */ +{ + USB_AUDIO_DEVICE(0x534d, 0x0021), + .driver_info =3D (unsigned long) &(const struct snd_usb_audio_quirk) { + .vendor_name =3D "MacroSilicon", + .product_name =3D "MS210x", + .ifnum =3D QUIRK_ANY_INTERFACE, + .type =3D QUIRK_COMPOSITE, + .data =3D &(const struct snd_usb_audio_quirk[]) { + { + .ifnum =3D 2, + .type =3D QUIRK_AUDIO_STANDARD_MIXER, + }, + { + .ifnum =3D 3, + .type =3D QUIRK_AUDIO_FIXED_ENDPOINT, + .data =3D &(const struct audioformat) { + .formats =3D SNDRV_PCM_FMTBIT_S16_LE, + .channels =3D 2, + .iface =3D 3, + .altsetting =3D 1, + .altset_idx =3D 1, + .attributes =3D 0, + .endpoint =3D 0x82, + .ep_attr =3D USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC, + .rates =3D SNDRV_PCM_RATE_CONTINUOUS, + .rate_min =3D 48000, + .rate_max =3D 48000, + } + }, + { + .ifnum =3D -1 + } + } + } +}, + +/* * MacroSilicon MS2109 based HDMI capture cards * * These claim 96kHz 1ch in the descriptors, but are actually 48kHz 2ch. --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1478,6 +1478,7 @@ void snd_usb_set_format_quirk(struct snd case USB_ID(0x041e, 0x3f19): /* E-Mu 0204 USB */ set_format_emu_quirk(subs, fmt); break; + case USB_ID(0x534d, 0x0021): /* MacroSilicon MS2100/MS2106 */ case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */ subs->stream_offset_adj =3D 2; break; @@ -1908,6 +1909,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_IGNORE_CTL_ERROR), DEVICE_FLG(0x413c, 0xa506, /* Dell AE515 sound bar */ QUIRK_FLAG_GET_SAMPLE_RATE), + DEVICE_FLG(0x534d, 0x0021, /* MacroSilicon MS2100/MS2106 */ + QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x1224, 0x2a25, /* Jieli Technology USB PHY 2.0 */ From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0A9AC433EF for ; Tue, 19 Jul 2022 13:12:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243482AbiGSNMr (ORCPT ); Tue, 19 Jul 2022 09:12:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237689AbiGSNMF (ORCPT ); Tue, 19 Jul 2022 09:12:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EC2E8C3CE; Tue, 19 Jul 2022 05:29:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 23EA060C8C; Tue, 19 Jul 2022 12:29:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5503C341C6; Tue, 19 Jul 2022 12:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233769; bh=RErdYp/saWbXBtDS7TGY/5ALVxq4blsMtCQT7X3SQkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Apyxeo45QD/cTZoV46j7yO2Zy4ytjXnD5+0nrySeGNR9MDqJiLuOtJGX99TtK5Qsq U2GZ0KDnVCyZuarsOeHBvMQA1cDnoKxOUoH5z87sL5CBqyQ/LjD49p4WAuPkypMRKu jGncisNTCdqSdw5XGn4wjWIbbLIYKP8f/iZkZLOc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Egor Vorontsov , Takashi Iwai , Sasha Levin Subject: [PATCH 5.18 214/231] ALSA: usb-audio: Add quirk for Fiero SC-01 Date: Tue, 19 Jul 2022 13:54:59 +0200 Message-Id: <20220719114731.837203827@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Egor Vorontsov [ Upstream commit 4fb7c24f69c48fdc02ea7858dbd5a60ff08bf7e5 ] Fiero SC-01 is a USB sound card with two mono inputs and a single stereo output. The inputs are composed into a single stereo stream. The device uses a vendor-provided driver on Windows and does not work at all without it. The driver mostly provides ASIO functionality, but also alters the way the sound card is queried for sample rates and clocks. ALSA queries those failing with an EPIPE (same as Windows 10 does). Presumably, the vendor-provided driver does not query it at all, simply matching by VID:PID. Thus, I consider this a buggy firmware and adhere to a set of fixed endpoint quirks instead. The soundcard has an internal clock. Implicit feedback mode is required for the playback. I have updated my device to v1.1.0 from a Windows 10 VM using a vendor- provided binary prior to the development, hoping for it to just begin working. The device provides no obvious way to downgrade the firmware, and regardless, there's no binary available for v1.0.0 anyway. Thus, I will be getting another unit to extend the patch with support for that. Expected to be a simple copy-paste of the existing one, though. There were no previous reports of that device in context of Linux anywhere. Other issues have been reported though, but that's out of the scope. Signed-off-by: Egor Vorontsov Link: https://lore.kernel.org/r/20220627100041.2861494-1-sdoregor@sdore.me Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/usb/quirks-table.h | 68 ++++++++++++++++++++++++++++++++++++++++++= +++++ sound/usb/quirks.c | 2 + 2 files changed, 70 insertions(+) --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -4167,6 +4167,74 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, +{ + /* + * Fiero SC-01 (firmware v1.1.0) + */ + USB_DEVICE(0x2b53, 0x0031), + .driver_info =3D (unsigned long) &(const struct snd_usb_audio_quirk) { + .vendor_name =3D "Fiero", + .product_name =3D "SC-01", + .ifnum =3D QUIRK_ANY_INTERFACE, + .type =3D QUIRK_COMPOSITE, + .data =3D &(const struct snd_usb_audio_quirk[]) { + { + .ifnum =3D 0, + .type =3D QUIRK_AUDIO_STANDARD_INTERFACE + }, + /* Playback */ + { + .ifnum =3D 1, + .type =3D QUIRK_AUDIO_FIXED_ENDPOINT, + .data =3D &(const struct audioformat) { + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + .channels =3D 2, + .fmt_bits =3D 24, + .iface =3D 1, + .altsetting =3D 1, + .altset_idx =3D 1, + .endpoint =3D 0x01, + .ep_attr =3D USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC, + .rates =3D SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_96000, + .rate_min =3D 48000, + .rate_max =3D 96000, + .nr_rates =3D 2, + .rate_table =3D (unsigned int[]) { 48000, 96000 }, + .clock =3D 0x29 + } + }, + /* Capture */ + { + .ifnum =3D 2, + .type =3D QUIRK_AUDIO_FIXED_ENDPOINT, + .data =3D &(const struct audioformat) { + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + .channels =3D 2, + .fmt_bits =3D 24, + .iface =3D 2, + .altsetting =3D 1, + .altset_idx =3D 1, + .endpoint =3D 0x82, + .ep_attr =3D USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC | + USB_ENDPOINT_USAGE_IMPLICIT_FB, + .rates =3D SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_96000, + .rate_min =3D 48000, + .rate_max =3D 96000, + .nr_rates =3D 2, + .rate_table =3D (unsigned int[]) { 48000, 96000 }, + .clock =3D 0x29 + } + }, + { + .ifnum =3D -1 + } + } + } +}, =20 #undef USB_DEVICE_VENDOR_SPEC #undef USB_AUDIO_DEVICE --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1915,6 +1915,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x1224, 0x2a25, /* Jieli Technology USB PHY 2.0 */ QUIRK_FLAG_GET_SAMPLE_RATE), + DEVICE_FLG(0x2b53, 0x0031, /* Fiero SC-01 (firmware v1.1.0) */ + QUIRK_FLAG_GENERIC_IMPLICIT_FB), =20 /* Vendor matches */ VENDOR_FLG(0x045e, /* MS Lifecam */ From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91592C43334 for ; Tue, 19 Jul 2022 13:12:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243488AbiGSNMv (ORCPT ); Tue, 19 Jul 2022 09:12:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243368AbiGSNMH (ORCPT ); Tue, 19 Jul 2022 09:12:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEFE367589; Tue, 19 Jul 2022 05:29:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7C5C9B81B10; Tue, 19 Jul 2022 12:29:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8999C341C6; Tue, 19 Jul 2022 12:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233772; bh=r+Pn/SmVZvoZW00fOdHXa1Z9ZhleyKI8tYjwvnl8F/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZeJwJrnvcax7LkwpoKF4VpoFIUlDGLeOGuxGqJg+O0LH76/Dn6hP61K2PtA8/pD1N 7iWAWE+nmfoIEkc6k8txheQS0kq+9AMYbeqNjy4wY2ShFGjN3ZCBy9KZYa7eVFB1XS tOAeNzxSYmGzdmlXPtO/x2asledjuvp1TojU366s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Egor Vorontsov , Takashi Iwai , Sasha Levin Subject: [PATCH 5.18 215/231] ALSA: usb-audio: Add quirk for Fiero SC-01 (fw v1.0.0) Date: Tue, 19 Jul 2022 13:55:00 +0200 Message-Id: <20220719114731.907645974@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Egor Vorontsov [ Upstream commit 2307a0e1ca0b5c1337b37ac6302f96e017ebac3c ] The patch applies the same quirks used for SC-01 at firmware v1.1.0 to the ones running v1.0.0, with respect to hard-coded sample rates. I got two more units and successfully tested the patch series with both firmwares. The support is now complete (not accounting ASIO). Signed-off-by: Egor Vorontsov Link: https://lore.kernel.org/r/20220627100041.2861494-2-sdoregor@sdore.me Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/usb/quirks-table.h | 132 ++++++++++++++++++++++++++++++++++++++++++= +++++ sound/usb/quirks.c | 4 + 2 files changed, 136 insertions(+) --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -4169,6 +4169,138 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { /* + * Fiero SC-01 (firmware v1.0.0 @ 48 kHz) + */ + USB_DEVICE(0x2b53, 0x0023), + .driver_info =3D (unsigned long) &(const struct snd_usb_audio_quirk) { + .vendor_name =3D "Fiero", + .product_name =3D "SC-01", + .ifnum =3D QUIRK_ANY_INTERFACE, + .type =3D QUIRK_COMPOSITE, + .data =3D &(const struct snd_usb_audio_quirk[]) { + { + .ifnum =3D 0, + .type =3D QUIRK_AUDIO_STANDARD_INTERFACE + }, + /* Playback */ + { + .ifnum =3D 1, + .type =3D QUIRK_AUDIO_FIXED_ENDPOINT, + .data =3D &(const struct audioformat) { + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + .channels =3D 2, + .fmt_bits =3D 24, + .iface =3D 1, + .altsetting =3D 1, + .altset_idx =3D 1, + .endpoint =3D 0x01, + .ep_attr =3D USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC, + .rates =3D SNDRV_PCM_RATE_48000, + .rate_min =3D 48000, + .rate_max =3D 48000, + .nr_rates =3D 1, + .rate_table =3D (unsigned int[]) { 48000 }, + .clock =3D 0x29 + } + }, + /* Capture */ + { + .ifnum =3D 2, + .type =3D QUIRK_AUDIO_FIXED_ENDPOINT, + .data =3D &(const struct audioformat) { + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + .channels =3D 2, + .fmt_bits =3D 24, + .iface =3D 2, + .altsetting =3D 1, + .altset_idx =3D 1, + .endpoint =3D 0x82, + .ep_attr =3D USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC | + USB_ENDPOINT_USAGE_IMPLICIT_FB, + .rates =3D SNDRV_PCM_RATE_48000, + .rate_min =3D 48000, + .rate_max =3D 48000, + .nr_rates =3D 1, + .rate_table =3D (unsigned int[]) { 48000 }, + .clock =3D 0x29 + } + }, + { + .ifnum =3D -1 + } + } + } +}, +{ + /* + * Fiero SC-01 (firmware v1.0.0 @ 96 kHz) + */ + USB_DEVICE(0x2b53, 0x0024), + .driver_info =3D (unsigned long) &(const struct snd_usb_audio_quirk) { + .vendor_name =3D "Fiero", + .product_name =3D "SC-01", + .ifnum =3D QUIRK_ANY_INTERFACE, + .type =3D QUIRK_COMPOSITE, + .data =3D &(const struct snd_usb_audio_quirk[]) { + { + .ifnum =3D 0, + .type =3D QUIRK_AUDIO_STANDARD_INTERFACE + }, + /* Playback */ + { + .ifnum =3D 1, + .type =3D QUIRK_AUDIO_FIXED_ENDPOINT, + .data =3D &(const struct audioformat) { + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + .channels =3D 2, + .fmt_bits =3D 24, + .iface =3D 1, + .altsetting =3D 1, + .altset_idx =3D 1, + .endpoint =3D 0x01, + .ep_attr =3D USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC, + .rates =3D SNDRV_PCM_RATE_96000, + .rate_min =3D 96000, + .rate_max =3D 96000, + .nr_rates =3D 1, + .rate_table =3D (unsigned int[]) { 96000 }, + .clock =3D 0x29 + } + }, + /* Capture */ + { + .ifnum =3D 2, + .type =3D QUIRK_AUDIO_FIXED_ENDPOINT, + .data =3D &(const struct audioformat) { + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + .channels =3D 2, + .fmt_bits =3D 24, + .iface =3D 2, + .altsetting =3D 1, + .altset_idx =3D 1, + .endpoint =3D 0x82, + .ep_attr =3D USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC | + USB_ENDPOINT_USAGE_IMPLICIT_FB, + .rates =3D SNDRV_PCM_RATE_96000, + .rate_min =3D 96000, + .rate_max =3D 96000, + .nr_rates =3D 1, + .rate_table =3D (unsigned int[]) { 96000 }, + .clock =3D 0x29 + } + }, + { + .ifnum =3D -1 + } + } + } +}, +{ + /* * Fiero SC-01 (firmware v1.1.0) */ USB_DEVICE(0x2b53, 0x0031), --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1915,6 +1915,10 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x1224, 0x2a25, /* Jieli Technology USB PHY 2.0 */ QUIRK_FLAG_GET_SAMPLE_RATE), + DEVICE_FLG(0x2b53, 0x0023, /* Fiero SC-01 (firmware v1.0.0 @ 48 kHz) */ + QUIRK_FLAG_GENERIC_IMPLICIT_FB), + DEVICE_FLG(0x2b53, 0x0024, /* Fiero SC-01 (firmware v1.0.0 @ 96 kHz) */ + QUIRK_FLAG_GENERIC_IMPLICIT_FB), DEVICE_FLG(0x2b53, 0x0031, /* Fiero SC-01 (firmware v1.1.0) */ QUIRK_FLAG_GENERIC_IMPLICIT_FB), From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E478CC433EF for ; Tue, 19 Jul 2022 13:13:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243326AbiGSNNJ (ORCPT ); Tue, 19 Jul 2022 09:13:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237103AbiGSNMK (ORCPT ); Tue, 19 Jul 2022 09:12:10 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8192D67C92; Tue, 19 Jul 2022 05:29:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 00ABFCE1BE3; Tue, 19 Jul 2022 12:29:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAA90C341C6; Tue, 19 Jul 2022 12:29:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233775; bh=TrRXWrkQMD56R74PiDCIB/2Sib6HRyWtjxg0iqFt938=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YPNcY29esKTqD0nSSQ2UMkQZxajpWW7kBq/v1bo9xVe7PNATY95o27y2iJ8aWsJv2 kKIcqa+OgoHW3im2mqiDBNcga+fj4tY29ffBwMO+gEXguvy0dT6bM+8ML3nNLZ++Mk d26kCntUk2uH4B6QF6YEsvOwS8jVFe8HpHsVN0PQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Egolf , Keith Busch , Chaitanya Kulkarni , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.18 216/231] nvme-pci: phison e16 has bogus namespace ids Date: Tue, 19 Jul 2022 13:55:01 +0200 Message-Id: <20220719114731.977198713@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Keith Busch [ Upstream commit 73029c9b23cf1213e5f54c2b59efce08665199e7 ] Add the quirk. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216049 Reported-by: Chris Egolf Signed-off-by: Keith Busch Reviewed-by: Chaitanya Kulkarni Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index fe829377c7c2..ab575fdd8015 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -3432,7 +3432,8 @@ static const struct pci_device_id nvme_id_table[] =3D= { NVME_QUIRK_DISABLE_WRITE_ZEROES| NVME_QUIRK_IGNORE_DEV_SUBNQN, }, { PCI_DEVICE(0x1987, 0x5016), /* Phison E16 */ - .driver_data =3D NVME_QUIRK_IGNORE_DEV_SUBNQN, }, + .driver_data =3D NVME_QUIRK_IGNORE_DEV_SUBNQN | + NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1b4b, 0x1092), /* Lexar 256 GB SSD */ .driver_data =3D NVME_QUIRK_NO_NS_DESC_LIST | NVME_QUIRK_IGNORE_DEV_SUBNQN, }, --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7C39CCA483 for ; Tue, 19 Jul 2022 13:13:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243218AbiGSNNG (ORCPT ); Tue, 19 Jul 2022 09:13:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243418AbiGSNMJ (ORCPT ); Tue, 19 Jul 2022 09:12:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9401967C9E; Tue, 19 Jul 2022 05:29:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2B144609FB; Tue, 19 Jul 2022 12:29:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D40B3C341C6; Tue, 19 Jul 2022 12:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233778; bh=CH3O+8rE7gc07cwtk2Pd8nsB1wVExVHVq8mfQlHMR5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kPy3huWVFiCBWpnv3lUipLtmwo5v7ivJia8vGvtMYkBW/zbVO2NOdT1WfpszPHC8H tyFVRUNA6C1PTNAd81uKX7JZaJupgnuO/uY/OEjaaw4YppQemrSGJCmGNzyPTXvU6Z ehgv+zBcC4tIG9cljGZzU8vRp5rGgBq4aXuGdahc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , Christoph Hellwig , Keith Busch , Sasha Levin Subject: [PATCH 5.18 217/231] nvme: use struct group for generic command dwords Date: Tue, 19 Jul 2022 13:55:02 +0200 Message-Id: <20220719114732.046532360@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Keith Busch [ Upstream commit 5c629dc9609dc43492a7bc8060cc6120875bf096 ] This will allow the trace event to know the full size of the data intended to be copied and silence read overflow checks. Reported-by: John Garry Suggested-by: Christoph Hellwig Signed-off-by: Keith Busch Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/nvme/host/trace.h | 2 +- include/linux/nvme.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/trace.h b/drivers/nvme/host/trace.h index b5f85259461a..37c7f4c89f92 100644 --- a/drivers/nvme/host/trace.h +++ b/drivers/nvme/host/trace.h @@ -69,7 +69,7 @@ TRACE_EVENT(nvme_setup_cmd, __entry->metadata =3D !!blk_integrity_rq(req); __entry->fctype =3D cmd->fabrics.fctype; __assign_disk_name(__entry->disk, req->q->disk); - memcpy(__entry->cdw10, &cmd->common.cdw10, + memcpy(__entry->cdw10, &cmd->common.cdws, sizeof(__entry->cdw10)); ), TP_printk("nvme%d: %sqid=3D%d, cmdid=3D%u, nsid=3D%u, flags=3D0x%x, m= eta=3D0x%x, cmd=3D(%s %s)", diff --git a/include/linux/nvme.h b/include/linux/nvme.h index f626a445d1a8..99b1b56f0cd3 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h @@ -867,12 +867,14 @@ struct nvme_common_command { __le32 cdw2[2]; __le64 metadata; union nvme_data_ptr dptr; + struct_group(cdws, __le32 cdw10; __le32 cdw11; __le32 cdw12; __le32 cdw13; __le32 cdw14; __le32 cdw15; + ); }; =20 struct nvme_rw_command { --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B60DC433EF for ; Tue, 19 Jul 2022 13:13:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243519AbiGSNNM (ORCPT ); Tue, 19 Jul 2022 09:13:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234588AbiGSNML (ORCPT ); Tue, 19 Jul 2022 09:12:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB1A6675A0; Tue, 19 Jul 2022 05:29:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 88891B81B21; Tue, 19 Jul 2022 12:29:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5EDAC341C6; Tue, 19 Jul 2022 12:29:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233781; bh=tfiDlu1VfRW3+lcU9H/kpwY4ufThda3S/J3Uy9Z0RUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lzqMprUf9G1Y0OkapC0HHAUfltgYI75SZkjCGzpMjP15oCuu1lzuX6PRnYNEh/1h3 GcFtFU5ubxQcee/eLF9FXiIybR/bELaFWxQxfpZqx/SZlECOAza49N381+f7bxKZBl UtxDH8T4K0MBzA3zdUs2Y2DHkq74WD/H/LtIDlAQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 218/231] wireguard: selftests: set fake real time in init Date: Tue, 19 Jul 2022 13:55:03 +0200 Message-Id: <20220719114732.116389583@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld [ Upstream commit 829be057dbc1e71383b8d7de8edb31dcf07b4aa0 ] Not all platforms have an RTC, and rather than trying to force one into each, it's much easier to just set a fixed time. This is necessary because WireGuard's latest handshakes parameter is returned in wallclock time, and if the system time isn't set, and the system is really fast, then this returns 0, which trips the test. Turning this on requires setting CONFIG_COMPAT_32BIT_TIME=3Dy, as musl doesn't support settimeofday without it. Signed-off-by: Jason A. Donenfeld Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- .../testing/selftests/wireguard/qemu/arch/arm.config | 1 + .../selftests/wireguard/qemu/arch/armeb.config | 1 + .../testing/selftests/wireguard/qemu/arch/i686.config | 1 + .../testing/selftests/wireguard/qemu/arch/m68k.config | 1 + .../testing/selftests/wireguard/qemu/arch/mips.config | 1 + .../selftests/wireguard/qemu/arch/mipsel.config | 1 + .../selftests/wireguard/qemu/arch/powerpc.config | 1 + tools/testing/selftests/wireguard/qemu/init.c | 11 +++++++++++ 8 files changed, 18 insertions(+) diff --git a/tools/testing/selftests/wireguard/qemu/arch/arm.config b/tools= /testing/selftests/wireguard/qemu/arch/arm.config index fc7959bef9c2..0579c66be83e 100644 --- a/tools/testing/selftests/wireguard/qemu/arch/arm.config +++ b/tools/testing/selftests/wireguard/qemu/arch/arm.config @@ -7,6 +7,7 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=3Dy CONFIG_VIRTIO_MENU=3Dy CONFIG_VIRTIO_MMIO=3Dy CONFIG_VIRTIO_CONSOLE=3Dy +CONFIG_COMPAT_32BIT_TIME=3Dy CONFIG_CMDLINE_BOOL=3Dy CONFIG_CMDLINE=3D"console=3DttyAMA0 wg.success=3Dvport0p1 panic_on_warn=3D= 1" CONFIG_FRAME_WARN=3D1024 diff --git a/tools/testing/selftests/wireguard/qemu/arch/armeb.config b/too= ls/testing/selftests/wireguard/qemu/arch/armeb.config index f3066be81c19..2a3307bbe534 100644 --- a/tools/testing/selftests/wireguard/qemu/arch/armeb.config +++ b/tools/testing/selftests/wireguard/qemu/arch/armeb.config @@ -7,6 +7,7 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=3Dy CONFIG_VIRTIO_MENU=3Dy CONFIG_VIRTIO_MMIO=3Dy CONFIG_VIRTIO_CONSOLE=3Dy +CONFIG_COMPAT_32BIT_TIME=3Dy CONFIG_CMDLINE_BOOL=3Dy CONFIG_CMDLINE=3D"console=3DttyAMA0 wg.success=3Dvport0p1 panic_on_warn=3D= 1" CONFIG_CPU_BIG_ENDIAN=3Dy diff --git a/tools/testing/selftests/wireguard/qemu/arch/i686.config b/tool= s/testing/selftests/wireguard/qemu/arch/i686.config index 6d90892a85a2..cd864b9be6fb 100644 --- a/tools/testing/selftests/wireguard/qemu/arch/i686.config +++ b/tools/testing/selftests/wireguard/qemu/arch/i686.config @@ -1,6 +1,7 @@ CONFIG_ACPI=3Dy CONFIG_SERIAL_8250=3Dy CONFIG_SERIAL_8250_CONSOLE=3Dy +CONFIG_COMPAT_32BIT_TIME=3Dy CONFIG_CMDLINE_BOOL=3Dy CONFIG_CMDLINE=3D"console=3DttyS0 wg.success=3DttyS1 panic_on_warn=3D1" CONFIG_FRAME_WARN=3D1024 diff --git a/tools/testing/selftests/wireguard/qemu/arch/m68k.config b/tool= s/testing/selftests/wireguard/qemu/arch/m68k.config index 82c925e49beb..9639bfe06074 100644 --- a/tools/testing/selftests/wireguard/qemu/arch/m68k.config +++ b/tools/testing/selftests/wireguard/qemu/arch/m68k.config @@ -5,5 +5,6 @@ CONFIG_MAC=3Dy CONFIG_SERIAL_PMACZILOG=3Dy CONFIG_SERIAL_PMACZILOG_TTYS=3Dy CONFIG_SERIAL_PMACZILOG_CONSOLE=3Dy +CONFIG_COMPAT_32BIT_TIME=3Dy CONFIG_CMDLINE=3D"console=3DttyS0 wg.success=3DttyS1 panic_on_warn=3D1" CONFIG_FRAME_WARN=3D1024 diff --git a/tools/testing/selftests/wireguard/qemu/arch/mips.config b/tool= s/testing/selftests/wireguard/qemu/arch/mips.config index d7ec63c17b30..2a84402353ab 100644 --- a/tools/testing/selftests/wireguard/qemu/arch/mips.config +++ b/tools/testing/selftests/wireguard/qemu/arch/mips.config @@ -6,6 +6,7 @@ CONFIG_POWER_RESET=3Dy CONFIG_POWER_RESET_SYSCON=3Dy CONFIG_SERIAL_8250=3Dy CONFIG_SERIAL_8250_CONSOLE=3Dy +CONFIG_COMPAT_32BIT_TIME=3Dy CONFIG_CMDLINE_BOOL=3Dy CONFIG_CMDLINE=3D"console=3DttyS0 wg.success=3DttyS1 panic_on_warn=3D1" CONFIG_FRAME_WARN=3D1024 diff --git a/tools/testing/selftests/wireguard/qemu/arch/mipsel.config b/to= ols/testing/selftests/wireguard/qemu/arch/mipsel.config index 18a498293737..56146a101e7e 100644 --- a/tools/testing/selftests/wireguard/qemu/arch/mipsel.config +++ b/tools/testing/selftests/wireguard/qemu/arch/mipsel.config @@ -7,6 +7,7 @@ CONFIG_POWER_RESET=3Dy CONFIG_POWER_RESET_SYSCON=3Dy CONFIG_SERIAL_8250=3Dy CONFIG_SERIAL_8250_CONSOLE=3Dy +CONFIG_COMPAT_32BIT_TIME=3Dy CONFIG_CMDLINE_BOOL=3Dy CONFIG_CMDLINE=3D"console=3DttyS0 wg.success=3DttyS1 panic_on_warn=3D1" CONFIG_FRAME_WARN=3D1024 diff --git a/tools/testing/selftests/wireguard/qemu/arch/powerpc.config b/t= ools/testing/selftests/wireguard/qemu/arch/powerpc.config index 5e04882e8e35..174a9ffe2a36 100644 --- a/tools/testing/selftests/wireguard/qemu/arch/powerpc.config +++ b/tools/testing/selftests/wireguard/qemu/arch/powerpc.config @@ -4,6 +4,7 @@ CONFIG_PPC_85xx=3Dy CONFIG_PHYS_64BIT=3Dy CONFIG_SERIAL_8250=3Dy CONFIG_SERIAL_8250_CONSOLE=3Dy +CONFIG_COMPAT_32BIT_TIME=3Dy CONFIG_MATH_EMULATION=3Dy CONFIG_CMDLINE_BOOL=3Dy CONFIG_CMDLINE=3D"console=3DttyS0 wg.success=3DttyS1 panic_on_warn=3D1" diff --git a/tools/testing/selftests/wireguard/qemu/init.c b/tools/testing/= selftests/wireguard/qemu/init.c index 2a0f48fac925..542c34b00eb0 100644 --- a/tools/testing/selftests/wireguard/qemu/init.c +++ b/tools/testing/selftests/wireguard/qemu/init.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,15 @@ static void seed_rng(void) close(fd); } =20 +static void set_time(void) +{ + if (time(NULL)) + return; + pretty_message("[+] Setting fake time..."); + if (stime(&(time_t){1433512680}) < 0) + panic("settimeofday()"); +} + static void mount_filesystems(void) { pretty_message("[+] Mounting filesystems..."); @@ -256,6 +266,7 @@ int main(int argc, char *argv[]) print_banner(); mount_filesystems(); seed_rng(); + set_time(); kmod_selftests(); enable_logging(); clear_leaks(); --=20 2.35.1 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9883CC43334 for ; Tue, 19 Jul 2022 13:11:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243339AbiGSNL2 (ORCPT ); Tue, 19 Jul 2022 09:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243147AbiGSNKO (ORCPT ); Tue, 19 Jul 2022 09:10:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B96F56BB8; Tue, 19 Jul 2022 05:29:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9A85AB81B08; Tue, 19 Jul 2022 12:28:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFD12C36AE3; Tue, 19 Jul 2022 12:28:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233722; bh=aHW/uXcLAIS0X0b4wiEMkATVk8+tQ9jgo1MCI6UeQ5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kJTTBBhbn8RKJxh98cFShvtKkRmgbEPI/Qpr97jYEIDdrp/puumq0XgzGAo//hQth LUQPNQ2tP9ytsdwcnq5lAh2NI/lQ2a2DAZkg+gv0xN/6R2maaayHzDiTsMU5eU9fUZ ZXdokYQKzbdoXG1m105VHEdvxc9djYvmbnx4qvdI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 219/231] wireguard: selftests: always call kernel makefile Date: Tue, 19 Jul 2022 13:55:04 +0200 Message-Id: <20220719114732.186023983@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld [ Upstream commit 1a087eec257154e26a81a7a0a15380d7a2431765 ] These selftests are used for much more extensive changes than just the wireguard source files. So always call the kernel's build file, which will do something or nothing after checking the whole tree, per usual. Signed-off-by: Jason A. Donenfeld Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- tools/testing/selftests/wireguard/qemu/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/tools/testing/selftests/wireguard/qemu/Makefile +++ b/tools/testing/selftests/wireguard/qemu/Makefile @@ -19,8 +19,6 @@ endif MIRROR :=3D https://download.wireguard.com/qemu-test/distfiles/ =20 KERNEL_BUILD_PATH :=3D $(BUILD_PATH)/kernel$(if $(findstring yes,$(DEBUG_K= ERNEL)),-debug) -rwildcard=3D$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter = $(subst *,%,$2),$d)) -WIREGUARD_SOURCES :=3D $(call rwildcard,$(KERNEL_PATH)/drivers/net/wiregua= rd/,*) =20 default: qemu =20 @@ -324,8 +322,9 @@ $(KERNEL_BUILD_PATH)/.config: $(TOOLCHAI cd $(KERNEL_BUILD_PATH) && ARCH=3D$(KERNEL_ARCH) $(KERNEL_PATH)/scripts/k= config/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config $(KERNEL_BUILD_PATH)= /minimal.config $(if $(findstring yes,$(DEBUG_KERNEL)),cp debug.config $(KERNEL_BUILD_PAT= H) && cd $(KERNEL_BUILD_PATH) && ARCH=3D$(KERNEL_ARCH) $(KERNEL_PATH)/scrip= ts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config debug.config,) =20 -$(KERNEL_BZIMAGE): $(TOOLCHAIN_PATH)/.installed $(KERNEL_BUILD_PATH)/.conf= ig $(BUILD_PATH)/init-cpio-spec.txt $(IPERF_PATH)/src/iperf3 $(IPUTILS_PATH= )/ping $(BASH_PATH)/bash $(IPROUTE2_PATH)/misc/ss $(IPROUTE2_PATH)/ip/ip $(= IPTABLES_PATH)/iptables/xtables-legacy-multi $(NMAP_PATH)/ncat/ncat $(WIREG= UARD_TOOLS_PATH)/src/wg $(BUILD_PATH)/init ../netns.sh $(WIREGUARD_SOURCES) +$(KERNEL_BZIMAGE): $(TOOLCHAIN_PATH)/.installed $(KERNEL_BUILD_PATH)/.conf= ig $(BUILD_PATH)/init-cpio-spec.txt $(IPERF_PATH)/src/iperf3 $(IPUTILS_PATH= )/ping $(BASH_PATH)/bash $(IPROUTE2_PATH)/misc/ss $(IPROUTE2_PATH)/ip/ip $(= IPTABLES_PATH)/iptables/xtables-legacy-multi $(NMAP_PATH)/ncat/ncat $(WIREG= UARD_TOOLS_PATH)/src/wg $(BUILD_PATH)/init $(MAKE) -C $(KERNEL_PATH) O=3D$(KERNEL_BUILD_PATH) ARCH=3D$(KERNEL_ARCH) = CROSS_COMPILE=3D$(CROSS_COMPILE) +.PHONY: $(KERNEL_BZIMAGE) =20 $(TOOLCHAIN_PATH)/$(CHOST)/include/linux/.installed: | $(KERNEL_BUILD_PATH= )/.config $(TOOLCHAIN_PATH)/.installed rm -rf $(TOOLCHAIN_PATH)/$(CHOST)/include/linux From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D040FC433EF for ; Tue, 19 Jul 2022 13:11:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243280AbiGSNLZ (ORCPT ); Tue, 19 Jul 2022 09:11:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243747AbiGSNKC (ORCPT ); Tue, 19 Jul 2022 09:10:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB088BE9C9; Tue, 19 Jul 2022 05:29:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BF1FDB81B36; Tue, 19 Jul 2022 12:28:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C0DFC341E1; Tue, 19 Jul 2022 12:28:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233725; bh=nQi9RB25GGm8P7PTykvb/Fc9tZW70hCSsCObgN3eCgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0oaapAl8ZySOcjGAYh1FY6tyqQndHp6clpZUhDlULqFnQB9w6WlE3rRyxG9WJsesp kylmNqoFsHJNfSicJnx/3Xb3awh3eo5iffs4BGfCGJ+uOTMeC74Vx/3MaYVqAztLA1 J2jEZktc/EfkrQKbWa3W4Gc3ZD9hF8+CQZ3VClbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , Sasha Levin Subject: [PATCH 5.18 220/231] signal handling: dont use BUG_ON() for debugging Date: Tue, 19 Jul 2022 13:55:05 +0200 Message-Id: <20220719114732.255929029@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Torvalds [ Upstream commit a382f8fee42ca10c9bfce0d2352d4153f931f5dc ] These are indeed "should not happen" situations, but it turns out recent changes made the 'task_is_stopped_or_trace()' case trigger (fix for that exists, is pending more testing), and the BUG_ON() makes it unnecessarily hard to actually debug for no good reason. It's been that way for a long time, but let's make it clear: BUG_ON() is not good for debugging, and should never be used in situations where you could just say "this shouldn't happen, but we can continue". Use WARN_ON_ONCE() instead to make sure it gets logged, and then just continue running. Instead of making the system basically unusuable because you crashed the machine while potentially holding some very core locks (eg this function is commonly called while holding 'tasklist_lock' for writing). Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/signal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/kernel/signal.c +++ b/kernel/signal.c @@ -2031,12 +2031,12 @@ bool do_notify_parent(struct task_struct bool autoreap =3D false; u64 utime, stime; =20 - BUG_ON(sig =3D=3D -1); + WARN_ON_ONCE(sig =3D=3D -1); =20 - /* do_notify_parent_cldstop should have been called instead. */ - BUG_ON(task_is_stopped_or_traced(tsk)); + /* do_notify_parent_cldstop should have been called instead. */ + WARN_ON_ONCE(task_is_stopped_or_traced(tsk)); =20 - BUG_ON(!tsk->ptrace && + WARN_ON_ONCE(!tsk->ptrace && (tsk->group_leader !=3D tsk || !thread_group_empty(tsk))); =20 /* Wake up all pidfd waiters */ From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3684C433EF for ; Tue, 19 Jul 2022 13:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243383AbiGSNLf (ORCPT ); Tue, 19 Jul 2022 09:11:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243224AbiGSNK2 (ORCPT ); Tue, 19 Jul 2022 09:10:28 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EB8C65541; Tue, 19 Jul 2022 05:29:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 4F5FBCE1B7D; Tue, 19 Jul 2022 12:28:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F985C341D1; Tue, 19 Jul 2022 12:28:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233728; bh=6egDnfLx31jfxdqK3K+JaWDNB/se+vJa4Ry3gxod+sg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0fn3ByTBxrcyZe3cIXWLpu2riu9pOx3Suh+1EI06WJ5oz6ZHfDNN8xzmxXh9fJfL5 s/zsizzPu2gBGRQsvly4nq2CqwgtuPR4PENklwgQWy7FROV2Odb5yp/T4zZVsFuXqR mCU0tW+1TiCBE8UHevtX0PeqFlgwjUk6oshxztg0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , "Rafael J. Wysocki" , Sasha Levin , Ben Greening Subject: [PATCH 5.18 221/231] ACPI: video: Fix acpi_video_handles_brightness_key_presses() Date: Tue, 19 Jul 2022 13:55:06 +0200 Message-Id: <20220719114732.326909106@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 5ad26161a371e4aa2d2553286f0cac580987a493 ] Commit 3a0cf7ab8df3 ("ACPI: video: Change how we determine if brightness key-presses are handled") made acpi_video_handles_brightness_key_presses() report false when none of the ACPI Video Devices support backlight control. But it turns out that at least on a Dell Inspiron N4010 there is no ACPI backlight control, yet brightness hotkeys are still reported through the ACPI Video Bus; and since acpi_video_handles_brightness_key_presses() now returns false, brightness keypresses are now reported twice. To fix this rename the has_backlight flag to may_report_brightness_keys and also set it the first time a brightness key press event is received. Depending on the delivery of the other ACPI (WMI) event vs the ACPI Video Bus event this means that the first brightness key press might still get reported twice, but all further keypresses will be filtered as before. Note that this relies on other drivers reporting brightness key events calling acpi_video_handles_brightness_key_presses() when delivering the events (rather then once during driver probe). This is already required and documented in include/acpi/video.h: /* * Note: The value returned by acpi_video_handles_brightness_key_presses() * may change over time and should not be cached. */ Fixes: 3a0cf7ab8df3 ("ACPI: video: Change how we determine if brightness ke= y-presses are handled") Link: https://lore.kernel.org/regressions/CALF=3D6jEe5G8+r1Wo0vvz4GjNQQhdkL= T5p8uCHn6ZXhg4nsOWow@mail.gmail.com/ Reported-and-tested-by: Ben Greening Signed-off-by: Hans de Goede Acked-by: Rafael J. Wysocki Link: https://lore.kernel.org/r/20220713211101.85547-2-hdegoede@redhat.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/acpi/acpi_video.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -73,7 +73,7 @@ module_param(device_id_scheme, bool, 044 static int only_lcd =3D -1; module_param(only_lcd, int, 0444); =20 -static bool has_backlight; +static bool may_report_brightness_keys; static int register_count; static DEFINE_MUTEX(register_count_mutex); static DEFINE_MUTEX(video_list_lock); @@ -1224,7 +1224,7 @@ acpi_video_bus_get_one_device(struct acp acpi_video_device_find_cap(data); =20 if (data->cap._BCM && data->cap._BCL) - has_backlight =3D true; + may_report_brightness_keys =3D true; =20 mutex_lock(&video->device_list_lock); list_add_tail(&data->entry, &video->video_device_list); @@ -1693,6 +1693,9 @@ static void acpi_video_device_notify(acp break; } =20 + if (keycode) + may_report_brightness_keys =3D true; + acpi_notifier_call_chain(device, event, 0); =20 if (keycode && (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS)) { @@ -2254,7 +2257,7 @@ void acpi_video_unregister(void) if (register_count) { acpi_bus_unregister_driver(&acpi_video_bus); register_count =3D 0; - has_backlight =3D false; + may_report_brightness_keys =3D false; } mutex_unlock(®ister_count_mutex); } @@ -2276,7 +2279,7 @@ void acpi_video_unregister_backlight(voi =20 bool acpi_video_handles_brightness_key_presses(void) { - return has_backlight && + return may_report_brightness_keys && (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS); } EXPORT_SYMBOL(acpi_video_handles_brightness_key_presses); From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC8CDC433EF for ; Tue, 19 Jul 2022 13:11:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243255AbiGSNLU (ORCPT ); Tue, 19 Jul 2022 09:11:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243686AbiGSNJ4 (ORCPT ); Tue, 19 Jul 2022 09:09:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D5A556B86; Tue, 19 Jul 2022 05:28:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0571FB81B21; Tue, 19 Jul 2022 12:28:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D807C341E0; Tue, 19 Jul 2022 12:28:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233731; bh=uWP81HW1luT6RyI7hLaOnr6CpVhKPPiiN3KFfDvXEsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nGnZ3RYxKgipMN9htLsw/YCrMSz1fr+mQSWqgI35HSUh5eXbo90Q6OYCr5M0tG5EO YKdtj0ilsLouUIZydAzvoAsgEG+9NcbdcpD/fQGWAi8gg+LHOvdE/74M32HyAxmyjd OIyJZ4IIsnQWt/+GpUnX+c4V2z8PKBwb7/F/o0es= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Yangxi Xiang Subject: [PATCH 5.18 222/231] vt: fix memory overlapping when deleting chars in the buffer Date: Tue, 19 Jul 2022 13:55:07 +0200 Message-Id: <20220719114732.396393046@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yangxi Xiang commit 39cdb68c64d84e71a4a717000b6e5de208ee60cc upstream. A memory overlapping copy occurs when deleting a long line. This memory overlapping copy can cause data corruption when scr_memcpyw is optimized to memcpy because memcpy does not ensure its behavior if the destination buffer overlaps with the source buffer. The line buffer is not always broken, because the memcpy utilizes the hardware acceleration, whose result is not deterministic. Fix this problem by using replacing the scr_memcpyw with scr_memmovew. Fixes: 81732c3b2fed ("tty vt: Fix line garbage in virtual console on comman= d line edition") Cc: stable Signed-off-by: Yangxi Xiang Link: https://lore.kernel.org/r/20220628093322.5688-1-xyangxi5@gmail.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -855,7 +855,7 @@ static void delete_char(struct vc_data * unsigned short *p =3D (unsigned short *) vc->vc_pos; =20 vc_uniscr_delete(vc, nr); - scr_memcpyw(p, p + nr, (vc->vc_cols - vc->state.x - nr) * 2); + scr_memmovew(p, p + nr, (vc->vc_cols - vc->state.x - nr) * 2); scr_memsetw(p + vc->vc_cols - vc->state.x - nr, vc->vc_video_erase_char, nr * 2); vc->vc_need_wrap =3D 0; From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC25AC43334 for ; Tue, 19 Jul 2022 13:11:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243404AbiGSNLq (ORCPT ); Tue, 19 Jul 2022 09:11:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243275AbiGSNKc (ORCPT ); Tue, 19 Jul 2022 09:10:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EF3366AEF; Tue, 19 Jul 2022 05:29:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 89BEB60F15; Tue, 19 Jul 2022 12:28:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E35FC385A2; Tue, 19 Jul 2022 12:28:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233734; bh=qx4xm5yB/uhM5uj3Y8fS4RBO/otc/xo2/h0TR2koJiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z7MBPhbjNK0x10Cg+tD6W9yjcBiF0Q4tlslGHSp4hdKVNm3Z8yqSOtng6RdhhV2CW FO4n6LXhanXI5QnbX2a2ujQS8SGacuF2X3C9NowXC7mbhZZRg8FaZv/c8ITcoDICQl Z3O93rDFFz33cQGJj15RAnXMAM42pnUNdAzJUaDY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tony Krowiak , Harald Freudenberger , Alexander Gordeev Subject: [PATCH 5.18 223/231] s390/ap: fix error handling in __verify_queue_reservations() Date: Tue, 19 Jul 2022 13:55:08 +0200 Message-Id: <20220719114732.468219291@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tony Krowiak commit 2f23256c0ea20627c91ea2d468cda945f68c3395 upstream. The AP bus's __verify_queue_reservations function increments the ref count for the device driver passed in as a parameter, but fails to decrement it before returning control to the caller. This will prevents any subsequent removal of the module. Signed-off-by: Tony Krowiak Reported-by: Tony Krowiak Reviewed-by: Harald Freudenberger Fixes: 4f8206b88286 ("s390/ap: driver callback to indicate resource in use") Link: https://lore.kernel.org/r/20220706222619.602094-1-akrowiak@linux.ibm.= com Cc: stable@vger.kernel.org [agordeev@linux.ibm.com fixed description, added Fixes and Link] Signed-off-by: Alexander Gordeev Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/s390/crypto/ap_bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c @@ -1410,7 +1410,7 @@ static int __verify_queue_reservations(s if (ap_drv->in_use) { rc =3D ap_drv->in_use(ap_perms.apm, newaqm); if (rc) - return -EBUSY; + rc =3D -EBUSY; } =20 /* release the driver's module */ From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53343C43334 for ; Tue, 19 Jul 2022 13:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242854AbiGSNLj (ORCPT ); Tue, 19 Jul 2022 09:11:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243256AbiGSNKb (ORCPT ); Tue, 19 Jul 2022 09:10:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 589CB66AE6; Tue, 19 Jul 2022 05:29:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D45AEB81B29; Tue, 19 Jul 2022 12:28:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47A65C341CF; Tue, 19 Jul 2022 12:28:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233737; bh=R9Q4XuOpLZEJ+9h3KSB3O61IiWX3lDtzEd0A+CAwXhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2ctSLlvWQKp1tLb+KRhPV5FwUJzPlhuc6ot1Z7ijPztW54DEcrqfOczcbbZj4BmEP u7dmxBhysMza5YzC09/79wHNdKV1PzRX8Hxy45uPoNGJnRvIqRoIX3mx8gTC23F4kz pV6l836CQBgDVfZ7kp5sNYffRbBhQ4SIWgIf+FUA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Limonciello , "Rafael J. Wysocki" , Oleksandr Natalenko Subject: [PATCH 5.18 224/231] ACPI: CPPC: Fix enabling CPPC on AMD systems with shared memory Date: Tue, 19 Jul 2022 13:55:09 +0200 Message-Id: <20220719114732.537637737@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mario Limonciello commit fbd74d16890b9f5d08ea69b5282b123c894f8860 upstream. When commit 72f2ecb7ece7 ("ACPI: bus: Set CPPC _OSC bits for all and when CPPC_LIB is supported") was introduced, we found collateral damage that a number of AMD systems that supported CPPC but didn't advertise support in _OSC stopped having a functional amd-pstate driver. The _OSC was only enforced on Intel systems at that time. This was fixed for the MSR based designs by commit 8b356e536e69f ("ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported") but some shared memory based designs also support CPPC but haven't advertised support in the _OSC. Add support for those designs as well by hardcoding the list of systems. Fixes: 72f2ecb7ece7 ("ACPI: bus: Set CPPC _OSC bits for all and when CPPC_L= IB is supported") Fixes: 8b356e536e69f ("ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC i= s supported") Link: https://lore.kernel.org/all/3559249.JlDtxWtqDm@natalenko.name/ Cc: 5.18+ # 5.18+ Reported-and-tested-by: Oleksandr Natalenko Signed-off-by: Mario Limonciello Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/x86/kernel/acpi/cppc.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/arch/x86/kernel/acpi/cppc.c +++ b/arch/x86/kernel/acpi/cppc.c @@ -16,6 +16,12 @@ bool cpc_supported_by_cpu(void) switch (boot_cpu_data.x86_vendor) { case X86_VENDOR_AMD: case X86_VENDOR_HYGON: + if (boot_cpu_data.x86 =3D=3D 0x19 && ((boot_cpu_data.x86_model <=3D 0x0f= ) || + (boot_cpu_data.x86_model >=3D 0x20 && boot_cpu_data.x86_model <=3D 0= x2f))) + return true; + else if (boot_cpu_data.x86 =3D=3D 0x17 && + boot_cpu_data.x86_model >=3D 0x70 && boot_cpu_data.x86_model <=3D 0x7f) + return true; return boot_cpu_has(X86_FEATURE_CPPC); } return false; From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D4E8C43334 for ; Tue, 19 Jul 2022 13:11:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243397AbiGSNLn (ORCPT ); Tue, 19 Jul 2022 09:11:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243273AbiGSNKc (ORCPT ); Tue, 19 Jul 2022 09:10:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84BFE66B8E; Tue, 19 Jul 2022 05:29:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4009A609FB; Tue, 19 Jul 2022 12:29:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F550C341CA; Tue, 19 Jul 2022 12:28:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233740; bh=tLk+p/g49vY+tVdwv0pS3PzScQbStlHBTOc0hXY0tM8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pCfEv/hlp09VXfRoAY1MQOMoudN/Slfo/7EMN0SExG6gdvGKPjTx3Ty910fROxZ/U dBgaPD42+tuYXhQ+RDs9XyFmPLBTQpSo991HEDlj+DYKMj1XTXP0O7tI49MHBg2ZNd vXiZ7FqRL0SXWHhgfIqNMYH5u7p6eER3+sHdPGTU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yi Yang , stable Subject: [PATCH 5.18 225/231] serial: 8250: fix return error code in serial8250_request_std_resource() Date: Tue, 19 Jul 2022 13:55:10 +0200 Message-Id: <20220719114732.609107397@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yi Yang commit 6e690d54cfa802f939cefbd2fa2c91bd0b8bd1b6 upstream. If port->mapbase =3D NULL in serial8250_request_std_resource() , it need return a error code instead of 0. If uart_set_info() fail to request new regions by serial8250_request_std_resource() but the return value of serial8250_request_std_resource() is 0, The system incorrectly considers that the resource application is successful and does not attempt to restore the old setting. A null pointer reference is triggered when the port resource is later invoked. Signed-off-by: Yi Yang Cc: stable Link: https://lore.kernel.org/r/20220628083515.64138-1-yiyang13@huawei.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/serial/8250/8250_port.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2971,8 +2971,10 @@ static int serial8250_request_std_resour case UPIO_MEM32BE: case UPIO_MEM16: case UPIO_MEM: - if (!port->mapbase) + if (!port->mapbase) { + ret =3D -EINVAL; break; + } =20 if (!request_mem_region(port->mapbase, size, "serial")) { ret =3D -EBUSY; From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F41EFCCA47F for ; Tue, 19 Jul 2022 13:12:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243424AbiGSNMM (ORCPT ); Tue, 19 Jul 2022 09:12:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236230AbiGSNLA (ORCPT ); Tue, 19 Jul 2022 09:11:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69FFA51A31; Tue, 19 Jul 2022 05:29:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 99001B81B38; Tue, 19 Jul 2022 12:29:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0318BC341C6; Tue, 19 Jul 2022 12:29:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233743; bh=1BDzNVibBPwFTetTxO2mma3rWVto3LwloxGADTvjfGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qDvjBsWb6FRGTZoGhIUO9PmZMg/kgFIvKpZXUkhsCY0ZDJaxMJmhrR2KJqGqejUO0 TII6rds7aLtLKkFb2FmJbeacAivQEhKvRbChKY082XZiY9FMSh6xlZjstksqEav5Pr CYuQRbTTklkxfTCutTpLt/jBDPXBaCSmATiqIx2c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dorian Rudolph , Linus Walleij , Sebastian Reichel Subject: [PATCH 5.18 226/231] power: supply: core: Fix boundary conditions in interpolation Date: Tue, 19 Jul 2022 13:55:11 +0200 Message-Id: <20220719114732.683402476@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dorian Rudolph commit 093d27bb6f2d1963f927ef59c9a2d37059175426 upstream. The functions power_supply_temp2resist_simple and power_supply_ocv2cap_simp= le handle boundary conditions incorrectly. The change was introduced in a4585ba2050f460f749bbaf2b67bd56c41e30283 ("power: supply: core: Use library interpolation"). There are two issues: First, the lines "high =3D i - 1" and "high =3D i" in= ocv2cap have the wrong order compared to temp2resist. As a consequence, ocv2cap sets high=3D-1 if ocv>table[0].ocv, which causes an out-of-bounds read. Second, the logic of temp2resist is also not correct. Consider the case table[] =3D {{20, 100}, {10, 80}, {0, 60}}. For temp=3D5, we expect a resistance of 70% by interpolation. However, temp2resist sets high=3Dlow=3D2 and returns 60. Cc: stable@vger.kernel.org Signed-off-by: Dorian Rudolph Reviewed-by: Linus Walleij Fixes: a4585ba2050f ("power: supply: core: Use library interpolation") Signed-off-by: Sebastian Reichel Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/power/supply/power_supply_core.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -846,17 +846,17 @@ int power_supply_temp2resist_simple(stru { int i, high, low; =20 - /* Break loop at table_len - 1 because that is the highest index */ - for (i =3D 0; i < table_len - 1; i++) + for (i =3D 0; i < table_len; i++) if (temp > table[i].temp) break; =20 /* The library function will deal with high =3D=3D low */ - if ((i =3D=3D 0) || (i =3D=3D (table_len - 1))) - high =3D i; + if (i =3D=3D 0) + high =3D low =3D i; + else if (i =3D=3D table_len) + high =3D low =3D i - 1; else - high =3D i - 1; - low =3D i; + high =3D (low =3D i) - 1; =20 return fixp_linear_interpolate(table[low].temp, table[low].resistance, @@ -958,17 +958,17 @@ int power_supply_ocv2cap_simple(struct p { int i, high, low; =20 - /* Break loop at table_len - 1 because that is the highest index */ - for (i =3D 0; i < table_len - 1; i++) + for (i =3D 0; i < table_len; i++) if (ocv > table[i].ocv) break; =20 /* The library function will deal with high =3D=3D low */ - if ((i =3D=3D 0) || (i =3D=3D (table_len - 1))) - high =3D i - 1; + if (i =3D=3D 0) + high =3D low =3D i; + else if (i =3D=3D table_len) + high =3D low =3D i - 1; else - high =3D i; /* i.e. i =3D=3D 0 */ - low =3D i; + high =3D (low =3D i) - 1; =20 return fixp_linear_interpolate(table[low].ocv, table[low].capacity, From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FD02CCA483 for ; Tue, 19 Jul 2022 13:12:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236230AbiGSNMQ (ORCPT ); Tue, 19 Jul 2022 09:12:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243218AbiGSNLC (ORCPT ); Tue, 19 Jul 2022 09:11:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D5E766AF8; Tue, 19 Jul 2022 05:29:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0DC3C60DE0; Tue, 19 Jul 2022 12:29:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E30FEC341C6; Tue, 19 Jul 2022 12:29:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233746; bh=9KEe7eaXtbhE+qjwrjNHYCHBExGftwM90ceOhxQI7wc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MWXVXfpwcfek7tygYXCw4aokQxDwWTFp2gI7v6HilPd/+R0/fsXsaVnMJnUE7XBUQ bqnL9HYoHyS4HgLjgi0Qt4hM5uzj9zhm7z+nTUbLJYwMrakvs3Jo1PCkjGTUMvSlQl /lwjCqowXCIwjgkSNEd/k7LTL7l6QiiJ1c1nGjCc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.18 227/231] serial: stm32: Clear prev values before setting RTS delays Date: Tue, 19 Jul 2022 13:55:12 +0200 Message-Id: <20220719114732.755608024@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen commit 5c5f44e36217de5ead789ff25da71c31c2331c96 upstream. The code lacks clearing of previous DEAT/DEDT values. Thus, changing values on the fly results in garbage delays tending towards the maximum value as more and more bits are ORed together. (Leaving RS485 mode would have cleared the old values though). Fixes: 1bcda09d2910 ("serial: stm32: add support for RS485 hardware control= mode") Cc: stable Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/20220627150753.34510-1-ilpo.jarvinen@linux.= intel.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/serial/stm32-usart.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -71,6 +71,8 @@ static void stm32_usart_config_reg_rs485 *cr3 |=3D USART_CR3_DEM; over8 =3D *cr1 & USART_CR1_OVER8; =20 + *cr1 &=3D ~(USART_CR1_DEDT_MASK | USART_CR1_DEAT_MASK); + if (over8) rs485_deat_dedt =3D delay_ADE * baud * 8; else From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B09BCCA483 for ; Tue, 19 Jul 2022 13:12:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243215AbiGSNMJ (ORCPT ); Tue, 19 Jul 2022 09:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237103AbiGSNK7 (ORCPT ); Tue, 19 Jul 2022 09:10:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D37BBE9FF; Tue, 19 Jul 2022 05:29:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 68E53B81B36; Tue, 19 Jul 2022 12:29:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7945C341CB; Tue, 19 Jul 2022 12:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233749; bh=UP3Lic+jp34ATbqPhzcUBziTW/x8lbvrWY43VZs5Jl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DO1VbNjdoRmCXeloJntQT5ORwzz1Xah+u5hVpMLfeaP5op327EyPFN0SrW+Gr18bN xsbivJZITfrwl34DiYGXXNqb3GuvPz7RkNefVZxVc1m0lviUPkBAuh9ZLZQI7VuKIF 05g35W/kc1CK7HXMamNo1o/BGkaRa8HlqC3hHlPk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Lukas Wunner , =?UTF-8?q?Nuno=20Gon=C3=A7alves?= , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.18 228/231] serial: pl011: UPSTAT_AUTORTS requires .throttle/unthrottle Date: Tue, 19 Jul 2022 13:55:13 +0200 Message-Id: <20220719114732.825824668@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen commit 211565b100993c90b53bf40851eacaefc830cfe0 upstream. The driver must provide throttle and unthrottle in uart_ops when it sets UPSTAT_AUTORTS. Add them using existing stop_rx & enable_interrupts functions. Fixes: 2a76fa283098 (serial: pl011: Adopt generic flag to store auto RTS st= atus) Cc: stable Cc: Lukas Wunner Reported-by: Nuno Gon=C3=A7alves Tested-by: Nuno Gon=C3=A7alves Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/20220614075637.8558-1-ilpo.jarvinen@linux.i= ntel.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/serial/amba-pl011.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -1339,6 +1339,15 @@ static void pl011_stop_rx(struct uart_po pl011_dma_rx_stop(uap); } =20 +static void pl011_throttle_rx(struct uart_port *port) +{ + unsigned long flags; + + spin_lock_irqsave(&port->lock, flags); + pl011_stop_rx(port); + spin_unlock_irqrestore(&port->lock, flags); +} + static void pl011_enable_ms(struct uart_port *port) { struct uart_amba_port *uap =3D @@ -1760,9 +1769,10 @@ static int pl011_allocate_irq(struct uar */ static void pl011_enable_interrupts(struct uart_amba_port *uap) { + unsigned long flags; unsigned int i; =20 - spin_lock_irq(&uap->port.lock); + spin_lock_irqsave(&uap->port.lock, flags); =20 /* Clear out any spuriously appearing RX interrupts */ pl011_write(UART011_RTIS | UART011_RXIS, uap, REG_ICR); @@ -1784,7 +1794,14 @@ static void pl011_enable_interrupts(stru if (!pl011_dma_rx_running(uap)) uap->im |=3D UART011_RXIM; pl011_write(uap->im, uap, REG_IMSC); - spin_unlock_irq(&uap->port.lock); + spin_unlock_irqrestore(&uap->port.lock, flags); +} + +static void pl011_unthrottle_rx(struct uart_port *port) +{ + struct uart_amba_port *uap =3D container_of(port, struct uart_amba_port, = port); + + pl011_enable_interrupts(uap); } =20 static int pl011_startup(struct uart_port *port) @@ -2211,6 +2228,8 @@ static const struct uart_ops amba_pl011_ .stop_tx =3D pl011_stop_tx, .start_tx =3D pl011_start_tx, .stop_rx =3D pl011_stop_rx, + .throttle =3D pl011_throttle_rx, + .unthrottle =3D pl011_unthrottle_rx, .enable_ms =3D pl011_enable_ms, .break_ctl =3D pl011_break_ctl, .startup =3D pl011_startup, From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AB4EC43334 for ; Tue, 19 Jul 2022 13:12:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243290AbiGSNMU (ORCPT ); Tue, 19 Jul 2022 09:12:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243221AbiGSNLL (ORCPT ); Tue, 19 Jul 2022 09:11:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABC0F8C3C6; Tue, 19 Jul 2022 05:29:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 36693B81B21; Tue, 19 Jul 2022 12:29:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81C47C341C6; Tue, 19 Jul 2022 12:29:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233754; bh=CRJRpp6HYI9IZVUxtigR245gvKwT9UDBJ2BGUwD1Fu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Up76I3z+7TprA6CuxM+bMW5Eex4vNMZPtS2DJXAErR224tynlOztBx2mf8eqejXQd a3jhKAYT5vkbKgtSK9VdkOw09Rr+3Q+H1pj4b7Pid6L03r66AyiV9Kc2vauRZUPwmo Zt+9wf8oBLRxuv3Y44wiz9cOrJ5H7lzLJuf7JXCI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Tony Lindgren , Andy Shevchenko , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.18 229/231] serial: 8250: Fix PM usage_count for console handover Date: Tue, 19 Jul 2022 13:55:14 +0200 Message-Id: <20220719114732.899303572@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen commit f9b11229b79c0fb2100b5bb4628a101b1d37fbf6 upstream. When console is enabled, univ8250_console_setup() calls serial8250_console_setup() before .dev is set to uart_port. Therefore, it will not call pm_runtime_get_sync(). Later, when the actual driver is going to take over univ8250_console_exit() is called. As .dev is already set, serial8250_console_exit() makes pm_runtime_put_sync() call with usage count being zero triggering PM usage count warning (extra debug for univ8250_console_setup(), univ8250_console_exit(), and serial8250_register_ports()): [ 0.068987] univ8250_console_setup ttyS0 nodev [ 0.499670] printk: console [ttyS0] enabled [ 0.717955] printk: console [ttyS0] printing thread started [ 1.960163] serial8250_register_ports assigned dev for ttyS0 [ 1.976830] printk: console [ttyS0] disabled [ 1.976888] printk: console [ttyS0] printing thread stopped [ 1.977073] univ8250_console_exit ttyS0 usage:0 [ 1.977075] serial8250 serial8250: Runtime PM usage count underflow! [ 1.977429] dw-apb-uart.6: ttyS0 at MMIO 0x4010006000 (irq =3D 33, base_= baud =3D 115200) is a 16550A [ 1.977812] univ8250_console_setup ttyS0 usage:2 [ 1.978167] printk: console [ttyS0] printing thread started [ 1.978203] printk: console [ttyS0] enabled To fix the issue, call pm_runtime_get_sync() in serial8250_register_ports() as soon as .dev is set for an uart_port if it has console enabled. This problem became apparent only recently because 82586a721595 ("PM: runtime: Avoid device usage count underflows") added the warning printout. I confirmed this problem also occurs with v5.18 (w/o the warning printout, obviously). Fixes: bedb404e91bb ("serial: 8250_port: Don't use power management for ker= nel console") Cc: stable Tested-by: Tony Lindgren Reviewed-by: Andy Shevchenko Reviewed-by: Tony Lindgren Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/b4f428e9-491f-daf2-2232-819928dc276e@linux.= intel.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/serial/8250/8250_core.c | 4 ++++ drivers/tty/serial/serial_core.c | 5 ----- include/linux/serial_core.h | 5 +++++ 3 files changed, 9 insertions(+), 5 deletions(-) --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -560,6 +561,9 @@ serial8250_register_ports(struct uart_dr =20 up->port.dev =3D dev; =20 + if (uart_console_enabled(&up->port)) + pm_runtime_get_sync(up->port.dev); + serial8250_apply_quirks(up); uart_add_one_port(drv, &up->port); } --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1904,11 +1904,6 @@ static int uart_proc_show(struct seq_fil } #endif =20 -static inline bool uart_console_enabled(struct uart_port *port) -{ - return uart_console(port) && (port->cons->flags & CON_ENABLED); -} - static void uart_port_spin_lock_init(struct uart_port *port) { spin_lock_init(&port->lock); --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -388,6 +388,11 @@ static const bool earlycon_acpi_spcr_ena static inline int setup_earlycon(char *buf) { return 0; } #endif =20 +static inline bool uart_console_enabled(struct uart_port *port) +{ + return uart_console(port) && (port->cons->flags & CON_ENABLED); +} + struct uart_port *uart_get_console(struct uart_port *ports, int nr, struct console *c); int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *a= ddr, From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0F51C433EF for ; Tue, 19 Jul 2022 13:12:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243445AbiGSNM2 (ORCPT ); Tue, 19 Jul 2022 09:12:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243381AbiGSNLa (ORCPT ); Tue, 19 Jul 2022 09:11:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E49F51A33; Tue, 19 Jul 2022 05:29:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6FC3760693; Tue, 19 Jul 2022 12:29:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52A4DC341C6; Tue, 19 Jul 2022 12:29:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233757; bh=nEJuKUP5wKVEzPwcC7gagL5tqUtbfcGdK91R5O8E0zM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2tVAyJweBsPFWPTFYXhMrst3CxsF5HhKAb3B7OYtITChrG1KEQM7hrT3gA5Zuf8dD Ph2ttowz5TWX6b+4GGKhX/cvcJQ8xHRZiEMiRlE/pg7JkKLxzUzla/kL29jhjHlHTA AOBV+4mEK7PC5MHd28nn0Ho0jVpB93N8ho/U+VA8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH 5.18 230/231] serial: mvebu-uart: correctly report configured baudrate value Date: Tue, 19 Jul 2022 13:55:15 +0200 Message-Id: <20220719114732.969474264@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Roh=C3=A1r commit 4f532c1e25319e42996ec18a1f473fd50c8e575d upstream. Functions tty_termios_encode_baud_rate() and uart_update_timeout() should be called with the baudrate value which was set to hardware. Linux then report exact values via ioctl(TCGETS2) to userspace. Change mvebu_uart_baud_rate_set() function to return baudrate value which was set to hardware and propagate this value to above mentioned functions. With this change userspace would see precise value in termios c_ospeed field. Fixes: 68a0db1d7da2 ("serial: mvebu-uart: add function to change baudrate") Cc: stable Reviewed-by: Ilpo J=C3=A4rvinen Signed-off-by: Pali Roh=C3=A1r Link: https://lore.kernel.org/r/20220628100922.10717-1-pali@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/serial/mvebu-uart.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) --- a/drivers/tty/serial/mvebu-uart.c +++ b/drivers/tty/serial/mvebu-uart.c @@ -470,14 +470,14 @@ static void mvebu_uart_shutdown(struct u } } =20 -static int mvebu_uart_baud_rate_set(struct uart_port *port, unsigned int b= aud) +static unsigned int mvebu_uart_baud_rate_set(struct uart_port *port, unsig= ned int baud) { unsigned int d_divisor, m_divisor; unsigned long flags; u32 brdv, osamp; =20 if (!port->uartclk) - return -EOPNOTSUPP; + return 0; =20 /* * The baudrate is derived from the UART clock thanks to divisors: @@ -548,7 +548,7 @@ static int mvebu_uart_baud_rate_set(stru (m_divisor << 16) | (m_divisor << 24); writel(osamp, port->membase + UART_OSAMP); =20 - return 0; + return DIV_ROUND_CLOSEST(port->uartclk, d_divisor * m_divisor); } =20 static void mvebu_uart_set_termios(struct uart_port *port, @@ -587,15 +587,11 @@ static void mvebu_uart_set_termios(struc max_baud =3D port->uartclk / 80; =20 baud =3D uart_get_baud_rate(port, termios, old, min_baud, max_baud); - if (mvebu_uart_baud_rate_set(port, baud)) { - /* No clock available, baudrate cannot be changed */ - if (old) - baud =3D uart_get_baud_rate(port, old, NULL, - min_baud, max_baud); - } else { - tty_termios_encode_baud_rate(termios, baud, baud); - uart_update_timeout(port, termios->c_cflag, baud); - } + baud =3D mvebu_uart_baud_rate_set(port, baud); + + /* In case baudrate cannot be changed, report previous old value */ + if (baud =3D=3D 0 && old) + baud =3D tty_termios_baud_rate(old); =20 /* Only the following flag changes are supported */ if (old) { @@ -606,6 +602,11 @@ static void mvebu_uart_set_termios(struc termios->c_cflag |=3D CS8; } =20 + if (baud !=3D 0) { + tty_termios_encode_baud_rate(termios, baud, baud); + uart_update_timeout(port, termios->c_cflag, baud); + } + spin_unlock_irqrestore(&port->lock, flags); } =20 From nobody Sat Apr 18 02:46:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE9CDC433EF for ; Tue, 19 Jul 2022 13:12:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243374AbiGSNMk (ORCPT ); Tue, 19 Jul 2022 09:12:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243400AbiGSNLp (ORCPT ); Tue, 19 Jul 2022 09:11:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27C7C67150; Tue, 19 Jul 2022 05:29:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D3D43B81B21; Tue, 19 Jul 2022 12:29:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 433F8C341C6; Tue, 19 Jul 2022 12:29:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233760; bh=Fm0XoAuR/C5k+pGRAD6n+2LWPADIxJcnFfg1OhMEkMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q5BY67Eme6ztho3/FDCXv0SS4R4raHi4uvQ4sdpASZ12A1Xj4jkQxdHNtwaCsSICO qg4YnoaUB689/xjUsYOamI0tztOUBoSfHsSFl12gN7WL61bn4j/LmCR9P+LH85cxWH d4IHw3yiC5M1fE68/V34ygt6rgA8nvigK4vGNwNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Borislav Petkov Subject: [PATCH 5.18 231/231] x86/pat: Fix x86_has_pat_wp() Date: Tue, 19 Jul 2022 13:55:16 +0200 Message-Id: <20220719114733.038516713@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Juergen Gross commit 230ec83d4299b30c51a1c133b4f2a669972cc08a upstream. x86_has_pat_wp() is using a wrong test, as it relies on the normal PAT configuration used by the kernel. In case the PAT MSR has been setup by another entity (e.g. Xen hypervisor) it might return false even if the PAT configuration is allowing WP mappings. This due to the fact that when running as Xen PV guest the PAT MSR is setup by the hypervisor and cannot be changed by the guest. This results in the WP related entry to be at a different position when running as Xen PV guest compared to the bare metal or fully virtualized case. The correct way to test for WP support is: 1. Get the PTE protection bits needed to select WP mode by reading __cachemode2pte_tbl[_PAGE_CACHE_MODE_WP] (depending on the PAT MSR setting this might return protection bits for a stronger mode, e.g. UC-) 2. Translate those bits back into the real cache mode selected by those PTE bits by reading __pte2cachemode_tbl[__pte2cm_idx(prot)] 3. Test for the cache mode to be _PAGE_CACHE_MODE_WP Fixes: f88a68facd9a ("x86/mm: Extend early_memremap() support with addition= al attrs") Signed-off-by: Juergen Gross Signed-off-by: Borislav Petkov Cc: # 4.14 Link: https://lore.kernel.org/r/20220503132207.17234-1-jgross@suse.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/x86/mm/init.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -77,10 +77,20 @@ static uint8_t __pte2cachemode_tbl[8] =3D [__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] =3D _PAGE_CACHE_MODE_UC, }; =20 -/* Check that the write-protect PAT entry is set for write-protect */ +/* + * Check that the write-protect PAT entry is set for write-protect. + * To do this without making assumptions how PAT has been set up (Xen has + * another layout than the kernel), translate the _PAGE_CACHE_MODE_WP cache + * mode via the __cachemode2pte_tbl[] into protection bits (those protecti= on + * bits will select a cache mode of WP or better), and then translate the + * protection bits back into the cache mode using __pte2cm_idx() and the + * __pte2cachemode_tbl[] array. This will return the really used cache mod= e. + */ bool x86_has_pat_wp(void) { - return __pte2cachemode_tbl[_PAGE_CACHE_MODE_WP] =3D=3D _PAGE_CACHE_MODE_W= P; + uint16_t prot =3D __cachemode2pte_tbl[_PAGE_CACHE_MODE_WP]; + + return __pte2cachemode_tbl[__pte2cm_idx(prot)] =3D=3D _PAGE_CACHE_MODE_WP; } =20 enum page_cache_mode pgprot2cachemode(pgprot_t pgprot)