From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5B61C433F5 for ; Mon, 24 Jan 2022 20:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380324AbiAXUQI (ORCPT ); Mon, 24 Jan 2022 15:16:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350854AbiAXTwN (ORCPT ); Mon, 24 Jan 2022 14:52:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CD33C041894; Mon, 24 Jan 2022 11:24:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 149D6B81215; Mon, 24 Jan 2022 19:24:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73E01C340E5; Mon, 24 Jan 2022 19:24:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052284; bh=vSGR6VHbNUyq1gjucRiTGoZ958d6JifO3hYpyr6RMI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rw13KTV1WO1xstTne2VLNndh+6o355KDHN0unho1se0EbP0FvsRxUOq6NqHsT2vLE 7PFGKvlwGfh46lNNmVIZegNzT6XNONbRtSiro6iRyCsm8ZMawtFMLkdg3DmgPdeUDn SJWBnVMoGUGZ8LMqFDpCpw4l6qE+pTbFG+tv7CxM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , Jiri Kosina Subject: [PATCH 5.4 001/320] HID: uhid: Fix worker destroying device without any protection Date: Mon, 24 Jan 2022 19:39:45 +0100 Message-Id: <20220124183953.802311933@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Jann Horn commit 4ea5763fb79ed89b3bdad455ebf3f33416a81624 upstream. uhid has to run hid_add_device() from workqueue context while allowing parallel use of the userspace API (which is protected with ->devlock). But hid_add_device() can fail. Currently, that is handled by immediately destroying the associated HID device, without using ->devlock - but if there are concurrent requests from userspace, that's wrong and leads to NULL dereferences and/or memory corruption (via use-after-free). Fix it by leaving the HID device as-is in the worker. We can clean it up later, either in the UHID_DESTROY command handler or in the ->release() handler. Cc: stable@vger.kernel.org Fixes: 67f8ecc550b5 ("HID: uhid: fix timeout when probe races with IO") Signed-off-by: Jann Horn Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/hid/uhid.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c @@ -28,11 +28,22 @@ =20 struct uhid_device { struct mutex devlock; + + /* This flag tracks whether the HID device is usable for commands from + * userspace. The flag is already set before hid_add_device(), which + * runs in workqueue context, to allow hid_add_device() to communicate + * with userspace. + * However, if hid_add_device() fails, the flag is cleared without + * holding devlock. + * We guarantee that if @running changes from true to false while you're + * holding @devlock, it's still fine to access @hid. + */ bool running; =20 __u8 *rd_data; uint rd_size; =20 + /* When this is NULL, userspace may use UHID_CREATE/UHID_CREATE2. */ struct hid_device *hid; struct uhid_event input_buf; =20 @@ -63,9 +74,18 @@ static void uhid_device_add_worker(struc if (ret) { hid_err(uhid->hid, "Cannot register HID device: error %d\n", ret); =20 - hid_destroy_device(uhid->hid); - uhid->hid =3D NULL; + /* We used to call hid_destroy_device() here, but that's really + * messy to get right because we have to coordinate with + * concurrent writes from userspace that might be in the middle + * of using uhid->hid. + * Just leave uhid->hid as-is for now, and clean it up when + * userspace tries to close or reinitialize the uhid instance. + * + * However, we do have to clear the ->running flag and do a + * wakeup to make sure userspace knows that the device is gone. + */ uhid->running =3D false; + wake_up_interruptible(&uhid->report_wait); } } =20 @@ -474,7 +494,7 @@ static int uhid_dev_create2(struct uhid_ void *rd_data; int ret; =20 - if (uhid->running) + if (uhid->hid) return -EALREADY; =20 rd_size =3D ev->u.create2.rd_size; @@ -556,7 +576,7 @@ static int uhid_dev_create(struct uhid_d =20 static int uhid_dev_destroy(struct uhid_device *uhid) { - if (!uhid->running) + if (!uhid->hid) return -EINVAL; =20 uhid->running =3D false; @@ -565,6 +585,7 @@ static int uhid_dev_destroy(struct uhid_ cancel_work_sync(&uhid->worker); =20 hid_destroy_device(uhid->hid); + uhid->hid =3D NULL; kfree(uhid->rd_data); =20 return 0; From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8D01C433EF for ; Mon, 24 Jan 2022 20:17:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380272AbiAXUQD (ORCPT ); Mon, 24 Jan 2022 15:16:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351604AbiAXTwN (ORCPT ); Mon, 24 Jan 2022 14:52:13 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD1A3C0617BC; Mon, 24 Jan 2022 11:25:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A67C61317; Mon, 24 Jan 2022 19:25:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B7F6C340E8; Mon, 24 Jan 2022 19:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052318; bh=3CEz9ODacc9jEscmMETRWxB3JPYlvQ03a39mjOKa3f8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T8yrmXqeQygU3F0W0YTnxdi66v0lrVjUr9YSbYVrjfGnKG9/Xoh5t6GVuA3zdN4GY +b2b3Lk3ThZbab3ND4IclJHFQcv1d7l/YrpbS06xFQGK4qNINsh/wtkGr/as1IqMtk lT/A4iV9GTBLFHQLPv6DdFJmjnAB7hRr5J5LZtW0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Gerecke , Ping Cheng , Jiri Kosina Subject: [PATCH 5.4 002/320] HID: wacom: Reset expected and received contact counts at the same time Date: Mon, 24 Jan 2022 19:39:46 +0100 Message-Id: <20220124183953.841108325@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Gerecke commit 546e41ac994cc185ef3de610ca849a294b5df3ba upstream. These two values go hand-in-hand and must be valid for the driver to behave correctly. We are currently lazy about updating the values and rely on the "expected" code flow to take care of making sure they're valid at the point they're needed. The "expected" flow changed somewhat with commit f8b6a74719b5 ("HID: wacom: generic: Support multiple tools per report"), however. This led to problems with the DTH-2452 due (in part) to *all* contacts being fully processed -- even those past the expected contact count. Specifically, the received count gets reset to 0 once all expected fingers are processed, but not the expected count. The rest of the contacts in the report are then *also* processed since now the driver thinks we've only processed 0 of N expected contacts. Later commits such as 7fb0413baa7f (HID: wacom: Use "Confidence" flag to prevent reporting invalid contacts) worked around the DTH-2452 issue by skipping the invalid contacts at the end of the report, but this is not a complete fix. The confidence flag cannot be relied on when a contact is removed (see the following patch), and dealing with that condition re-introduces the DTH-2452 issue unless we also address this contact count laziness. By resetting expected and received counts at the same time we ensure the driver understands that there are 0 more contacts expected in the report. Similarly, we also make sure to reset the received count if for some reason we're out of sync in the pre-report phase. Link: https://github.com/linuxwacom/input-wacom/issues/288 Fixes: f8b6a74719b5 ("HID: wacom: generic: Support multiple tools per repor= t") CC: stable@vger.kernel.org Signed-off-by: Jason Gerecke Reviewed-by: Ping Cheng Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/hid/wacom_wac.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2664,11 +2664,14 @@ static void wacom_wac_finger_pre_report( hid_data->cc_index >=3D 0) { struct hid_field *field =3D report->field[hid_data->cc_index]; int value =3D field->value[hid_data->cc_value_index]; - if (value) + if (value) { hid_data->num_expected =3D value; + hid_data->num_received =3D 0; + } } else { hid_data->num_expected =3D wacom_wac->features.touch_max; + hid_data->num_received =3D 0; } } =20 @@ -2692,6 +2695,7 @@ static void wacom_wac_finger_report(stru =20 input_sync(input); wacom_wac->hid_data.num_received =3D 0; + wacom_wac->hid_data.num_expected =3D 0; =20 /* keep touch state for pen event */ wacom_wac->shared->touch_down =3D wacom_wac_finger_count_touches(wacom_wa= c); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D24DFC4332F for ; Mon, 24 Jan 2022 20:11:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379015AbiAXUKN (ORCPT ); Mon, 24 Jan 2022 15:10:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348443AbiAXTwj (ORCPT ); Mon, 24 Jan 2022 14:52:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD9C4C0617BF; Mon, 24 Jan 2022 11:25:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5FBF4B8121A; Mon, 24 Jan 2022 19:25:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD212C340E7; Mon, 24 Jan 2022 19:25:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052334; bh=6d29mTJvh2GOvub6qrgiH29qIyJhZWECLVUAyxaXSJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LaKGyrb1NdfO6lnIcm1cwTF3hHa1ihBmw1/EX4p/I4k9EIJz+X1LxZeGmZmA8CRFM iAJzBf6RxpilPtYiLXLjsKH438OYU0ZNAMf0YuphWrq9Bq556uTaRFNHEI0dNZyUH5 0FhCfakh/Q7M4LrpBZ8lg3gKZ1b/cxSv77cq8Df4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Gerecke , Ping Cheng , Jiri Kosina Subject: [PATCH 5.4 003/320] HID: wacom: Ignore the confidence flag when a touch is removed Date: Mon, 24 Jan 2022 19:39:47 +0100 Message-Id: <20220124183953.873854390@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Gerecke commit df03e9bd6d4806619b4cdc91a3d7695818a8e2b7 upstream. AES hardware may internally re-classify a contact that it thought was intentional as a palm. Intentional contacts are reported as "down" with the confidence bit set. When this re-classification occurs, however, the state transitions to "up" with the confidence bit cleared. This kind of transition appears to be legal according to Microsoft docs, but we do not handle it correctly. Because the confidence bit is clear, we don't call `wacom_wac_finger_slot` and update userspace. This causes hung touches that confuse userspace and interfere with pen arbitration. This commit adds a special case to ignore the confidence flag if a contact is reported as removed. This ensures we do not leave a hung touch if one of these re-classification events occured. Ideally we'd have some way to also let userspace know that the touch has been re-classified as a palm and needs to be canceled, but that's not possible right now :) Link: https://github.com/linuxwacom/input-wacom/issues/288 Fixes: 7fb0413baa7f (HID: wacom: Use "Confidence" flag to prevent reporting= invalid contacts) CC: stable@vger.kernel.org Signed-off-by: Jason Gerecke Reviewed-by: Ping Cheng Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/hid/wacom_wac.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2566,6 +2566,24 @@ static void wacom_wac_finger_slot(struct } } =20 +static bool wacom_wac_slot_is_active(struct input_dev *dev, int key) +{ + struct input_mt *mt =3D dev->mt; + struct input_mt_slot *s; + + if (!mt) + return false; + + for (s =3D mt->slots; s !=3D mt->slots + mt->num_slots; s++) { + if (s->key =3D=3D key && + input_mt_get_value(s, ABS_MT_TRACKING_ID) >=3D 0) { + return true; + } + } + + return false; +} + static void wacom_wac_finger_event(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage, __s32 value) { @@ -2613,9 +2631,14 @@ static void wacom_wac_finger_event(struc } =20 if (usage->usage_index + 1 =3D=3D field->report_count) { - if (equivalent_usage =3D=3D wacom_wac->hid_data.last_slot_field && - wacom_wac->hid_data.confidence) - wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); + if (equivalent_usage =3D=3D wacom_wac->hid_data.last_slot_field) { + bool touch_removed =3D wacom_wac_slot_is_active(wacom_wac->touch_input, + wacom_wac->hid_data.id) && !wacom_wac->hid_data.tipswitch; + + if (wacom_wac->hid_data.confidence || touch_removed) { + wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); + } + } } } =20 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA5D8C433F5 for ; Mon, 24 Jan 2022 20:17:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377763AbiAXUOw (ORCPT ); Mon, 24 Jan 2022 15:14:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352150AbiAXTwn (ORCPT ); Mon, 24 Jan 2022 14:52:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6535DC061381; Mon, 24 Jan 2022 11:25:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E4F3861488; Mon, 24 Jan 2022 19:25:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A55B7C340E5; Mon, 24 Jan 2022 19:25:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052337; bh=fyqEQBVglc5pdAIBij1r7tV5jKgJ1Mfni7cnBdPz3dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MM5akitkQN9hd2gubWWeA5UMJgbJSY+tyBIExE7cVNYXK+KhRDFRPGOS0hWz/yKf1 mNA85o7ATQPdOpzyC0Ze+Jw+X3j3oH1l4wsSEEI/s0/qSyCgM8Ugg1EE3RjRajqRRF VCzzi6XMok9IQzVCqLLwZw1f2sA6nB5uKmzP2270= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Gerecke , Ping Cheng , Jiri Kosina Subject: [PATCH 5.4 004/320] HID: wacom: Avoid using stale array indicies to read contact count Date: Mon, 24 Jan 2022 19:39:48 +0100 Message-Id: <20220124183953.913080008@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Gerecke commit 20f3cf5f860f9f267a6a6e5642d3d0525edb1814 upstream. If we ever see a touch report with contact count data we initialize several variables used to read the contact count in the pre-report phase. These variables are never reset if we process a report which doesn't contain a contact count, however. This can cause the pre- report function to trigger a read of arbitrary memory (e.g. NULL if we're lucky) and potentially crash the driver. This commit restores resetting of the variables back to default "none" values that were used prior to the commit mentioned below. Link: https://github.com/linuxwacom/input-wacom/issues/276 Fixes: 003f50ab673c (HID: wacom: Update last_slot_field during pre_report p= hase) CC: stable@vger.kernel.org Signed-off-by: Jason Gerecke Reviewed-by: Ping Cheng Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/hid/wacom_wac.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2654,6 +2654,10 @@ static void wacom_wac_finger_pre_report( =20 hid_data->confidence =3D true; =20 + hid_data->cc_report =3D 0; + hid_data->cc_index =3D -1; + hid_data->cc_value_index =3D -1; + for (i =3D 0; i < report->maxfield; i++) { struct hid_field *field =3D report->field[i]; int j; From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECA84C433EF for ; Mon, 24 Jan 2022 20:13:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345625AbiAXUM6 (ORCPT ); Mon, 24 Jan 2022 15:12:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352162AbiAXTwn (ORCPT ); Mon, 24 Jan 2022 14:52:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64FBBC06138D; Mon, 24 Jan 2022 11:25:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E3CE761483; Mon, 24 Jan 2022 19:25:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7846C340E5; Mon, 24 Jan 2022 19:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052340; bh=u6nSHTuDbL91DdQvhZ4DmRvheXbvt0w7vmlU89qohGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OGYWWyaTzjLIXRv6iDCK2q2H3gHgA2wT3ahF4y93aHqzl78+NuEkeKMjlgL9MkBZe luMgGR9oKg+GPTP8PkGS4BFdAasYfNz499EvLDSxrHXFid6h1gBzi7qqGVuUDPnqxA GUKTbe2K3fPF0M06rPhDfyIYcv3dZ0H/f/CFO60Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 5.4 005/320] f2fs: fix to do sanity check in is_alive() Date: Mon, 24 Jan 2022 19:39:49 +0100 Message-Id: <20220124183953.946694335@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chao Yu commit 77900c45ee5cd5da63bd4d818a41dbdf367e81cd upstream. In fuzzed image, SSA table may indicate that a data block belongs to invalid node, which node ID is out-of-range (0, 1, 2 or max_nid), in order to avoid migrating inconsistent data in such corrupted image, let's do sanity check anyway before data block migration. Cc: stable@vger.kernel.org Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/f2fs/gc.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -633,6 +633,9 @@ static bool is_alive(struct f2fs_sb_info set_sbi_flag(sbi, SBI_NEED_FSCK); } =20 + if (f2fs_check_nid_range(sbi, dni->ino)) + return false; + *nofs =3D ofs_of_node(node_page); source_blkaddr =3D datablock_addr(NULL, node_page, ofs_in_node); f2fs_put_page(node_page, 1); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 564A9C433F5 for ; Mon, 24 Jan 2022 20:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379136AbiAXUKY (ORCPT ); Mon, 24 Jan 2022 15:10:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352168AbiAXTwp (ORCPT ); Mon, 24 Jan 2022 14:52:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D558C06138E; Mon, 24 Jan 2022 11:25:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E93746148B; Mon, 24 Jan 2022 19:25:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB115C340E5; Mon, 24 Jan 2022 19:25:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052343; bh=DJ/cYkr8MzqT7hAfv92BLVMqYFrXoXo4x8FHMhWFLhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hd46jcAe/bMRU6y1iTVNEYlRGlbSkIamwpta2/28D0aA7CeE6ak9r1QR4fzYQ8oK8 9kmlYBy+pHVQsVRLgF58RQC4jWOYufYIr0bloFn+kYYqIPylkN4xzUcQVZ6mUibahC JTthaUJooCqKq3DLTz3xoszrcNJzKGWY1GtYbKV4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , "David S. Miller" , syzbot+7f23bcddf626e0593a39@syzkaller.appspotmail.com Subject: [PATCH 5.4 006/320] nfc: llcp: fix NULL error pointer dereference on sendmsg() after failed bind() Date: Mon, 24 Jan 2022 19:39:50 +0100 Message-Id: <20220124183953.977141470@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski commit dded08927ca3c31a5c37f8e7f95fe98770475dd4 upstream. Syzbot detected a NULL pointer dereference of nfc_llcp_sock->dev pointer (which is a 'struct nfc_dev *') with calls to llcp_sock_sendmsg() after a failed llcp_sock_bind(). The message being sent is a SOCK_DGRAM. KASAN report: BUG: KASAN: null-ptr-deref in nfc_alloc_send_skb+0x2d/0xc0 Read of size 4 at addr 00000000000005c8 by task llcp_sock_nfc_a/899 CPU: 5 PID: 899 Comm: llcp_sock_nfc_a Not tainted 5.16.0-rc6-next-2021122= 4-00001-gc6437fbf18b0 #125 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/0= 1/2014 Call Trace: dump_stack_lvl+0x45/0x59 ? nfc_alloc_send_skb+0x2d/0xc0 __kasan_report.cold+0x117/0x11c ? mark_lock+0x480/0x4f0 ? nfc_alloc_send_skb+0x2d/0xc0 kasan_report+0x38/0x50 nfc_alloc_send_skb+0x2d/0xc0 nfc_llcp_send_ui_frame+0x18c/0x2a0 ? nfc_llcp_send_i_frame+0x230/0x230 ? __local_bh_enable_ip+0x86/0xe0 ? llcp_sock_connect+0x470/0x470 ? llcp_sock_connect+0x470/0x470 sock_sendmsg+0x8e/0xa0 ____sys_sendmsg+0x253/0x3f0 ... The issue was visible only with multiple simultaneous calls to bind() and sendmsg(), which resulted in most of the bind() calls to fail. The bind() was failing on checking if there is available WKS/SDP/SAP (respective bit in 'struct nfc_llcp_local' fields). When there was no available WKS/SDP/SAP, the bind returned error but the sendmsg() to such socket was able to trigger mentioned NULL pointer dereference of nfc_llcp_sock->dev. The code looks simply racy and currently it protects several paths against race with checks for (!nfc_llcp_sock->local) which is NULL-ified in error paths of bind(). The llcp_sock_sendmsg() did not have such check but called function nfc_llcp_send_ui_frame() had, although not protected with lock_sock(). Therefore the race could look like (same socket is used all the time): CPU0 CPU1 =3D=3D=3D=3D =3D=3D=3D=3D llcp_sock_bind() - lock_sock() - success - release_sock() - return 0 llcp_sock_sendmsg() - lock_sock() - release_sock() llcp_sock_bind(), same socket - lock_sock() - error - nfc_llcp_send_ui_frame() - if (!llcp_sock->local) - llcp_sock->local =3D NULL - nfc_put_device(dev) - dereference llcp_sock->dev - release_sock() - return -ERRNO The nfc_llcp_send_ui_frame() checked llcp_sock->local outside of the lock, which is racy and ineffective check. Instead, its caller llcp_sock_sendmsg(), should perform the check inside lock_sock(). Reported-and-tested-by: syzbot+7f23bcddf626e0593a39@syzkaller.appspotmail.c= om Fixes: b874dec21d1c ("NFC: Implement LLCP connection less Tx path") Cc: Signed-off-by: Krzysztof Kozlowski Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/nfc/llcp_sock.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/net/nfc/llcp_sock.c +++ b/net/nfc/llcp_sock.c @@ -789,6 +789,11 @@ static int llcp_sock_sendmsg(struct sock =20 lock_sock(sk); =20 + if (!llcp_sock->local) { + release_sock(sk); + return -ENODEV; + } + if (sk->sk_type =3D=3D SOCK_DGRAM) { DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, addr, msg->msg_name); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79851C4332F for ; Mon, 24 Jan 2022 20:11:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379225AbiAXUKi (ORCPT ); Mon, 24 Jan 2022 15:10:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351785AbiAXTwp (ORCPT ); Mon, 24 Jan 2022 14:52:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61491C06138F; Mon, 24 Jan 2022 11:25:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DC8DD61488; Mon, 24 Jan 2022 19:25:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB123C340EA; Mon, 24 Jan 2022 19:25:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052346; bh=g7mHWUR/GWhbjh5JLbfZd53yt1tiPR9RD2IitNW5qzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MuJdjbRHGUjmYqj6yGR/wDkd++ODSmiRmUs1li60fZBCcmzA/wi7YgteNmmImkrWV 2Bn9bOIZWssiXQoqccL093ml5Fsb4ndQ/JjR2rZwbVpnjq1o7CB+j53qazAWFrGehy xSd2+METCPxJIV0jQOStDvcFMSALIhmUki4mT03E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Riedmueller , Christian Eggers , Han Xu , Miquel Raynal Subject: [PATCH 5.4 007/320] mtd: rawnand: gpmi: Add ERR007117 protection for nfc_apply_timings Date: Mon, 24 Jan 2022 19:39:51 +0100 Message-Id: <20220124183954.021297586@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Eggers commit f53d4c109a666bf1a4883b45d546fba079258717 upstream. gpmi_io clock needs to be gated off when changing the parent/dividers of enfc_clk_root (i.MX6Q/i.MX6UL) respectively qspi2_clk_root (i.MX6SX). Otherwise this rate change can lead to an unresponsive GPMI core which results in DMA timeouts and failed driver probe: [ 4.072318] gpmi-nand 112000.gpmi-nand: DMA timeout, last DMA ... [ 4.370355] gpmi-nand 112000.gpmi-nand: Chip: 0, Error -110 ... [ 4.375988] gpmi-nand 112000.gpmi-nand: Chip: 0, Error -22 [ 4.381524] gpmi-nand 112000.gpmi-nand: Error in ECC-based read: -22 [ 4.387988] gpmi-nand 112000.gpmi-nand: Chip: 0, Error -22 [ 4.393535] gpmi-nand 112000.gpmi-nand: Chip: 0, Error -22 ... Other than stated in i.MX 6 erratum ERR007117, it should be sufficient to gate only gpmi_io because all other bch/nand clocks are derived from different clock roots. The i.MX6 reference manuals state that changing clock muxers can cause glitches but are silent about changing dividers. But tests showed that these glitches can definitely happen on i.MX6ULL. For i.MX7D/8MM in turn, the manual guarantees that no glitches can happen when changing dividers. Co-developed-by: Stefan Riedmueller Signed-off-by: Stefan Riedmueller Signed-off-by: Christian Eggers Cc: stable@vger.kernel.org Acked-by: Han Xu Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20211102202022.15551-2-ceggers@arri= .de Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 28 ++++++++++++++++++++++++= +--- 1 file changed, 25 insertions(+), 3 deletions(-) --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c @@ -710,14 +710,32 @@ static void gpmi_nfc_compute_timings(str (use_half_period ? BM_GPMI_CTRL1_HALF_PERIOD : 0); } =20 -static void gpmi_nfc_apply_timings(struct gpmi_nand_data *this) +static int gpmi_nfc_apply_timings(struct gpmi_nand_data *this) { struct gpmi_nfc_hardware_timing *hw =3D &this->hw; struct resources *r =3D &this->resources; void __iomem *gpmi_regs =3D r->gpmi_regs; unsigned int dll_wait_time_us; + int ret; + + /* Clock dividers do NOT guarantee a clean clock signal on its output + * during the change of the divide factor on i.MX6Q/UL/SX. On i.MX7/8, + * all clock dividers provide these guarantee. + */ + if (GPMI_IS_MX6Q(this) || GPMI_IS_MX6SX(this)) + clk_disable_unprepare(r->clock[0]); + + ret =3D clk_set_rate(r->clock[0], hw->clk_rate); + if (ret) { + dev_err(this->dev, "cannot set clock rate to %lu Hz: %d\n", hw->clk_rate= , ret); + return ret; + } =20 - clk_set_rate(r->clock[0], hw->clk_rate); + if (GPMI_IS_MX6Q(this) || GPMI_IS_MX6SX(this)) { + ret =3D clk_prepare_enable(r->clock[0]); + if (ret) + return ret; + } =20 writel(hw->timing0, gpmi_regs + HW_GPMI_TIMING0); writel(hw->timing1, gpmi_regs + HW_GPMI_TIMING1); @@ -736,6 +754,8 @@ static void gpmi_nfc_apply_timings(struc =20 /* Wait for the DLL to settle. */ udelay(dll_wait_time_us); + + return 0; } =20 static int gpmi_setup_data_interface(struct nand_chip *chip, int chipnr, @@ -2429,7 +2449,9 @@ static int gpmi_nfc_exec_op(struct nand_ */ if (this->hw.must_apply_timings) { this->hw.must_apply_timings =3D false; - gpmi_nfc_apply_timings(this); + ret =3D gpmi_nfc_apply_timings(this); + if (ret) + return ret; } =20 dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA1F5C4332F for ; Mon, 24 Jan 2022 20:17:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356071AbiAXUOq (ORCPT ); Mon, 24 Jan 2022 15:14:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351774AbiAXTwn (ORCPT ); Mon, 24 Jan 2022 14:52:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A7B6C061390; Mon, 24 Jan 2022 11:25:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CA916B8121C; Mon, 24 Jan 2022 19:25:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2A94C340E7; Mon, 24 Jan 2022 19:25:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052349; bh=9RUyuV8X8p3XqKTR+JMGeYvUPlLzZu6EXdN0cDot12U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jGfM0FtFBuYL8zT9ZLMb1023ZtWPp8DrHbrtRZYOGMRQcZ/yApHP9lSH//f2DMhli Ee0OChyttWZKjX4zw1LaKQWiGMA52o+2FfpT1gvCUX+xtKw+FpcMTUnM50w0AISk50 5it6ENzg+0NdiXq9nrScdZPOl62QTW/lQBgwAm0U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Riedmueller , Han Xu , Miquel Raynal Subject: [PATCH 5.4 008/320] mtd: rawnand: gpmi: Remove explicit default gpmi clock setting for i.MX6 Date: Mon, 24 Jan 2022 19:39:52 +0100 Message-Id: <20220124183954.052845191@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stefan Riedmueller commit aa1baa0e6c1aa4872e481dce4fc7fd6f3dd8496b upstream. There is no need to explicitly set the default gpmi clock rate during boot for the i.MX 6 since this is done during nand_detect anyway. Signed-off-by: Stefan Riedmueller Cc: stable@vger.kernel.org Acked-by: Han Xu Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20211102202022.15551-1-ceggers@arri= .de Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 9 --------- 1 file changed, 9 deletions(-) --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c @@ -1204,15 +1204,6 @@ static int gpmi_get_clks(struct gpmi_nan r->clock[i] =3D clk; } =20 - if (GPMI_IS_MX6(this)) - /* - * Set the default value for the gpmi clock. - * - * If you want to use the ONFI nand which is in the - * Synchronous Mode, you should change the clock as you need. - */ - clk_set_rate(r->clock[0], 22000000); - return 0; =20 err_clock: From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AE30C433EF for ; Mon, 24 Jan 2022 19:34:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353339AbiAXTe3 (ORCPT ); Mon, 24 Jan 2022 14:34:29 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48898 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351079AbiAXTZz (ORCPT ); Mon, 24 Jan 2022 14:25:55 -0500 Received: from smtp.kernel.org (relay.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 D5A13B8121B; Mon, 24 Jan 2022 19:25:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BDAAC340E5; Mon, 24 Jan 2022 19:25:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052352; bh=hPRy7MHQ9qWvjx1gbXdwAJtjs8DlbBoxJ6CBGClWPjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JwL8vKwv4TQzpLy99jjSY+qrq4s45xmr4l7v79YUm/5FLeUGmITexEjYmEJ15j9ff FmFrNloHPlX674FoxuU1jewrD9md7AbIWCpPiE/oSbVFCL/+WHSOW0gbSgt7uKj0R3 9BaeS6exSRrLmtZuMSd2Hn7zj7OtqRM/v3tB8M9c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas De Marchi , Bjorn Helgaas Subject: [PATCH 5.4 009/320] x86/gpu: Reserve stolen memory for first integrated Intel GPU Date: Mon, 24 Jan 2022 19:39:53 +0100 Message-Id: <20220124183954.083159707@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lucas De Marchi commit 9c494ca4d3a535f9ca11ad6af1813983c1c6cbdd upstream. "Stolen memory" is memory set aside for use by an Intel integrated GPU. The intel_graphics_quirks() early quirk reserves this memory when it is called for a GPU that appears in the intel_early_ids[] table of integrated GPUs. Previously intel_graphics_quirks() was marked as QFLAG_APPLY_ONCE, so it was called only for the first Intel GPU found. If a discrete GPU happened to be enumerated first, intel_graphics_quirks() was called for it but not for any integrated GPU found later. Therefore, stolen memory for such an integrated GPU was never reserved. For example, this problem occurs in this Alderlake-P (integrated) + DG2 (discrete) topology where the DG2 is found first, but stolen memory is associated with the integrated GPU: - 00:01.0 Bridge `- 03:00.0 DG2 discrete GPU - 00:02.0 Integrated GPU (with stolen memory) Remove the QFLAG_APPLY_ONCE flag and call intel_graphics_quirks() for every Intel GPU. Reserve stolen memory for the first GPU that appears in intel_early_ids[]. [bhelgaas: commit log, add code comment, squash in https://lore.kernel.org/r/20220118190558.2ququ4vdfjuahicm@ldmartin-desk2] Link: https://lore.kernel.org/r/20220114002843.2083382-1-lucas.demarchi@int= el.com Signed-off-by: Lucas De Marchi Signed-off-by: Bjorn Helgaas Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/x86/kernel/early-quirks.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -515,6 +515,7 @@ static const struct intel_early_ops gen1 .stolen_size =3D gen9_stolen_size, }; =20 +/* Intel integrated GPUs for which we need to reserve "stolen memory" */ static const struct pci_device_id intel_early_ids[] __initconst =3D { INTEL_I830_IDS(&i830_early_ops), INTEL_I845G_IDS(&i845_early_ops), @@ -587,6 +588,13 @@ static void __init intel_graphics_quirks u16 device; int i; =20 + /* + * Reserve "stolen memory" for an integrated GPU. If we've already + * found one, there's nothing to do for other (discrete) GPUs. + */ + if (resource_size(&intel_graphics_stolen_res)) + return; + device =3D read_pci_config_16(num, slot, func, PCI_DEVICE_ID); =20 for (i =3D 0; i < ARRAY_SIZE(intel_early_ids); i++) { @@ -699,7 +707,7 @@ static struct chipset early_qrk[] __init { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA, PCI_ANY_ID, - QFLAG_APPLY_ONCE, intel_graphics_quirks }, + 0, intel_graphics_quirks }, /* * HPET on the current version of the Baytrail platform has accuracy * problems: it will halt in deep idle state - so we disable it. From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1197C35278 for ; Mon, 24 Jan 2022 20:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380405AbiAXUQQ (ORCPT ); Mon, 24 Jan 2022 15:16:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348125AbiAXTwN (ORCPT ); Mon, 24 Jan 2022 14:52:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F203C041895; Mon, 24 Jan 2022 11:24:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3D24BB8122F; Mon, 24 Jan 2022 19:24:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65D43C340E7; Mon, 24 Jan 2022 19:24:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052288; bh=oBieQZ3SwdWDNJAbWyZOdHNTR2Z5uh3/Q1LKFni/fOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aow3Ls3z4ke5DuuIYm7IJ0FD8KBqhi3hylUkT3eQSdrO3kh5oqVGKqu740oJxQlyC E5QbDnXpYeq0hSTLtYdd0LfID10+h4GZxSkQEEKCgM4rXFem10KojAYGOaZfsOMb86 SgVPnht9LDjHJVi5Ps2zUI+cV8Nip84M4070dH1M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bedirhan KURT , Louvian Lyndal , Peter Cordes , Ammar Faizi , Willy Tarreau , "Paul E. McKenney" Subject: [PATCH 5.4 010/320] tools/nolibc: x86-64: Fix startup code bug Date: Mon, 24 Jan 2022 19:39:54 +0100 Message-Id: <20220124183954.113119436@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ammar Faizi commit 937ed91c712273131de6d2a02caafd3ee84e0c72 upstream. Before this patch, the `_start` function looks like this: ``` 0000000000001170 <_start>: 1170: pop %rdi 1171: mov %rsp,%rsi 1174: lea 0x8(%rsi,%rdi,8),%rdx 1179: and $0xfffffffffffffff0,%rsp 117d: sub $0x8,%rsp 1181: call 1000
1186: movzbq %al,%rdi 118a: mov $0x3c,%rax 1191: syscall 1193: hlt 1194: data16 cs nopw 0x0(%rax,%rax,1) 119f: nop ``` Note the "and" to %rsp with $-16, it makes the %rsp be 16-byte aligned, but then there is a "sub" with $0x8 which makes the %rsp no longer 16-byte aligned, then it calls main. That's the bug! What actually the x86-64 System V ABI mandates is that right before the "call", the %rsp must be 16-byte aligned, not after the "call". So the "sub" with $0x8 here breaks the alignment. Remove it. An example where this rule matters is when the callee needs to align its stack at 16-byte for aligned move instruction, like `movdqa` and `movaps`. If the callee can't align its stack properly, it will result in segmentation fault. x86-64 System V ABI also mandates the deepest stack frame should be zero. Just to be safe, let's zero the %rbp on startup as the content of %rbp may be unspecified when the program starts. Now it looks like this: ``` 0000000000001170 <_start>: 1170: pop %rdi 1171: mov %rsp,%rsi 1174: lea 0x8(%rsi,%rdi,8),%rdx 1179: xor %ebp,%ebp # zero the %rbp 117b: and $0xfffffffffffffff0,%rsp # align the %rsp 117f: call 1000
1184: movzbq %al,%rdi 1188: mov $0x3c,%rax 118f: syscall 1191: hlt 1192: data16 cs nopw 0x0(%rax,%rax,1) 119d: nopl (%rax) ``` Cc: Bedirhan KURT Cc: Louvian Lyndal Reported-by: Peter Cordes Signed-off-by: Ammar Faizi [wt: I did this on purpose due to a misunderstanding of the spec, other archs will thus have to be rechecked, particularly i386] Cc: stable@vger.kernel.org Signed-off-by: Willy Tarreau Signed-off-by: Paul E. McKenney Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- tools/include/nolibc/nolibc.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/tools/include/nolibc/nolibc.h +++ b/tools/include/nolibc/nolibc.h @@ -422,14 +422,20 @@ struct stat { }) =20 /* startup code */ +/* + * x86-64 System V ABI mandates: + * 1) %rsp must be 16-byte aligned right before the function call. + * 2) The deepest stack frame should be zero (the %rbp). + * + */ asm(".section .text\n" ".global _start\n" "_start:\n" "pop %rdi\n" // argc (first arg, %rdi) "mov %rsp, %rsi\n" // argv[] (second arg, %rsi) "lea 8(%rsi,%rdi,8),%rdx\n" // then a NULL then envp (third arg, %rdx) - "and $-16, %rsp\n" // x86 ABI : esp must be 16-byte aligned w= hen - "sub $8, %rsp\n" // entering the callee + "xor %ebp, %ebp\n" // zero the stack frame + "and $-16, %rsp\n" // x86 ABI : esp must be 16-byte aligned b= efore call "call main\n" // main() returns the status code, we'll e= xit with it. "movzb %al, %rdi\n" // retrieve exit code from 8 lower bits "mov $60, %rax\n" // NR_exit =3D=3D 60 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA527C3526D for ; Mon, 24 Jan 2022 20:07:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377573AbiAXUFm (ORCPT ); Mon, 24 Jan 2022 15:05:42 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51292 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350338AbiAXTYv (ORCPT ); Mon, 24 Jan 2022 14:24:51 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6D7626141C; Mon, 24 Jan 2022 19:24:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 751BAC340E5; Mon, 24 Jan 2022 19:24:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052290; bh=KPoA4CJ44t2LfAsR757OJdlzVPP+4sLlen+NDQtwD7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l41udzH/SF5fc6r4SjSV2nwKEtbzaFx5FAOhl8M6uVPh/doB1RyH/yrbawgpG+Hfs x+WtuN+w0MHM6ycNmvutyrBod21PHgCDQidsCuXTtsQSux9rsyYj3s/ISw6ZglI5vF F1bfdWToAje+ZEB6KXNUGakcz0+bTeWO96Pg1i2k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ammar Faizi , Willy Tarreau , "Paul E. McKenney" Subject: [PATCH 5.4 011/320] tools/nolibc: i386: fix initial stack alignment Date: Mon, 24 Jan 2022 19:39:55 +0100 Message-Id: <20220124183954.144806000@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Willy Tarreau commit ebbe0d8a449d183fa43b42d84fcb248e25303985 upstream. After re-checking in the spec and comparing stack offsets with glibc, The last pushed argument must be 16-byte aligned (i.e. aligned before the call) so that in the callee esp+4 is multiple of 16, so the principle is the 32-bit equivalent to what Ammar fixed for x86_64. It's possible that 32-bit code using SSE2 or MMX could have been affected. In addition the frame pointer ought to be zero at the deepest level. Link: https://gitlab.com/x86-psABIs/i386-ABI/-/wikis/Intel386-psABI Cc: Ammar Faizi Cc: stable@vger.kernel.org Signed-off-by: Willy Tarreau Signed-off-by: Paul E. McKenney Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- tools/include/nolibc/nolibc.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/tools/include/nolibc/nolibc.h +++ b/tools/include/nolibc/nolibc.h @@ -606,13 +606,21 @@ struct sys_stat_struct { }) =20 /* startup code */ +/* + * i386 System V ABI mandates: + * 1) last pushed argument must be 16-byte aligned. + * 2) The deepest stack frame should be set to zero + * + */ asm(".section .text\n" ".global _start\n" "_start:\n" "pop %eax\n" // argc (first arg, %eax) "mov %esp, %ebx\n" // argv[] (second arg, %ebx) "lea 4(%ebx,%eax,4),%ecx\n" // then a NULL then envp (third arg, %ecx) - "and $-16, %esp\n" // x86 ABI : esp must be 16-byte aligned w= hen + "xor %ebp, %ebp\n" // zero the stack frame + "and $-16, %esp\n" // x86 ABI : esp must be 16-byte aligned b= efore + "sub $4, %esp\n" // the call instruction (args are aligned) "push %ecx\n" // push all registers on the stack so that= we "push %ebx\n" // support both regparm and plain stack mo= des "push %eax\n" From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2024C433FE for ; Mon, 24 Jan 2022 20:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380371AbiAXUQO (ORCPT ); Mon, 24 Jan 2022 15:16:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351616AbiAXTwN (ORCPT ); Mon, 24 Jan 2022 14:52:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F643C061798; Mon, 24 Jan 2022 11:24:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 57A30B811F9; Mon, 24 Jan 2022 19:24:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F9BFC340E5; Mon, 24 Jan 2022 19:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052294; bh=tnquIfwjFSaSHoBT6nlIb3zGDOprX5TOViH63Z84QzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YkbP8XLOUFqs36NdXJBR3KecphSoFkomaJ1onTmfqqS60OykIHxea+RkAPH8RxzTf JCorUG39Ora1fm2IChSwPPfPUNf0KZin6sRQFKf9iMYz3gnQBcl09nDYHMp/4QXYRy osy4FiWj71hJStlfmgNCv2ugRzFOickCWetKm3TY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ammar Faizi , Willy Tarreau , "Paul E. McKenney" Subject: [PATCH 5.4 012/320] tools/nolibc: fix incorrect truncation of exit code Date: Mon, 24 Jan 2022 19:39:56 +0100 Message-Id: <20220124183954.174372703@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Willy Tarreau commit de0244ae40ae91145faaf164a4252347607c3711 upstream. Ammar Faizi reported that our exit code handling is wrong. We truncate it to the lowest 8 bits but the syscall itself is expected to take a regular 32-bit signed integer, not an unsigned char. It's the kernel that later truncates it to the lowest 8 bits. The difference is visible in strace, where the program below used to show exit(255) instead of exit(-1): int main(void) { return -1; } This patch applies the fix to all archs. x86_64, i386, arm64, armv7 and mips were all tested and confirmed to work fine now. Risc-v was not tested but the change is trivial and exactly the same as for other archs. Reported-by: Ammar Faizi Cc: stable@vger.kernel.org Signed-off-by: Willy Tarreau Signed-off-by: Paul E. McKenney Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- tools/include/nolibc/nolibc.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) --- a/tools/include/nolibc/nolibc.h +++ b/tools/include/nolibc/nolibc.h @@ -437,7 +437,7 @@ asm(".section .text\n" "xor %ebp, %ebp\n" // zero the stack frame "and $-16, %rsp\n" // x86 ABI : esp must be 16-byte aligned b= efore call "call main\n" // main() returns the status code, we'll e= xit with it. - "movzb %al, %rdi\n" // retrieve exit code from 8 lower bits + "mov %eax, %edi\n" // retrieve exit code (32 bit) "mov $60, %rax\n" // NR_exit =3D=3D 60 "syscall\n" // really exit "hlt\n" // ensure it does not return @@ -625,9 +625,9 @@ asm(".section .text\n" "push %ebx\n" // support both regparm and plain stack mo= des "push %eax\n" "call main\n" // main() returns the status code in %eax - "movzbl %al, %ebx\n" // retrieve exit code from lower 8 bits - "movl $1, %eax\n" // NR_exit =3D=3D 1 - "int $0x80\n" // exit now + "mov %eax, %ebx\n" // retrieve exit code (32-bit int) + "movl $1, %eax\n" // NR_exit =3D=3D 1 + "int $0x80\n" // exit now "hlt\n" // ensure it does not ""); =20 @@ -811,7 +811,6 @@ asm(".section .text\n" "and %r3, %r1, $-8\n" // AAPCS : sp must be 8-byte aligned in = the "mov %sp, %r3\n" // callee, an bl doesn't push (l= r=3Dpc) "bl main\n" // main() returns the status code, we'll= exit with it. - "and %r0, %r0, $0xff\n" // limit exit code to 8 bits "movs r7, $1\n" // NR_exit =3D=3D 1 "svc $0x00\n" ""); @@ -1008,7 +1007,6 @@ asm(".section .text\n" "add x2, x2, x1\n" // + argv "and sp, x1, -16\n" // sp must be 16-byte aligned in the cal= lee "bl main\n" // main() returns the status code, we'll= exit with it. - "and x0, x0, 0xff\n" // limit exit code to 8 bits "mov x8, 93\n" // NR_exit =3D=3D 93 "svc #0\n" ""); @@ -1213,7 +1211,7 @@ asm(".section .text\n" "addiu $sp,$sp,-16\n" // the callee expects to save a0..a3 the= re! "jal main\n" // main() returns the status code, we'll= exit with it. "nop\n" // delayed slot - "and $a0, $v0, 0xff\n" // limit exit code to 8 bits + "move $a0, $v0\n" // retrieve 32-bit exit code from v0 "li $v0, 4001\n" // NR_exit =3D=3D 4001 "syscall\n" ".end __start\n" @@ -1411,7 +1409,6 @@ asm(".section .text\n" "add a2,a2,a1\n" // + argv "andi sp,a1,-16\n" // sp must be 16-byte aligned "call main\n" // main() returns the status code, we'll = exit with it. - "andi a0, a0, 0xff\n" // limit exit code to 8 bits "li a7, 93\n" // NR_exit =3D=3D 93 "ecall\n" ""); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6B59C47085 for ; Mon, 24 Jan 2022 20:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380352AbiAXUQL (ORCPT ); Mon, 24 Jan 2022 15:16:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350954AbiAXTwN (ORCPT ); Mon, 24 Jan 2022 14:52:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3623C0617A3; Mon, 24 Jan 2022 11:24:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6B79BB8122F; Mon, 24 Jan 2022 19:24:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 866E0C340E8; Mon, 24 Jan 2022 19:24:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052297; bh=Q3d16Erybi8ks3P6I31MKaCH6TV11ACxsCvMgjcQY2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q7cvptfEzOOb46dFmQV+FG/b9ajbnRYhFI1is89ZOsqw9MI6kdU5c2UiY/mYBLYbL nLfc0tUnRwrJapa8AtWr2ivFzCUQhOmGKAvTCk5dkM1M3ZEVSYf/X0Lf0I+nLPyu3G 1cmuhHlSecjm7r+D5MHShPL6VNIB8Rupj4hM/XCM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Mateusz=20Jo=C5=84czyk?= , Nobuhiro Iwamatsu , Alessandro Zummo , Alexandre Belloni Subject: [PATCH 5.4 013/320] rtc: cmos: take rtc_lock while reading from CMOS Date: Mon, 24 Jan 2022 19:39:57 +0100 Message-Id: <20220124183954.205099585@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Mateusz Jo=C5=84czyk commit 454f47ff464325223129b9b5b8d0b61946ec704d upstream. Reading from the CMOS involves writing to the index register and then reading from the data register. Therefore access to the CMOS has to be serialized with rtc_lock. This invocation of CMOS_READ was not serialized, which could cause trouble when other code is accessing CMOS at the same time. Use spin_lock_irq() like the rest of the function. Nothing in kernel modifies the RTC_DM_BINARY bit, so there could be a separate pair of spin_lock_irq() / spin_unlock_irq() before doing the math. Signed-off-by: Mateusz Jo=C5=84czyk Reviewed-by: Nobuhiro Iwamatsu Cc: Alessandro Zummo Cc: Alexandre Belloni Cc: stable@vger.kernel.org Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20211210200131.153887-2-mat.jonczyk@o2.pl Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/rtc/rtc-cmos.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -463,7 +463,10 @@ static int cmos_set_alarm(struct device min =3D t->time.tm_min; sec =3D t->time.tm_sec; =20 + spin_lock_irq(&rtc_lock); rtc_control =3D CMOS_READ(RTC_CONTROL); + spin_unlock_irq(&rtc_lock); + if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { /* Writing 0xff means "don't care" or "match all". */ mon =3D (mon <=3D 12) ? bin2bcd(mon) : 0xff; From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76AD4C433F5 for ; Mon, 24 Jan 2022 20:03:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376628AbiAXUDW (ORCPT ); Mon, 24 Jan 2022 15:03:22 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53088 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350513AbiAXTZB (ORCPT ); Mon, 24 Jan 2022 14:25:01 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D14E161484; Mon, 24 Jan 2022 19:25:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93201C340E5; Mon, 24 Jan 2022 19:24:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052300; bh=4bt5yiIaD1VywPIFb0uE+2wtLcFRrruAE3LteqpOqAs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a3XlmBa+VqHG52oAA9d2n6LJekqdryCqILCJ+xRaqTnwR4GRcAztmoTJ5lOEBW7Mv Lkr9wAzIXJWKup9J7AOKNtSEzSc2zHE7dFz4D1WgZnWHYIqMB8+Xtp67EY3cxPVyq4 7UM8srvf7FEjK2z8Air9QEuPI4dYkero41mSFUyc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.4 014/320] media: v4l2-ioctl.c: readbuffers depends on V4L2_CAP_READWRITE Date: Mon, 24 Jan 2022 19:39:58 +0100 Message-Id: <20220124183954.239152458@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Verkuil commit cd9d9377ed235b294a492a094e1666178a5e78fd upstream. If V4L2_CAP_READWRITE is not set, then readbuffers must be set to 0, otherwise v4l2-compliance will complain. A note on the Fixes tag below: this patch does not really fix that commit, but it can be applied from that commit onwards. For older code there is no guarantee that device_caps is set, so even though this patch would apply, it will not work reliably. Signed-off-by: Hans Verkuil Fixes: 049e684f2de9 (media: v4l2-dev: fix WARN_ON(!vdev->device_caps)) Cc: Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/v4l2-core/v4l2-ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -2046,6 +2046,7 @@ static int v4l_prepare_buf(const struct static int v4l_g_parm(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { + struct video_device *vfd =3D video_devdata(file); struct v4l2_streamparm *p =3D arg; v4l2_std_id std; int ret =3D check_fmt(file, p->type); @@ -2057,7 +2058,8 @@ static int v4l_g_parm(const struct v4l2_ if (p->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE && p->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) return -EINVAL; - p->parm.capture.readbuffers =3D 2; + if (vfd->device_caps & V4L2_CAP_READWRITE) + p->parm.capture.readbuffers =3D 2; ret =3D ops->vidioc_g_std(file, fh, &std); if (ret =3D=3D 0) v4l2_video_std_frame_period(std, &p->parm.capture.timeperframe); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 064FDC433FE for ; Mon, 24 Jan 2022 20:11:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378921AbiAXUKE (ORCPT ); Mon, 24 Jan 2022 15:10:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351619AbiAXTwN (ORCPT ); Mon, 24 Jan 2022 14:52:13 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9378AC0617A4; Mon, 24 Jan 2022 11:25:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 32F4561317; Mon, 24 Jan 2022 19:25:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFFBDC340E5; Mon, 24 Jan 2022 19:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052303; bh=NK+mLdWP7UGRRHa1nOQH/HEHr/3rropPGAQJvjrO/bs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0RKhU/D0JG6p1U04dqz3xEOnZWSLqfsgz0hqqNT7cxu+r3ltiMUQimv+eJYAbdzIi a+4UsmLjNE0DH5yVVlZ5rm/gClDK4pghmKP2SUt3cdoZlF1yWibadAhUSYfbYfnC/x xr2zWOoJC+sHGr5/pi/GtqhmLLz65ji8uZrZejQc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.4 015/320] media: flexcop-usb: fix control-message timeouts Date: Mon, 24 Jan 2022 19:39:59 +0100 Message-Id: <20220124183954.272091221@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit cd1798a387825cc4a51282f5a611ad05bb1ad75f upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Note that the driver was multiplying some of the timeout values with HZ twice resulting in 3000-second timeouts with HZ=3D1000. Also note that two of the timeout defines are currently unused. Fixes: 2154be651b90 ("[media] redrat3: new rc-core IR transceiver device dr= iver") Cc: stable@vger.kernel.org # 3.0 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/usb/b2c2/flexcop-usb.c | 10 +++++----- drivers/media/usb/b2c2/flexcop-usb.h | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) --- a/drivers/media/usb/b2c2/flexcop-usb.c +++ b/drivers/media/usb/b2c2/flexcop-usb.c @@ -87,7 +87,7 @@ static int flexcop_usb_readwrite_dw(stru 0, fc_usb->data, sizeof(u32), - B2C2_WAIT_FOR_OPERATION_RDW * HZ); + B2C2_WAIT_FOR_OPERATION_RDW); =20 if (ret !=3D sizeof(u32)) { err("error while %s dword from %d (%d).", read ? "reading" : @@ -155,7 +155,7 @@ static int flexcop_usb_v8_memory_req(str wIndex, fc_usb->data, buflen, - nWaitTime * HZ); + nWaitTime); if (ret !=3D buflen) ret =3D -EIO; =20 @@ -249,13 +249,13 @@ static int flexcop_usb_i2c_req(struct fl /* DKT 020208 - add this to support special case of DiSEqC */ case USB_FUNC_I2C_CHECKWRITE: pipe =3D B2C2_USB_CTRL_PIPE_OUT; - nWaitTime =3D 2; + nWaitTime =3D 2000; request_type |=3D USB_DIR_OUT; break; case USB_FUNC_I2C_READ: case USB_FUNC_I2C_REPEATREAD: pipe =3D B2C2_USB_CTRL_PIPE_IN; - nWaitTime =3D 2; + nWaitTime =3D 2000; request_type |=3D USB_DIR_IN; break; default: @@ -282,7 +282,7 @@ static int flexcop_usb_i2c_req(struct fl wIndex, fc_usb->data, buflen, - nWaitTime * HZ); + nWaitTime); =20 if (ret !=3D buflen) ret =3D -EIO; --- a/drivers/media/usb/b2c2/flexcop-usb.h +++ b/drivers/media/usb/b2c2/flexcop-usb.h @@ -91,13 +91,13 @@ typedef enum { UTILITY_SRAM_TESTVERIFY =3D 0x16, } flexcop_usb_utility_function_t; =20 -#define B2C2_WAIT_FOR_OPERATION_RW (1*HZ) -#define B2C2_WAIT_FOR_OPERATION_RDW (3*HZ) -#define B2C2_WAIT_FOR_OPERATION_WDW (1*HZ) +#define B2C2_WAIT_FOR_OPERATION_RW 1000 +#define B2C2_WAIT_FOR_OPERATION_RDW 3000 +#define B2C2_WAIT_FOR_OPERATION_WDW 1000 =20 -#define B2C2_WAIT_FOR_OPERATION_V8READ (3*HZ) -#define B2C2_WAIT_FOR_OPERATION_V8WRITE (3*HZ) -#define B2C2_WAIT_FOR_OPERATION_V8FLASH (3*HZ) +#define B2C2_WAIT_FOR_OPERATION_V8READ 3000 +#define B2C2_WAIT_FOR_OPERATION_V8WRITE 3000 +#define B2C2_WAIT_FOR_OPERATION_V8FLASH 3000 =20 typedef enum { V8_MEMORY_PAGE_DVB_CI =3D 0x20, From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49AB2C433F5 for ; Mon, 24 Jan 2022 19:58:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237483AbiAXT6S (ORCPT ); Mon, 24 Jan 2022 14:58:18 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48502 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350674AbiAXTZJ (ORCPT ); Mon, 24 Jan 2022 14:25:09 -0500 Received: from smtp.kernel.org (relay.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 1CB6DB811F9; Mon, 24 Jan 2022 19:25:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 265D2C340E7; Mon, 24 Jan 2022 19:25:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052306; bh=oj5Je4hEdh8UvrPiv7Hw9okiM1qi3n2AsOBeJ6hgeSM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v9Y9JW1phfWJMtHFi7M55aKgq6RbsRVIyuFB3huAAzvBXXLSJVgJgnnKnM2tP7E14 w0eNRCdMSDVilEyF64rVNgttieiBH2Id6MQNYHojcQp3JhYFEMf5/M3o6HXduak6r8 C2Ja86kCIHcxb5gwyrVdJmHPcNZyQrk/MPKkPZsw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.4 016/320] media: mceusb: fix control-message timeouts Date: Mon, 24 Jan 2022 19:40:00 +0100 Message-Id: <20220124183954.304831826@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit 16394e998cbb050730536bdf7e89f5a70efbd974 upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Fixes: 66e89522aff7 ("V4L/DVB: IR: add mceusb IR receiver driver") Cc: stable@vger.kernel.org # 2.6.36 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/rc/mceusb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -1430,7 +1430,7 @@ static void mceusb_gen1_init(struct mceu */ ret =3D usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0, - data, USB_CTRL_MSG_SZ, HZ * 3); + data, USB_CTRL_MSG_SZ, 3000); dev_dbg(dev, "set address - ret =3D %d", ret); dev_dbg(dev, "set address - data[0] =3D %d, data[1] =3D %d", data[0], data[1]); @@ -1438,20 +1438,20 @@ static void mceusb_gen1_init(struct mceu /* set feature: bit rate 38400 bps */ ret =3D usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, - 0xc04e, 0x0000, NULL, 0, HZ * 3); + 0xc04e, 0x0000, NULL, 0, 3000); =20 dev_dbg(dev, "set feature - ret =3D %d", ret); =20 /* bRequest 4: set char length to 8 bits */ ret =3D usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), 4, USB_TYPE_VENDOR, - 0x0808, 0x0000, NULL, 0, HZ * 3); + 0x0808, 0x0000, NULL, 0, 3000); dev_dbg(dev, "set char length - retB =3D %d", ret); =20 /* bRequest 2: set handshaking to use DTR/DSR */ ret =3D usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), 2, USB_TYPE_VENDOR, - 0x0000, 0x0100, NULL, 0, HZ * 3); + 0x0000, 0x0100, NULL, 0, 3000); dev_dbg(dev, "set handshake - retC =3D %d", ret); =20 /* device resume */ From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E64C2C43219 for ; Mon, 24 Jan 2022 20:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378836AbiAXUJz (ORCPT ); Mon, 24 Jan 2022 15:09:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348026AbiAXTwN (ORCPT ); Mon, 24 Jan 2022 14:52:13 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E964CC0617A6; Mon, 24 Jan 2022 11:25:10 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 89DBD61490; Mon, 24 Jan 2022 19:25:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6227FC340E7; Mon, 24 Jan 2022 19:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052310; bh=lDnMZdm1qIoBNi8zGpb9L19ogrWHp8r6Rf4WFn0gvus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DOhg/0JyenJHizcZQTF4cIjiaYP3/PVCvBrw2TW6Bqvv1J4DZNgF65XwJzu2gQW1V ud5F1eCTCm/8Vy8LLcC6wS6S6XWcODjrravEP5TabOTHEYHyE+8Xfsz9g+h7ivjcb8 LEyC9HHBEtWzGHNVA5kTZix5SMteHYcbPwOFcMS0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.4 017/320] media: em28xx: fix control-message timeouts Date: Mon, 24 Jan 2022 19:40:01 +0100 Message-Id: <20220124183954.337288425@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit d9b7e8df3aa9b8c10708aab60e72e79ac08237e4 upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Fixes: a6c2ba283565 ("[PATCH] v4l: 716: support for em28xx board family") Cc: stable@vger.kernel.org # 2.6.16 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/usb/em28xx/em28xx-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/media/usb/em28xx/em28xx-core.c +++ b/drivers/media/usb/em28xx/em28xx-core.c @@ -89,7 +89,7 @@ int em28xx_read_reg_req_len(struct em28x mutex_lock(&dev->ctrl_urb_lock); ret =3D usb_control_msg(udev, pipe, req, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0x0000, reg, dev->urb_buf, len, HZ); + 0x0000, reg, dev->urb_buf, len, 1000); if (ret < 0) { em28xx_regdbg("(pipe 0x%08x): IN: %02x %02x %02x %02x %02x %02x %02x %0= 2x failed with error %i\n", pipe, @@ -158,7 +158,7 @@ int em28xx_write_regs_req(struct em28xx memcpy(dev->urb_buf, buf, len); ret =3D usb_control_msg(udev, pipe, req, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0x0000, reg, dev->urb_buf, len, HZ); + 0x0000, reg, dev->urb_buf, len, 1000); mutex_unlock(&dev->ctrl_urb_lock); =20 if (ret < 0) { From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AD78C433EF for ; Mon, 24 Jan 2022 19:33:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347257AbiAXTdZ (ORCPT ); Mon, 24 Jan 2022 14:33:25 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53258 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350712AbiAXTZN (ORCPT ); Mon, 24 Jan 2022 14:25:13 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6433360917; Mon, 24 Jan 2022 19:25:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A6A7C340E7; Mon, 24 Jan 2022 19:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052312; bh=qfAGAbyPTg3olyE7z+5FG/FBdquTGx9E7vNPDPs2aZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O+MEX2sPCRurq2GVfY63RE0hMfwKLsnqJUD9TM3Fqx89x1JSykwpPWw1QQds4gdqo W8fp29+uWkupoGb7bkeh1oe9qYMzXLGFM6wPAWHIObcsOHHzCKzOVpAFKP3+CLNaW/ MdzWa/taoz6HSg1id9EdSZNnJNrcsB8dw3wB1X0M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.4 018/320] media: cpia2: fix control-message timeouts Date: Mon, 24 Jan 2022 19:40:02 +0100 Message-Id: <20220124183954.368826259@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit 10729be03327f53258cb196362015ad5c6eabe02 upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Fixes: ab33d5071de7 ("V4L/DVB (3376): Add cpia2 camera support") Cc: stable@vger.kernel.org # 2.6.17 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/usb/cpia2/cpia2_usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/media/usb/cpia2/cpia2_usb.c +++ b/drivers/media/usb/cpia2/cpia2_usb.c @@ -550,7 +550,7 @@ static int write_packet(struct usb_devic 0, /* index */ buf, /* buffer */ size, - HZ); + 1000); =20 kfree(buf); return ret; @@ -582,7 +582,7 @@ static int read_packet(struct usb_device 0, /* index */ buf, /* buffer */ size, - HZ); + 1000); =20 if (ret >=3D 0) memcpy(registers, buf, size); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6084C3526F for ; Mon, 24 Jan 2022 20:17:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380294AbiAXUQF (ORCPT ); Mon, 24 Jan 2022 15:16:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348022AbiAXTwN (ORCPT ); Mon, 24 Jan 2022 14:52:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C458C0617A7; Mon, 24 Jan 2022 11:25:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 046B6B8122A; Mon, 24 Jan 2022 19:25:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 219F9C340E5; Mon, 24 Jan 2022 19:25:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052315; bh=UQ1kjsQKUztbG+mC2ezX3DTEhk+4oW25wpr9eV2E+4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YNkME/0rhIXstVmjxx4oELvX5nXN387e3yUArXWYXnI23zFMG8VG0ZEhWth9nIYkh SvBw3xK+8fwHcNoAeqvHFHWehssE5TcN0IvDacID6ctEIvjp8DCEKlobFlkSjqliul 72u/F51N7/R0J1fYx4i6m6hkAYdekYcJNHjlCE2E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.4 019/320] media: s2255: fix control-message timeouts Date: Mon, 24 Jan 2022 19:40:03 +0100 Message-Id: <20220124183954.410001351@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit f71d272ad4e354097020a4e6b1dc6e4b59feb50f upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Use the common control-message timeout define for the five-second timeouts. Fixes: 38f993ad8b1f ("V4L/DVB (8125): This driver adds support for the Sens= oray 2255 devices.") Cc: stable@vger.kernel.org # 2.6.27 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/usb/s2255/s2255drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -1884,7 +1884,7 @@ static long s2255_vendor_req(struct s225 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, Value, Index, buf, - TransferBufferLength, HZ * 5); + TransferBufferLength, USB_CTRL_SET_TIMEOUT); =20 if (r >=3D 0) memcpy(TransferBuffer, buf, TransferBufferLength); @@ -1893,7 +1893,7 @@ static long s2255_vendor_req(struct s225 r =3D usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), Request, USB_TYPE_VENDOR | USB_RECIP_DEVICE, Value, Index, buf, - TransferBufferLength, HZ * 5); + TransferBufferLength, USB_CTRL_SET_TIMEOUT); } kfree(buf); return r; From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07170C433EF for ; Mon, 24 Jan 2022 19:33:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349133AbiAXTdd (ORCPT ); Mon, 24 Jan 2022 14:33:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53350 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350811AbiAXTZY (ORCPT ); Mon, 24 Jan 2022 14:25:24 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9DADD612A5; Mon, 24 Jan 2022 19:25:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98B77C340E5; Mon, 24 Jan 2022 19:25:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052322; bh=b3juwtF1WadbjGXLpSUwGPgfTrogbjQu+gXIMxu3feE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D9qGptAPAgBAxaek9KWWuSbvdi2fhX01A6SBgtORl6/gpMbP6QuqO913kKm7xURA6 hOb1DJVOjEvLh3deaz0cK72nyn7UgYaO76w1xjZajuSkkpMEhexRxch1kdt/5EScvP TkzN0TzR7d+KHkcf2FJqVuobmsRdm3FuJNtNeJn4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kuron , Mauro Carvalho Chehab Subject: [PATCH 5.4 020/320] media: dib0700: fix undefined behavior in tuner shutdown Date: Mon, 24 Jan 2022 19:40:04 +0100 Message-Id: <20220124183954.442751555@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Kuron commit f7b77ebe6d2f49c7747b2d619586d1aa33f9ea91 upstream. This fixes a problem where closing the tuner would leave it in a state where it would not tune to any channel when reopened. This problem was discovered as part of https://github.com/hselasky/webcamd/issues/16. Since adap->id is 0 or 1, this bit-shift overflows, which is undefined behavior. The driver still worked in practice as the overflow would in most environments result in 0, which rendered the line a no-op. When running the driver as part of webcamd however, the overflow could lead to 0xff due to optimizations by the compiler, which would, in the end, improperly shut down the tuner. The bug is a regression introduced in the commit referenced below. The present patch causes identical behavior to before that commit for adap->id equal to 0 or 1. The driver does not contain support for dib0700 devices with more adapters, assuming such even exist. Tests have been performed with the Xbox One Digital TV Tuner on amd64. Not all dib0700 devices are expected to be affected by the regression; this code path is only taken by those with incorrect endpoint numbers. Link: https://lore.kernel.org/linux-media/1d2fc36d94ced6f67c7cc21dcc469d5e5= bdd8201.1632689033.git.mchehab+huawei@kernel.org Cc: stable@vger.kernel.org Fixes: 7757ddda6f4f ("[media] DiB0700: add function to change I2C-speed") Signed-off-by: Michael Kuron Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/usb/dvb-usb/dib0700_core.c | 2 -- 1 file changed, 2 deletions(-) --- a/drivers/media/usb/dvb-usb/dib0700_core.c +++ b/drivers/media/usb/dvb-usb/dib0700_core.c @@ -616,8 +616,6 @@ int dib0700_streaming_ctrl(struct dvb_us deb_info("the endpoint number (%i) is not correct, use the adapter id in= stead", adap->fe_adap[0].stream.props.endpoint); if (onoff) st->channel_state |=3D 1 << (adap->id); - else - st->channel_state |=3D 1 << ~(adap->id); } else { if (onoff) st->channel_state |=3D 1 << (adap->fe_adap[0].stream.props.endpoint-2); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45626C433EF for ; Mon, 24 Jan 2022 19:33:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346474AbiAXTdp (ORCPT ); Mon, 24 Jan 2022 14:33:45 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53378 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350862AbiAXTZ0 (ORCPT ); Mon, 24 Jan 2022 14:25:26 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DABB861317; Mon, 24 Jan 2022 19:25:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A82FDC340E8; Mon, 24 Jan 2022 19:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052325; bh=EhPXdF4lzt1FLabZmV0m98e1vXpN9HjrFd7bt2Rm1Z0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cLUeC9hIsegdxCzp5NpeEGrJGMBirLAaG56JW93ByygI6q1Gym0JDrGre4dv9O0a7 gZDVwdcmtAlo6hGjE3byxI8lGj5iZpMuuBVAOKx526Jbhpw+MLkMLGKDWHqFSTimmb Gwg0Du/EH5ZGHhqvAJddDf5Hd3bdLC5sfPSDbETE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.4 021/320] media: redrat3: fix control-message timeouts Date: Mon, 24 Jan 2022 19:40:05 +0100 Message-Id: <20220124183954.472876543@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit 2adc965c8bfa224e11ecccf9c92fd458c4236428 upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Fixes: 2154be651b90 ("[media] redrat3: new rc-core IR transceiver device dr= iver") Cc: stable@vger.kernel.org # 3.0 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/rc/redrat3.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -405,7 +405,7 @@ static int redrat3_send_cmd(int cmd, str udev =3D rr3->udev; res =3D usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), cmd, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x0000, 0x0000, data, sizeof(u8), HZ * 10); + 0x0000, 0x0000, data, sizeof(u8), 10000); =20 if (res < 0) { dev_err(rr3->dev, "%s: Error sending rr3 cmd res %d, data %d", @@ -481,7 +481,7 @@ static u32 redrat3_get_timeout(struct re pipe =3D usb_rcvctrlpipe(rr3->udev, 0); ret =3D usb_control_msg(rr3->udev, pipe, RR3_GET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - RR3_IR_IO_SIG_TIMEOUT, 0, tmp, len, HZ * 5); + RR3_IR_IO_SIG_TIMEOUT, 0, tmp, len, 5000); if (ret !=3D len) dev_warn(rr3->dev, "Failed to read timeout from hardware\n"); else { @@ -511,7 +511,7 @@ static int redrat3_set_timeout(struct rc ret =3D usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, RR3_IR_IO_SIG_TIMEOUT, 0, timeout, sizeof(*timeout), - HZ * 25); + 25000); dev_dbg(dev, "set ir parm timeout %d ret 0x%02x\n", be32_to_cpu(*timeout), ret); =20 @@ -543,32 +543,32 @@ static void redrat3_reset(struct redrat3 *val =3D 0x01; rc =3D usb_control_msg(udev, rxpipe, RR3_RESET, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - RR3_CPUCS_REG_ADDR, 0, val, len, HZ * 25); + RR3_CPUCS_REG_ADDR, 0, val, len, 25000); dev_dbg(dev, "reset returned 0x%02x\n", rc); =20 *val =3D length_fuzz; rc =3D usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, - RR3_IR_IO_LENGTH_FUZZ, 0, val, len, HZ * 25); + RR3_IR_IO_LENGTH_FUZZ, 0, val, len, 25000); dev_dbg(dev, "set ir parm len fuzz %d rc 0x%02x\n", *val, rc); =20 *val =3D (65536 - (minimum_pause * 2000)) / 256; rc =3D usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, - RR3_IR_IO_MIN_PAUSE, 0, val, len, HZ * 25); + RR3_IR_IO_MIN_PAUSE, 0, val, len, 25000); dev_dbg(dev, "set ir parm min pause %d rc 0x%02x\n", *val, rc); =20 *val =3D periods_measure_carrier; rc =3D usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, - RR3_IR_IO_PERIODS_MF, 0, val, len, HZ * 25); + RR3_IR_IO_PERIODS_MF, 0, val, len, 25000); dev_dbg(dev, "set ir parm periods measure carrier %d rc 0x%02x", *val, rc); =20 *val =3D RR3_DRIVER_MAXLENS; rc =3D usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, - RR3_IR_IO_MAX_LENGTHS, 0, val, len, HZ * 25); + RR3_IR_IO_MAX_LENGTHS, 0, val, len, 25000); dev_dbg(dev, "set ir parm max lens %d rc 0x%02x\n", *val, rc); =20 kfree(val); @@ -586,7 +586,7 @@ static void redrat3_get_firmware_rev(str rc =3D usb_control_msg(rr3->udev, usb_rcvctrlpipe(rr3->udev, 0), RR3_FW_VERSION, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0, 0, buffer, RR3_FW_VERSION_LEN, HZ * 5); + 0, 0, buffer, RR3_FW_VERSION_LEN, 5000); =20 if (rc >=3D 0) dev_info(rr3->dev, "Firmware rev: %s", buffer); @@ -826,14 +826,14 @@ static int redrat3_transmit_ir(struct rc =20 pipe =3D usb_sndbulkpipe(rr3->udev, rr3->ep_out->bEndpointAddress); ret =3D usb_bulk_msg(rr3->udev, pipe, irdata, - sendbuf_len, &ret_len, 10 * HZ); + sendbuf_len, &ret_len, 10000); dev_dbg(dev, "sent %d bytes, (ret %d)\n", ret_len, ret); =20 /* now tell the hardware to transmit what we sent it */ pipe =3D usb_rcvctrlpipe(rr3->udev, 0); ret =3D usb_control_msg(rr3->udev, pipe, RR3_TX_SEND_SIGNAL, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0, 0, irdata, 2, HZ * 10); + 0, 0, irdata, 2, 10000); =20 if (ret < 0) dev_err(dev, "Error: control msg send failed, rc %d\n", ret); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D77E7C43217 for ; Mon, 24 Jan 2022 20:11:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379084AbiAXUKS (ORCPT ); Mon, 24 Jan 2022 15:10:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348424AbiAXTwj (ORCPT ); Mon, 24 Jan 2022 14:52:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26D99C0617BD; Mon, 24 Jan 2022 11:25:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B8D5F61483; Mon, 24 Jan 2022 19:25:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA75AC340E5; Mon, 24 Jan 2022 19:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052328; bh=x8ZQ3S8zIVTHi8vfagOrUccfQLdVTDvY8UlvC4IZUdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NmGxnUIHU4ZFabSU6Fxs0F4D6n0+HkeXqnqA5x2SYESg956U6mf+uV9U56oLZ/Mce 1XjAesKJxykWAFGi8tupqjHlsaobsZ/EA1i10CZwoKcgtwEEQByN6ILq5xTwazwNtR fevI2ejUtVHe/SKhMNr7LMtnXTgPrVnAPFK+nfJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.4 022/320] media: pvrusb2: fix control-message timeouts Date: Mon, 24 Jan 2022 19:40:06 +0100 Message-Id: <20220124183954.505885405@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit b82bf9b9dc305d7d3d93eab106d70dbf2171b43e upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Fixes: d855497edbfb ("V4L/DVB (4228a): pvrusb2 to kernel 2.6.18") Cc: stable@vger.kernel.org # 2.6.18 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -1468,7 +1468,7 @@ static int pvr2_upload_firmware1(struct for (address =3D 0; address < fwsize; address +=3D 0x800) { memcpy(fw_ptr, fw_entry->data + address, 0x800); ret +=3D usb_control_msg(hdw->usb_dev, pipe, 0xa0, 0x40, address, - 0, fw_ptr, 0x800, HZ); + 0, fw_ptr, 0x800, 1000); } =20 trace_firmware("Upload done, releasing device's CPU"); @@ -1606,7 +1606,7 @@ int pvr2_upload_firmware2(struct pvr2_hd ((u32 *)fw_ptr)[icnt] =3D swab32(((u32 *)fw_ptr)[icnt]); =20 ret |=3D usb_bulk_msg(hdw->usb_dev, pipe, fw_ptr,bcnt, - &actual_length, HZ); + &actual_length, 1000); ret |=3D (actual_length !=3D bcnt); if (ret) break; fw_done +=3D bcnt; @@ -3439,7 +3439,7 @@ void pvr2_hdw_cpufw_set_enabled(struct p 0xa0,0xc0, address,0, hdw->fw_buffer+address, - 0x800,HZ); + 0x800,1000); if (ret < 0) break; } =20 @@ -3978,7 +3978,7 @@ void pvr2_hdw_cpureset_assert(struct pvr /* Write the CPUCS register on the 8051. The lsb of the register is the reset bit; a 1 asserts reset while a 0 clears it. */ pipe =3D usb_sndctrlpipe(hdw->usb_dev, 0); - ret =3D usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,HZ); + ret =3D usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,1000); if (ret < 0) { pvr2_trace(PVR2_TRACE_ERROR_LEGS, "cpureset_assert(%d) error=3D%d",val,ret); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE9DFC433EF for ; Mon, 24 Jan 2022 19:33:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346797AbiAXTdv (ORCPT ); Mon, 24 Jan 2022 14:33:51 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53432 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350901AbiAXTZc (ORCPT ); Mon, 24 Jan 2022 14:25:32 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BA5A96129A; Mon, 24 Jan 2022 19:25:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D0A2C340E5; Mon, 24 Jan 2022 19:25:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052331; bh=237rbF9pS7DmapYAq12bvUaL8GTC3vSFTf2z40fMX3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UhOsn9d+K0dHGio5CuuRniwFy3Su7KpAj/eNl2iwQ8G/aZINzbAbTJyZK8PapQFqL lbyc7vltM8J5dr9+bpvwXjnmctGwtQSjlgwB45V+ClVcatsYVX1UXM/rEdMLnbsRrs +Pr4uL7Be6mzj7PZDS1186fYfbN58IWVTPDe2FhI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.4 023/320] media: stk1160: fix control-message timeouts Date: Mon, 24 Jan 2022 19:40:07 +0100 Message-Id: <20220124183954.546983378@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit 6aa6e70cdb5b863a57bad61310bf89b6617a5d2d upstream. USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Fixes: 9cb2173e6ea8 ("[media] media: Add stk1160 new driver (easycap replac= ement)") Cc: stable@vger.kernel.org # 3.7 Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/usb/stk1160/stk1160-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/media/usb/stk1160/stk1160-core.c +++ b/drivers/media/usb/stk1160/stk1160-core.c @@ -65,7 +65,7 @@ int stk1160_read_reg(struct stk1160 *dev return -ENOMEM; ret =3D usb_control_msg(dev->udev, pipe, 0x00, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0x00, reg, buf, sizeof(u8), HZ); + 0x00, reg, buf, sizeof(u8), 1000); if (ret < 0) { stk1160_err("read failed on reg 0x%x (%d)\n", reg, ret); @@ -85,7 +85,7 @@ int stk1160_write_reg(struct stk1160 *de =20 ret =3D usb_control_msg(dev->udev, pipe, 0x01, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - value, reg, NULL, 0, HZ); + value, reg, NULL, 0, 1000); if (ret < 0) { stk1160_err("write failed on reg 0x%x (%d)\n", reg, ret); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F281C35273 for ; Mon, 24 Jan 2022 20:29:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383398AbiAXU1N (ORCPT ); Mon, 24 Jan 2022 15:27:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352139AbiAXT5K (ORCPT ); Mon, 24 Jan 2022 14:57:10 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32764C047CD0; Mon, 24 Jan 2022 11:27:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F08A0B8123D; Mon, 24 Jan 2022 19:27:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18970C340E5; Mon, 24 Jan 2022 19:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052460; bh=iQYvZKOwn04GejAiJzx17eTC96LSLpLWKisII9IwQuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MoF6hoHC8EYw+XQROIvqtqpZv5JcmBWb9rz0ZsP+sJsv7ZdYb38A479MVKAPzGlQC 8Pu03GBfBRnmoO6SmtDzRppCfX4RqHXF/nkKoXln3wQ8teXclpTE9fojxCjQjbhz5g PMqPTq53kQobWBrLMlwSkJSOFIh1F1/sUIcrqo/0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Marc Kleine-Budde Subject: [PATCH 5.4 024/320] can: softing_cs: softingcs_probe(): fix memleak on registration failure Date: Mon, 24 Jan 2022 19:40:08 +0100 Message-Id: <20220124183954.578625972@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit ced4913efb0acc844ed65cc01d091a85d83a2082 upstream. In case device registration fails during probe, the driver state and the embedded platform device structure needs to be freed using platform_device_put() to properly free all resources (e.g. the device name). Fixes: 0a0b7a5f7a04 ("can: add driver for Softing card") Link: https://lore.kernel.org/all/20211222104843.6105-1-johan@kernel.org Cc: stable@vger.kernel.org # 2.6.38 Signed-off-by: Johan Hovold Reviewed-by: Greg Kroah-Hartman Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/can/softing/softing_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/can/softing/softing_cs.c +++ b/drivers/net/can/softing/softing_cs.c @@ -293,7 +293,7 @@ static int softingcs_probe(struct pcmcia return 0; =20 platform_failed: - kfree(dev); + platform_device_put(pdev); mem_failed: pcmcia_bad: pcmcia_failed: From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1DFDC433EF for ; Mon, 24 Jan 2022 19:34:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347798AbiAXTeM (ORCPT ); Mon, 24 Jan 2022 14:34:12 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53734 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351114AbiAXT0A (ORCPT ); Mon, 24 Jan 2022 14:26:00 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8FE5E6121F; Mon, 24 Jan 2022 19:25:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F5FFC340E5; Mon, 24 Jan 2022 19:25:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052359; bh=V+le2JyJO4eaQ2u2wi+xJ2j42OxrRL3YiITO6FyFsQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sieQ3Iz07riWMCzAQEPjTGU8CsTM3vGqvDdVj4biZ3mOlFee/IHYEdFEOZ147q0rY BilPa5uTDc6DK9ALDPLxmOrLTeo5GSzn2zvgvEp4P2jbn6/2ygfg58joJSFTfi05CT fZhbiwyD5qCb3Nm+KAPO4nUz0PeuCHnZbr211h6w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Arnd Bergmann , Nick Desaulniers , Nathan Chancellor , Christophe Leroy Subject: [PATCH 5.4 025/320] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing() Date: Mon, 24 Jan 2022 19:40:09 +0100 Message-Id: <20220124183954.615247164@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy commit bc93a22a19eb2b68a16ecf04cdf4b2ed65aaf398 upstream. On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA test leads to "Illegal instruction" failure. Looking at the content of rodata_objcopy.o, we see that the function content zeroes only: Disassembly of section .rodata: 0000000000000000 <.lkdtm_rodata_do_nothing>: 0: 00 00 00 00 .long 0x0 Add the contents flag in order to keep the content of the section while renaming it. Disassembly of section .rodata: 0000000000000000 <.lkdtm_rodata_do_nothing>: 0: 4e 80 00 20 blr Fixes: e9e08a07385e ("lkdtm: support llvm-objcopy") Cc: stable@vger.kernel.org Cc: Kees Cook Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Nick Desaulniers Cc: Nathan Chancellor Signed-off-by: Christophe Leroy Reviewed-by: Nick Desaulniers Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/8900731fbc05fb8b0de18af7133a8fc07c3c53a1.16= 33712176.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/misc/lkdtm/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/misc/lkdtm/Makefile +++ b/drivers/misc/lkdtm/Makefile @@ -16,7 +16,7 @@ KCOV_INSTRUMENT_rodata.o :=3D n =20 OBJCOPYFLAGS :=3D OBJCOPYFLAGS_rodata_objcopy.o :=3D \ - --rename-section .noinstr.text=3D.rodata,alloc,readonly,load + --rename-section .noinstr.text=3D.rodata,alloc,readonly,load,contents targets +=3D rodata.o rodata_objcopy.o $(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE $(call if_changed,objcopy) From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C573C433EF for ; Mon, 24 Jan 2022 20:11:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379232AbiAXUKo (ORCPT ); Mon, 24 Jan 2022 15:10:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352597AbiAXTw7 (ORCPT ); Mon, 24 Jan 2022 14:52:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58B39C061397; Mon, 24 Jan 2022 11:26:33 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EA55C61490; Mon, 24 Jan 2022 19:26:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADDACC340E5; Mon, 24 Jan 2022 19:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052392; bh=Jz8l2tb5cXNmDSk3HR4LSQ6/l4bmgntUbC1cSU0TCuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F7+yRoJzMJEmK4n4vmK7TRRqQIhwTC/SWUgnsf5Jn4ulssXU6reuOfa9sK+bkkhbr BTB3QHSQWjUNmroqODQRZseqwLU0bnA7TwvUggNFR18KwJ9SqB3/VKXC7kFBUViMxp EkBB4Es+v08cCJ2ormbE7swVrkdYEoUetJciw7jc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunfei Wang , Robin Murphy , Will Deacon Subject: [PATCH 5.4 026/320] iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure Date: Mon, 24 Jan 2022 19:40:10 +0100 Message-Id: <20220124183954.649197168@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yunfei Wang commit a556cfe4cabc6d79cbb7733f118bbb420b376fe6 upstream. In __arm_v7s_alloc_table function: iommu call kmem_cache_alloc to allocate page table, this function allocate memory may fail, when kmem_cache_alloc fails to allocate table, call virt_to_phys will be abnomal and return unexpected phys and goto out_free, then call kmem_cache_free to release table will trigger KE, __get_free_pages and free_pages have similar problem, so add error handle for page table allocation failure. Fixes: 29859aeb8a6e ("iommu/io-pgtable-arm-v7s: Abort allocation when table= address overflows the PTE") Signed-off-by: Yunfei Wang Cc: # 5.10.* Acked-by: Robin Murphy Link: https://lore.kernel.org/r/20211207113315.29109-1-yf.wang@mediatek.com Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/iommu/io-pgtable-arm-v7s.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/iommu/io-pgtable-arm-v7s.c +++ b/drivers/iommu/io-pgtable-arm-v7s.c @@ -244,13 +244,17 @@ static void *__arm_v7s_alloc_table(int l __GFP_ZERO | ARM_V7S_TABLE_GFP_DMA, get_order(size)); else if (lvl =3D=3D 2) table =3D kmem_cache_zalloc(data->l2_tables, gfp); + + if (!table) + return NULL; + phys =3D virt_to_phys(table); if (phys !=3D (arm_v7s_iopte)phys) { /* Doesn't fit in PTE */ dev_err(dev, "Page table does not fit in PTE: %pa", &phys); goto out_free; } - if (table && !cfg->coherent_walk) { + if (!cfg->coherent_walk) { dma =3D dma_map_single(dev, table, size, DMA_TO_DEVICE); if (dma_mapping_error(dev, dma)) goto out_free; From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0468C3526E for ; Mon, 24 Jan 2022 19:37:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353651AbiAXTfI (ORCPT ); Mon, 24 Jan 2022 14:35:08 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50512 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348040AbiAXT1N (ORCPT ); Mon, 24 Jan 2022 14:27:13 -0500 Received: from smtp.kernel.org (relay.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 F0C9FB8122C; Mon, 24 Jan 2022 19:27:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12A7FC340E7; Mon, 24 Jan 2022 19:27:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052425; bh=N7iqN2dtcEyo4qkf5F6uhGxw3W2pDTN7WGAfMlTzNYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uwjxEx33cAJEo04u3CviaqKIkkt/EeUeWYu/1EKatk4nX10lJR5Tse7yr06AMzKkc mo+vGraQvEIbHUDTLnz01EL58NFJZegSs1g0e5v1wtXKFygYxkOSUWzLLBS+IV6p0p V339z8RN/lXTyk/NHwul0hYIAI+PHU5z1N+qyAXE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Sumit Semwal , Gustavo Padovan , =?UTF-8?q?Christian=20K=C3=B6nig?= , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= Subject: [PATCH 5.4 027/320] dma_fence_array: Fix PENDING_ERROR leak in dma_fence_array_signaled() Date: Mon, 24 Jan 2022 19:40:11 +0100 Message-Id: <20220124183954.683526569@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Hellstr=C3=B6m commit 95d35838880fb040ccb9fe4a48816bd0c8b62df5 upstream. If a dma_fence_array is reported signaled by a call to dma_fence_is_signaled(), it may leak the PENDING_ERROR status. Fix this by clearing the PENDING_ERROR status if we return true in dma_fence_array_signaled(). v2: - Update Cc list, and add R-b. Fixes: 1f70b8b812f3 ("dma-fence: Propagate errors to dma-fence-array contai= ner") Cc: Chris Wilson Cc: Sumit Semwal Cc: Gustavo Padovan Cc: Christian K=C3=B6nig Cc: "Christian K=C3=B6nig" Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: linaro-mm-sig@lists.linaro.org Cc: # v5.4+ Signed-off-by: Thomas Hellstr=C3=B6m Reviewed-by: Christian K=C3=B6nig Link: https://patchwork.freedesktop.org/patch/msgid/20211129152727.448908-1= -thomas.hellstrom@linux.intel.com Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/dma-buf/dma-fence-array.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/dma-buf/dma-fence-array.c +++ b/drivers/dma-buf/dma-fence-array.c @@ -104,7 +104,11 @@ static bool dma_fence_array_signaled(str { struct dma_fence_array *array =3D to_dma_fence_array(fence); =20 - return atomic_read(&array->num_pending) <=3D 0; + if (atomic_read(&array->num_pending) > 0) + return false; + + dma_fence_array_clear_pending_error(array); + return true; } =20 static void dma_fence_array_release(struct dma_fence *fence) From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 834D8C35275 for ; Mon, 24 Jan 2022 20:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380028AbiAXUPY (ORCPT ); Mon, 24 Jan 2022 15:15:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358595AbiAXTzb (ORCPT ); Mon, 24 Jan 2022 14:55:31 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7967C08C5DA; Mon, 24 Jan 2022 11:27:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4579360917; Mon, 24 Jan 2022 19:27:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BBBBC340E5; Mon, 24 Jan 2022 19:27:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052443; bh=ARXYz2jQl5MOyRHxEx1WeK3kg2Npk3iDm2gJ+Z9K5rQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VNou791Ny8FiXwlTUC8N81zWyyKKvVpkBS44XAASyz5M58ROfPuoLISIVSijvoGaN 4gQIfTyZXgjGxGddJKoX7+wx6tgtQXYNZYWw81OgFmkq9SyZ1pGDLN9jhGuABLEP2E LwhuHaZwDMBILv8VBU+W9L6NR4t5EV2RKBYn3f/s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sam Bingner , Yifeng Li , Bjorn Helgaas , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= Subject: [PATCH 5.4 028/320] PCI: Add function 1 DMA alias quirk for Marvell 88SE9125 SATA controller Date: Mon, 24 Jan 2022 19:40:12 +0100 Message-Id: <20220124183954.716090435@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Yifeng Li commit e445375882883f69018aa669b67cbb37ec873406 upstream. Like other SATA controller chips in the Marvell 88SE91xx series, the Marvell 88SE9125 has the same DMA requester ID hardware bug that prevents it from working under IOMMU. Add it to the list of devices that need the quirk. Without this patch, device initialization fails with DMA errors: ata8: softreset failed (1st FIS failed) DMAR: DRHD: handling fault status reg 2 DMAR: [DMA Write NO_PASID] Request device [03:00.1] fault addr 0xfffc0000= [fault reason 0x02] Present bit in context entry is clear DMAR: DRHD: handling fault status reg 2 DMAR: [DMA Read NO_PASID] Request device [03:00.1] fault addr 0xfffc0000 = [fault reason 0x02] Present bit in context entry is clear After applying the patch, the controller can be successfully initialized: ata8: SATA link up 1.5 Gbps (SStatus 113 SControl 330) ata8.00: ATAPI: PIONEER BD-RW BDR-207M, 1.21, max UDMA/100 ata8.00: configured for UDMA/100 scsi 7:0:0:0: CD-ROM PIONEER BD-RW BDR-207M 1.21 PQ: 0 ANSI= : 5 Link: https://lore.kernel.org/r/YahpKVR+McJVDdkD@work Reported-by: Sam Bingner Tested-by: Sam Bingner Tested-by: Yifeng Li Signed-off-by: Yifeng Li Signed-off-by: Bjorn Helgaas Reviewed-by: Krzysztof Wilczy=C5=84ski Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/pci/quirks.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4134,6 +4134,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_M quirk_dma_func1_alias); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9123, quirk_dma_func1_alias); +/* https://bugzilla.kernel.org/show_bug.cgi?id=3D42679#c136 */ +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9125, + quirk_dma_func1_alias); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9128, quirk_dma_func1_alias); /* https://bugzilla.kernel.org/show_bug.cgi?id=3D42679#c14 */ From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3DE6C35276 for ; Mon, 24 Jan 2022 20:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380256AbiAXUQA (ORCPT ); Mon, 24 Jan 2022 15:16:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235574AbiAXT4j (ORCPT ); Mon, 24 Jan 2022 14:56:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10108C02B85F; Mon, 24 Jan 2022 11:27:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A74AEB81236; Mon, 24 Jan 2022 19:27:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAD40C340E5; Mon, 24 Jan 2022 19:27:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052446; bh=vSHOw0cTxQAWZazSXAgmY+JvxSWBkyxVSahW+O9oOhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wDh8bEEb0PmPWKHUENOAV5Ib8IhHz5wo7xoZfJ1Kjv/npDcB7X6+z7OaX8/yK57b9 2BfiDSC2C3SGjDu3kEBjl6M6nwtrMeEpo2ixFX+b0I7ynbBQK1SwwEfiLhlyA9CX2k 7z648Ds4QW5ZZaSlGIuRYy/vhbB0dgRpP75HZsKA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baoquan He , David Hildenbrand , John Donnelly , Christoph Hellwig , Christoph Lameter , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , David Laight , Borislav Petkov , Marek Szyprowski , Robin Murphy , Andrew Morton , Linus Torvalds Subject: [PATCH 5.4 029/320] mm_zone: add function to check if managed dma zone exists Date: Mon, 24 Jan 2022 19:40:13 +0100 Message-Id: <20220124183954.747814708@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baoquan He commit 62b3107073646e0946bd97ff926832bafb846d17 upstream. Patch series "Handle warning of allocation failure on DMA zone w/o managed pages", v4. **Problem observed: On x86_64, when crash is triggered and entering into kdump kernel, page allocation failure can always be seen. --------------------------------- DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations swapper/0: page allocation failure: order:5, mode:0xcc1(GFP_KERNEL|GFP_DMA= ), nodemask=3D(null),cpuset=3D/,mems_allowed=3D0 CPU: 0 PID: 1 Comm: swapper/0 Call Trace: dump_stack+0x7f/0xa1 warn_alloc.cold+0x72/0xd6 ...... __alloc_pages+0x24d/0x2c0 ...... dma_atomic_pool_init+0xdb/0x176 do_one_initcall+0x67/0x320 ? rcu_read_lock_sched_held+0x3f/0x80 kernel_init_freeable+0x290/0x2dc ? rest_init+0x24f/0x24f kernel_init+0xa/0x111 ret_from_fork+0x22/0x30 Mem-Info: ------------------------------------ ***Root cause: In the current kernel, it assumes that DMA zone must have managed pages and try to request pages if CONFIG_ZONE_DMA is enabled. While this is not always true. E.g in kdump kernel of x86_64, only low 1M is presented and locked down at very early stage of boot, so that this low 1M won't be added into buddy allocator to become managed pages of DMA zone. This exception will always cause page allocation failure if page is requested from DMA zone. ***Investigation: This failure happens since below commit merged into linus's tree. 1a6a9044b967 x86/setup: Remove CONFIG_X86_RESERVE_LOW and reservelow=3D o= ptions 23721c8e92f7 x86/crash: Remove crash_reserve_low_1M() f1d4d47c5851 x86/setup: Always reserve the first 1M of RAM 7c321eb2b843 x86/kdump: Remove the backup region handling 6f599d84231f x86/kdump: Always reserve the low 1M when the crashkernel op= tion is specified Before them, on x86_64, the low 640K area will be reused by kdump kernel. So in kdump kernel, the content of low 640K area is copied into a backup region for dumping before jumping into kdump. Then except of those firmware reserved region in [0, 640K], the left area will be added into buddy allocator to become available managed pages of DMA zone. However, after above commits applied, in kdump kernel of x86_64, the low 1M is reserved by memblock, but not released to buddy allocator. So any later page allocation requested from DMA zone will fail. At the beginning, if crashkernel is reserved, the low 1M need be locked down because AMD SME encrypts memory making the old backup region mechanims impossible when switching into kdump kernel. Later, it was also observed that there are BIOSes corrupting memory under 1M. To solve this, in commit f1d4d47c5851, the entire region of low 1M is always reserved after the real mode trampoline is allocated. Besides, recently, Intel engineer mentioned their TDX (Trusted domain extensions) which is under development in kernel also needs to lock down the low 1M. So we can't simply revert above commits to fix the page allocat= ion failure from DMA zone as someone suggested. ***Solution: Currently, only DMA atomic pool and dma-kmalloc will initialize and request page allocation with GFP_DMA during bootup. So only initializ DMA atomic pool when DMA zone has available managed pages, otherwise just skip the initialization. For dma-kmalloc(), for the time being, let's mute the warning of allocation failure if requesting pages from DMA zone while no manged pages. Meanwhile, change code to use dma_alloc_xx/dma_map_xx API to replace kmalloc(GFP_DMA), or do not use GFP_DMA when calling kmalloc() if not necessary. Christoph is posting patches to fix those under drivers/scsi/. Finally, we can remove the need of dma-kmalloc() as people suggested. This patch (of 3): In some places of the current kernel, it assumes that dma zone must have managed pages if CONFIG_ZONE_DMA is enabled. While this is not always true. E.g in kdump kernel of x86_64, only low 1M is presented and locked down at very early stage of boot, so that there's no managed pages at all in DMA zone. This exception will always cause page allocation failure if page is requested from DMA zone. Here add function has_managed_dma() and the relevant helper functions to check if there's DMA zone with managed pages. It will be used in later patches. Link: https://lkml.kernel.org/r/20211223094435.248523-1-bhe@redhat.com Link: https://lkml.kernel.org/r/20211223094435.248523-2-bhe@redhat.com Fixes: 6f599d84231f ("x86/kdump: Always reserve the low 1M when the crashke= rnel option is specified") Signed-off-by: Baoquan He Reviewed-by: David Hildenbrand Acked-by: John Donnelly Cc: Christoph Hellwig Cc: Christoph Lameter Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Vlastimil Babka Cc: David Laight Cc: Borislav Petkov Cc: Marek Szyprowski Cc: Robin Murphy Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- include/linux/mmzone.h | 9 +++++++++ mm/page_alloc.c | 15 +++++++++++++++ 2 files changed, 24 insertions(+) --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -929,6 +929,15 @@ static inline int is_highmem_idx(enum zo #endif } =20 +#ifdef CONFIG_ZONE_DMA +bool has_managed_dma(void); +#else +static inline bool has_managed_dma(void) +{ + return false; +} +#endif + /** * is_highmem - helper function to quickly check if a struct zone is a * highmem zone or not. This is an attempt to keep references --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -8694,3 +8694,18 @@ bool set_hwpoison_free_buddy_page(struct return hwpoisoned; } #endif + +#ifdef CONFIG_ZONE_DMA +bool has_managed_dma(void) +{ + struct pglist_data *pgdat; + + for_each_online_pgdat(pgdat) { + struct zone *zone =3D &pgdat->node_zones[ZONE_DMA]; + + if (managed_zone(zone)) + return true; + } + return false; +} +#endif /* CONFIG_ZONE_DMA */ From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBE7FC433EF for ; Mon, 24 Jan 2022 20:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380421AbiAXUQR (ORCPT ); Mon, 24 Jan 2022 15:16:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347390AbiAXT4p (ORCPT ); Mon, 24 Jan 2022 14:56:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E14DC02B865; Mon, 24 Jan 2022 11:27:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A067F60917; Mon, 24 Jan 2022 19:27:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88966C340E5; Mon, 24 Jan 2022 19:27:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052449; bh=LzOJr1Lqq1Nnk+HbsxiGbGTjhccq7HG785DI4oHNG5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZqy3sSK2ptgYZ9Hd3gixHVfz4r6yOi2lwOZf9d8gSaPQ97PH7n0jpBJ5c/vr0KMl 399exZce/aEVzqifNx9NPUIb9ucT6y0WRmkcXVHQi2g6lIAu47O8R5SA2SftZ5/34Q Uc5BeduLpb5u+tRC+0RRaCHT1AYpq5mE0bNn6/Nk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baoquan He , John Donnelly , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Borislav Petkov , Christoph Hellwig , David Hildenbrand , David Laight , Marek Szyprowski , Robin Murphy , Andrew Morton , Linus Torvalds Subject: [PATCH 5.4 030/320] mm/page_alloc.c: do not warn allocation failure on zone DMA if no managed pages Date: Mon, 24 Jan 2022 19:40:14 +0100 Message-Id: <20220124183954.783058722@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baoquan He commit c4dc63f0032c77464fbd4e7a6afc22fa6913c4a7 upstream. In kdump kernel of x86_64, page allocation failure is observed: kworker/u2:2: page allocation failure: order:0, mode:0xcc1(GFP_KERNEL|GFP_= DMA), nodemask=3D(null),cpuset=3D/,mems_allowed=3D0 CPU: 0 PID: 55 Comm: kworker/u2:2 Not tainted 5.16.0-rc4+ #5 Hardware name: AMD Dinar/Dinar, BIOS RDN1505B 06/05/2013 Workqueue: events_unbound async_run_entry_fn Call Trace: dump_stack_lvl+0x48/0x5e warn_alloc.cold+0x72/0xd6 __alloc_pages_slowpath.constprop.0+0xc69/0xcd0 __alloc_pages+0x1df/0x210 new_slab+0x389/0x4d0 ___slab_alloc+0x58f/0x770 __slab_alloc.constprop.0+0x4a/0x80 kmem_cache_alloc_trace+0x24b/0x2c0 sr_probe+0x1db/0x620 ...... device_add+0x405/0x920 ...... __scsi_add_device+0xe5/0x100 ata_scsi_scan_host+0x97/0x1d0 async_run_entry_fn+0x30/0x130 process_one_work+0x1e8/0x3c0 worker_thread+0x50/0x3b0 ? rescuer_thread+0x350/0x350 kthread+0x16b/0x190 ? set_kthread_struct+0x40/0x40 ret_from_fork+0x22/0x30 Mem-Info: ...... The above failure happened when calling kmalloc() to allocate buffer with GFP_DMA. It requests to allocate slab page from DMA zone while no managed pages at all in there. sr_probe() --> get_capabilities() --> buffer =3D kmalloc(512, GFP_KERNEL | GFP_DMA); Because in the current kernel, dma-kmalloc will be created as long as CONFIG_ZONE_DMA is enabled. However, kdump kernel of x86_64 doesn't have managed pages on DMA zone since commit 6f599d84231f ("x86/kdump: Always reserve the low 1M when the crashkernel option is specified"). The failure can be always reproduced. For now, let's mute the warning of allocation failure if requesting pages from DMA zone while no managed pages. [akpm@linux-foundation.org: fix warning] Link: https://lkml.kernel.org/r/20211223094435.248523-4-bhe@redhat.com Fixes: 6f599d84231f ("x86/kdump: Always reserve the low 1M when the crashke= rnel option is specified") Signed-off-by: Baoquan He Acked-by: John Donnelly Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Vlastimil Babka Cc: Borislav Petkov Cc: Christoph Hellwig Cc: David Hildenbrand Cc: David Laight Cc: Marek Szyprowski Cc: Robin Murphy Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- mm/page_alloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3767,7 +3767,9 @@ void warn_alloc(gfp_t gfp_mask, nodemask va_list args; static DEFINE_RATELIMIT_STATE(nopage_rs, 10*HZ, 1); =20 - if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs)) + if ((gfp_mask & __GFP_NOWARN) || + !__ratelimit(&nopage_rs) || + ((gfp_mask & __GFP_DMA) && !has_managed_dma())) return; =20 va_start(args, fmt); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C75DC433EF for ; Mon, 24 Jan 2022 19:38:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353923AbiAXTfe (ORCPT ); Mon, 24 Jan 2022 14:35:34 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50798 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351577AbiAXT1f (ORCPT ); Mon, 24 Jan 2022 14:27:35 -0500 Received: from smtp.kernel.org (relay.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 42F11B81236; Mon, 24 Jan 2022 19:27:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E9FDC340E5; Mon, 24 Jan 2022 19:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052452; bh=qNKlem9v4fNlTk6Ry4S3P7h+PCGrP7GM4X1sOXf7q+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eS17yUyGLM+gM/ajiYF9PM5xLNo9OaQK4X/Q9IX27JM4hQLc5KEAK/veOkMl8dubT 5QFJtsyT44EG4kiei+yOafRWY9NFJzWfEwsqAIkRjG9mEobgXZCZuaFYsM7UU9f4qW trdTTgPuGiXMzgcI546s5jIYkcCtvusBp2UtZ5NM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gang Li , Muchun Song , "Kirill A. Shutemov" , Hugh Dickins , Andrew Morton , Linus Torvalds Subject: [PATCH 5.4 031/320] shmem: fix a race between shmem_unused_huge_shrink and shmem_evict_inode Date: Mon, 24 Jan 2022 19:40:15 +0100 Message-Id: <20220124183954.812075129@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gang Li commit 62c9827cbb996c2c04f615ecd783ce28bcea894b upstream. Fix a data race in commit 779750d20b93 ("shmem: split huge pages beyond i_size under memory pressure"). Here are call traces causing race: Call Trace 1: shmem_unused_huge_shrink+0x3ae/0x410 ? __list_lru_walk_one.isra.5+0x33/0x160 super_cache_scan+0x17c/0x190 shrink_slab.part.55+0x1ef/0x3f0 shrink_node+0x10e/0x330 kswapd+0x380/0x740 kthread+0xfc/0x130 ? mem_cgroup_shrink_node+0x170/0x170 ? kthread_create_on_node+0x70/0x70 ret_from_fork+0x1f/0x30 Call Trace 2: shmem_evict_inode+0xd8/0x190 evict+0xbe/0x1c0 do_unlinkat+0x137/0x330 do_syscall_64+0x76/0x120 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 A simple explanation: Image there are 3 items in the local list (@list). In the first traversal, A is not deleted from @list. 1) A->B->C ^ | pos (leave) In the second traversal, B is deleted from @list. Concurrently, A is deleted from @list through shmem_evict_inode() since last reference counter of inode is dropped by other thread. Then the @list is corrupted. 2) A->B->C ^ ^ | | evict pos (drop) We should make sure the inode is either on the global list or deleted from any local list before iput(). Fixed by moving inodes back to global list before we put them. [akpm@linux-foundation.org: coding style fixes] Link: https://lkml.kernel.org/r/20211125064502.99983-1-ligang.bdlg@bytedanc= e.com Fixes: 779750d20b93 ("shmem: split huge pages beyond i_size under memory pr= essure") Signed-off-by: Gang Li Reviewed-by: Muchun Song Acked-by: Kirill A. Shutemov Cc: Hugh Dickins Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- mm/shmem.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) --- a/mm/shmem.c +++ b/mm/shmem.c @@ -466,7 +466,7 @@ static unsigned long shmem_unused_huge_s struct shmem_inode_info *info; struct page *page; unsigned long batch =3D sc ? sc->nr_to_scan : 128; - int removed =3D 0, split =3D 0; + int split =3D 0; =20 if (list_empty(&sbinfo->shrinklist)) return SHRINK_STOP; @@ -481,7 +481,6 @@ static unsigned long shmem_unused_huge_s /* inode is about to be evicted */ if (!inode) { list_del_init(&info->shrinklist); - removed++; goto next; } =20 @@ -489,12 +488,12 @@ static unsigned long shmem_unused_huge_s if (round_up(inode->i_size, PAGE_SIZE) =3D=3D round_up(inode->i_size, HPAGE_PMD_SIZE)) { list_move(&info->shrinklist, &to_remove); - removed++; goto next; } =20 list_move(&info->shrinklist, &list); next: + sbinfo->shrinklist_len--; if (!--batch) break; } @@ -514,7 +513,7 @@ next: inode =3D &info->vfs_inode; =20 if (nr_to_split && split >=3D nr_to_split) - goto leave; + goto move_back; =20 page =3D find_get_page(inode->i_mapping, (inode->i_size & HPAGE_PMD_MASK) >> PAGE_SHIFT); @@ -528,38 +527,44 @@ next: } =20 /* - * Leave the inode on the list if we failed to lock - * the page at this time. + * Move the inode on the list back to shrinklist if we failed + * to lock the page at this time. * * Waiting for the lock may lead to deadlock in the * reclaim path. */ if (!trylock_page(page)) { put_page(page); - goto leave; + goto move_back; } =20 ret =3D split_huge_page(page); unlock_page(page); put_page(page); =20 - /* If split failed leave the inode on the list */ + /* If split failed move the inode on the list back to shrinklist */ if (ret) - goto leave; + goto move_back; =20 split++; drop: list_del_init(&info->shrinklist); - removed++; -leave: + goto put; +move_back: + /* + * Make sure the inode is either on the global list or deleted + * from any local list before iput() since it could be deleted + * in another thread once we put the inode (then the local list + * is corrupted). + */ + spin_lock(&sbinfo->shrinklist_lock); + list_move(&info->shrinklist, &sbinfo->shrinklist); + sbinfo->shrinklist_len++; + spin_unlock(&sbinfo->shrinklist_lock); +put: iput(inode); } =20 - spin_lock(&sbinfo->shrinklist_lock); - list_splice_tail(&list, &sbinfo->shrinklist); - sbinfo->shrinklist_len -=3D removed; - spin_unlock(&sbinfo->shrinklist_lock); - return split; } =20 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C40FC4167B for ; Mon, 24 Jan 2022 20:29:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383485AbiAXU1Q (ORCPT ); Mon, 24 Jan 2022 15:27:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352050AbiAXT5G (ORCPT ); Mon, 24 Jan 2022 14:57:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE679C047CC4; Mon, 24 Jan 2022 11:27:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6FD59612A5; Mon, 24 Jan 2022 19:27:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50EC9C340E5; Mon, 24 Jan 2022 19:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052454; bh=9a+xHoltRu03sANkBxiaS+KPP2yivPNWUQ+VE4R/e6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZkoPccDXIYSe17eIotLjE6GrupkazGfRr8Wq3VkdVN4tQ5P1r6LsnX6H0RIe2UCo4 Mc4C/GngznZa+SeQshMZax1gBMctBm14p1mSy9ivHA967oHB256p0yIgpb2Ld31Evj Owk9zn+mFKlIVqTYRr6o4NxHeKop4EBJ+1YGAEj0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, aleksandr.o.makarov@gmail.com, Brian Norris , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Chen-Yu Tsai , Heiko Stuebner Subject: [PATCH 5.4 032/320] drm/rockchip: dsi: Hold pm-runtime across bind/unbind Date: Mon, 24 Jan 2022 19:40:16 +0100 Message-Id: <20220124183954.848066075@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Brian Norris commit 514db871922f103886ad4d221cf406b4fcc5e74a upstream. In commit 43c2de1002d2 ("drm/rockchip: dsi: move all lane config except LCDC mux to bind()"), we moved most HW configuration to bind(), but we didn't move the runtime PM management. Therefore, depending on initial boot state, runtime-PM workqueue delays, and other timing factors, we may disable our power domain in between the hardware configuration (bind()) and when we enable the display. This can cause us to lose hardware state and fail to configure our display. For example: dw-mipi-dsi-rockchip ff968000.mipi: failed to write command FIFO panel-innolux-p079zca ff960000.mipi.0: failed to write command 0 or: dw-mipi-dsi-rockchip ff968000.mipi: failed to write command FIFO panel-kingdisplay-kd097d04 ff960000.mipi.0: failed write init cmds: -110 We should match the runtime PM to the lifetime of the bind()/unbind() cycle. Tested on Acer Chrometab 10 (RK3399 Gru-Scarlet), with panel drivers built either as modules or built-in. Side notes: it seems one is more likely to see this problem when the panel driver is built into the kernel. I've also seen this problem bisect down to commits that simply changed Kconfig dependencies, because it changed the order in which driver init functions were compiled into the kernel, and therefore the ordering and timing of built-in device probe. Fixes: 43c2de1002d2 ("drm/rockchip: dsi: move all lane config except LCDC m= ux to bind()") Link: https://lore.kernel.org/linux-rockchip/9aedfb528600ecf871885f7293ca42= 07c84d16c1.camel@gmail.com/ Reported-by: Cc: Signed-off-by: Brian Norris Tested-by: N=C3=ADcolas F. R. A. Prado Reviewed-by: Chen-Yu Tsai Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20210928143413.v3.1.Ic2= 904d37f30013a7f3d8476203ad3733c186827e@changeid Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 37 ++++++++++++-------= ----- 1 file changed, 19 insertions(+), 18 deletions(-) --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -625,10 +625,6 @@ static void dw_mipi_dsi_encoder_enable(s if (mux < 0) return; =20 - pm_runtime_get_sync(dsi->dev); - if (dsi->slave) - pm_runtime_get_sync(dsi->slave->dev); - /* * For the RK3399, the clk of grf must be enabled before writing grf * register. And for RK3288 or other soc, this grf_clk must be NULL, @@ -647,20 +643,10 @@ static void dw_mipi_dsi_encoder_enable(s clk_disable_unprepare(dsi->grf_clk); } =20 -static void dw_mipi_dsi_encoder_disable(struct drm_encoder *encoder) -{ - struct dw_mipi_dsi_rockchip *dsi =3D to_dsi(encoder); - - if (dsi->slave) - pm_runtime_put(dsi->slave->dev); - pm_runtime_put(dsi->dev); -} - static const struct drm_encoder_helper_funcs dw_mipi_dsi_encoder_helper_funcs =3D { .atomic_check =3D dw_mipi_dsi_encoder_atomic_check, .enable =3D dw_mipi_dsi_encoder_enable, - .disable =3D dw_mipi_dsi_encoder_disable, }; =20 static const struct drm_encoder_funcs dw_mipi_dsi_encoder_funcs =3D { @@ -795,10 +781,14 @@ static int dw_mipi_dsi_rockchip_bind(str put_device(second); } =20 + pm_runtime_get_sync(dsi->dev); + if (dsi->slave) + pm_runtime_get_sync(dsi->slave->dev); + ret =3D clk_prepare_enable(dsi->pllref_clk); if (ret) { DRM_DEV_ERROR(dev, "Failed to enable pllref_clk: %d\n", ret); - return ret; + goto out_pm_runtime; } =20 /* @@ -810,7 +800,7 @@ static int dw_mipi_dsi_rockchip_bind(str ret =3D clk_prepare_enable(dsi->grf_clk); if (ret) { DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); - return ret; + goto out_pm_runtime; } =20 dw_mipi_dsi_rockchip_config(dsi); @@ -822,16 +812,23 @@ static int dw_mipi_dsi_rockchip_bind(str ret =3D rockchip_dsi_drm_create_encoder(dsi, drm_dev); if (ret) { DRM_DEV_ERROR(dev, "Failed to create drm encoder\n"); - return ret; + goto out_pm_runtime; } =20 ret =3D dw_mipi_dsi_bind(dsi->dmd, &dsi->encoder); if (ret) { DRM_DEV_ERROR(dev, "Failed to bind: %d\n", ret); - return ret; + goto out_pm_runtime; } =20 return 0; + +out_pm_runtime: + pm_runtime_put(dsi->dev); + if (dsi->slave) + pm_runtime_put(dsi->slave->dev); + + return ret; } =20 static void dw_mipi_dsi_rockchip_unbind(struct device *dev, @@ -846,6 +843,10 @@ static void dw_mipi_dsi_rockchip_unbind( dw_mipi_dsi_unbind(dsi->dmd); =20 clk_disable_unprepare(dsi->pllref_clk); + + pm_runtime_put(dsi->dev); + if (dsi->slave) + pm_runtime_put(dsi->slave->dev); } =20 static const struct component_ops dw_mipi_dsi_rockchip_ops =3D { From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECBB6C4332F for ; Mon, 24 Jan 2022 20:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380460AbiAXUQW (ORCPT ); Mon, 24 Jan 2022 15:16:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352132AbiAXT5K (ORCPT ); Mon, 24 Jan 2022 14:57:10 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1915C047CCC; Mon, 24 Jan 2022 11:27:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 51A7261489; Mon, 24 Jan 2022 19:27:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30CD5C340E5; Mon, 24 Jan 2022 19:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052457; bh=tCpkJdo/lVhf/9FgRTea5S8mpKM/e4FwMDtYImGTn0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EaFy3bWH26c/tYxvVmdMe4mRrDjAc9l1Dj7cCiqIaLsZ5P84ENm6BFtGaCF7Hih3c vSzuDTSsqr3DEpVpWlxbNsUKCEpvqJPqTvXI1VXD2oCQKwpsw8W/kYqiGak231WWnC xXNchRwQvppQfF2/dWdxudjS9aG39r4betxmd05c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Chen-Yu Tsai , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Heiko Stuebner Subject: [PATCH 5.4 033/320] drm/rockchip: dsi: Reconfigure hardware on resume() Date: Mon, 24 Jan 2022 19:40:17 +0100 Message-Id: <20220124183954.879107046@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Brian Norris commit e584cdc1549932f87a2707b56bc588cfac5d89e0 upstream. Since commit 43c2de1002d2 ("drm/rockchip: dsi: move all lane config except LCDC mux to bind()"), we perform most HW configuration in the bind() function. This configuration may be lost on suspend/resume, so we need to call it again. That may lead to errors like this after system suspend/resume: dw-mipi-dsi-rockchip ff968000.mipi: failed to write command FIFO panel-kingdisplay-kd097d04 ff960000.mipi.0: failed write init cmds: -110 Tested on Acer Chromebook Tab 10 (RK3399 Gru-Scarlet). Note that early mailing list versions of this driver borrowed Rockchip's downstream/BSP solution, to do HW configuration in mode_set() (which *is* called at the appropriate pre-enable() times), but that was discarded along the way. I've avoided that still, because mode_set() documentation doesn't suggest this kind of purpose as far as I can tell. Fixes: 43c2de1002d2 ("drm/rockchip: dsi: move all lane config except LCDC m= ux to bind()") Cc: Signed-off-by: Brian Norris Reviewed-by: Chen-Yu Tsai Tested-by: N=C3=ADcolas F. R. A. Prado Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20210928143413.v3.2.I4e= 9d93aadb00b1ffc7d506e3186a25492bf0b732@changeid Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 37 +++++++++++++++++++= +++++ 1 file changed, 37 insertions(+) --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -231,6 +231,8 @@ struct dw_mipi_dsi_rockchip { struct dw_mipi_dsi *dmd; const struct rockchip_dw_dsi_chip_data *cdata; struct dw_mipi_dsi_plat_data pdata; + + bool dsi_bound; }; =20 struct dphy_pll_parameter_map { @@ -821,6 +823,8 @@ static int dw_mipi_dsi_rockchip_bind(str goto out_pm_runtime; } =20 + dsi->dsi_bound =3D true; + return 0; =20 out_pm_runtime: @@ -840,6 +844,8 @@ static void dw_mipi_dsi_rockchip_unbind( if (dsi->is_slave) return; =20 + dsi->dsi_bound =3D false; + dw_mipi_dsi_unbind(dsi->dmd); =20 clk_disable_unprepare(dsi->pllref_clk); @@ -904,6 +910,36 @@ static const struct dw_mipi_dsi_host_ops .detach =3D dw_mipi_dsi_rockchip_host_detach, }; =20 +static int __maybe_unused dw_mipi_dsi_rockchip_resume(struct device *dev) +{ + struct dw_mipi_dsi_rockchip *dsi =3D dev_get_drvdata(dev); + int ret; + + /* + * Re-configure DSI state, if we were previously initialized. We need + * to do this before rockchip_drm_drv tries to re-enable() any panels. + */ + if (dsi->dsi_bound) { + ret =3D clk_prepare_enable(dsi->grf_clk); + if (ret) { + DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); + return ret; + } + + dw_mipi_dsi_rockchip_config(dsi); + if (dsi->slave) + dw_mipi_dsi_rockchip_config(dsi->slave); + + clk_disable_unprepare(dsi->grf_clk); + } + + return 0; +} + +static const struct dev_pm_ops dw_mipi_dsi_rockchip_pm_ops =3D { + SET_LATE_SYSTEM_SLEEP_PM_OPS(NULL, dw_mipi_dsi_rockchip_resume) +}; + static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -1089,6 +1125,7 @@ struct platform_driver dw_mipi_dsi_rockc .remove =3D dw_mipi_dsi_rockchip_remove, .driver =3D { .of_match_table =3D dw_mipi_dsi_rockchip_dt_ids, + .pm =3D &dw_mipi_dsi_rockchip_pm_ops, .name =3D "dw-mipi-dsi-rockchip", }, }; From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 766D5C433F5 for ; Mon, 24 Jan 2022 19:37:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348520AbiAXTed (ORCPT ); Mon, 24 Jan 2022 14:34:33 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48994 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351152AbiAXT0E (ORCPT ); Mon, 24 Jan 2022 14:26:04 -0500 Received: from smtp.kernel.org (relay.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 8A2A4B8121A; Mon, 24 Jan 2022 19:26:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80ED6C340E5; Mon, 24 Jan 2022 19:26:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052362; bh=ZYoNT/gKCF32h7AuxcVFTRr05fgo4y6nVkWi1qiO7ks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cxAXBC9mUDIp13dJYDGLDL6vf1iDp4cphOJ8919jiKbm3QMFJJIvHGbzCyN6xfaQ5 2srBJiKmt0fcfWFw3nU8+8jZ3pyorI7w3uoTWN7MhHC35zT6/PeldI1toGFSoKtOzs AiI3Lc3clHto8lYD2KQsdEuT2lfaPFTyqjRun1Ss= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Sam Ravnborg , Sasha Levin Subject: [PATCH 5.4 034/320] drm/panel: kingdisplay-kd097d04: Delete panel on attach() failure Date: Mon, 24 Jan 2022 19:40:18 +0100 Message-Id: <20220124183954.911443634@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris [ Upstream commit 5f31dbeae8a88f31c3eb4eb526ab4807c40da241 ] If we fail to attach (e.g., because 1 of 2 dual-DSI controllers aren't ready), we leave a dangling drm_panel reference to freed memory. Clean that up on failure. Fixes: 2a994cbed6b2 ("drm/panel: Add Kingdisplay KD097D04 panel driver") Signed-off-by: Brian Norris Signed-off-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20210923173336.1.Icb4d9= dbc1817f4e826361a4f1cea7461541668f0@changeid Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/g= pu/drm/panel/panel-kingdisplay-kd097d04.c index 3ac04eb8d0fe5..1e7fecab72a9f 100644 --- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c +++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c @@ -424,7 +424,13 @@ static int kingdisplay_panel_probe(struct mipi_dsi_dev= ice *dsi) if (err < 0) return err; =20 - return mipi_dsi_attach(dsi); + err =3D mipi_dsi_attach(dsi); + if (err < 0) { + kingdisplay_panel_del(kingdisplay); + return err; + } + + return 0; } =20 static int kingdisplay_panel_remove(struct mipi_dsi_device *dsi) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF86BC433F5 for ; Mon, 24 Jan 2022 19:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353403AbiAXTek (ORCPT ); Mon, 24 Jan 2022 14:34:40 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49014 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351180AbiAXT0I (ORCPT ); Mon, 24 Jan 2022 14:26:08 -0500 Received: from smtp.kernel.org (relay.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 72EDFB81232; Mon, 24 Jan 2022 19:26:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1F1BC340E5; Mon, 24 Jan 2022 19:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052365; bh=MAqNBqkJY10xt9ZfgsqlIb9d8Hthqug4RgrqoOKK6xU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eB3TJV5YOEZ1WmC3e1RfIUszW70UqzgaMm+/3Ak8ksMy8O5EPZitmyic+isvWJ9Ic OJ4XR2Q4V5ix4aKLQ6Dt2jzNWvFmi39zOSjWo6ZfIB1sGPxyqBJA5NSES+PnyDAv28 3hYbzvEWeHIkSrN/ZK5FytwRnk1srqSrwcpRRAMI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Sam Ravnborg , Sasha Levin Subject: [PATCH 5.4 035/320] drm/panel: innolux-p079zca: Delete panel on attach() failure Date: Mon, 24 Jan 2022 19:40:19 +0100 Message-Id: <20220124183954.942378834@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris [ Upstream commit 32a267e9c057e1636e7afdd20599aa5741a73079 ] If we fail to attach (e.g., because 1 of 2 dual-DSI controllers aren't ready), we leave a dangling drm_panel reference to freed memory. Clean that up on failure. This problem exists since the driver's introduction, but is especially relevant after refactored for dual-DSI variants. Fixes: 14c8f2e9f8ea ("drm/panel: add Innolux P079ZCA panel driver") Fixes: 7ad4e4636c54 ("drm/panel: p079zca: Refactor panel driver to support = multiple panels") Signed-off-by: Brian Norris Signed-off-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20210923173336.2.I9023c= f8811a3abf4964ed84eb681721d8bb489d6@changeid Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/panel/panel-innolux-p079zca.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/dr= m/panel/panel-innolux-p079zca.c index d92d1c98878c1..df90b66079816 100644 --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c @@ -509,6 +509,7 @@ static void innolux_panel_del(struct innolux_panel *inn= olux) static int innolux_panel_probe(struct mipi_dsi_device *dsi) { const struct panel_desc *desc; + struct innolux_panel *innolux; int err; =20 desc =3D of_device_get_match_data(&dsi->dev); @@ -520,7 +521,14 @@ static int innolux_panel_probe(struct mipi_dsi_device = *dsi) if (err < 0) return err; =20 - return mipi_dsi_attach(dsi); + err =3D mipi_dsi_attach(dsi); + if (err < 0) { + innolux =3D mipi_dsi_get_drvdata(dsi); + innolux_panel_del(innolux); + return err; + } + + return 0; } =20 static int innolux_panel_remove(struct mipi_dsi_device *dsi) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 215F8C4332F for ; Mon, 24 Jan 2022 19:37:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353463AbiAXTep (ORCPT ); Mon, 24 Jan 2022 14:34:45 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53838 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351195AbiAXT0K (ORCPT ); Mon, 24 Jan 2022 14:26:10 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D2C9E60BB9; Mon, 24 Jan 2022 19:26:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3B38C340E5; Mon, 24 Jan 2022 19:26:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052368; bh=DU3CIw3p50KSKQOPg73wZG2FU2DsWzcnpkARL7xOBgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oLsZQQBrFp/dTzspCjDI3uyxslHknsdGV9FbJhmZdRRCq+hgrE3wTyG8KFHFaLGfC xuJ/r/AV/CdChrQ+YnVwFCxbeOD3Yq+oPOt1ZeD1U0kD1TamkzrU9M9McbdEXmiTfP HmsX2IoLQqK8jvbWfyU8Zk03R3im5PjHKhdi3yGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Chen-Yu Tsai , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.4 036/320] drm/rockchip: dsi: Fix unbalanced clock on probe error Date: Mon, 24 Jan 2022 19:40:20 +0100 Message-Id: <20220124183954.978288662@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Brian Norris [ Upstream commit 251888398753924059f3bb247a44153a2853137f ] Our probe() function never enabled this clock, so we shouldn't disable it if we fail to probe the bridge. Noted by inspection. Fixes: 2d4f7bdafd70 ("drm/rockchip: dsi: migrate to use dw-mipi-dsi bridge = driver") Signed-off-by: Brian Norris Reviewed-by: Chen-Yu Tsai Tested-by: N=C3=ADcolas F. R. A. Prado Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20210928143413.v3.3.Ie8= ceefb51ab6065a1151869b6fcda41a467d4d2c@changeid Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -1023,14 +1023,10 @@ static int dw_mipi_dsi_rockchip_probe(st if (ret !=3D -EPROBE_DEFER) DRM_DEV_ERROR(dev, "Failed to probe dw_mipi_dsi: %d\n", ret); - goto err_clkdisable; + return ret; } =20 return 0; - -err_clkdisable: - clk_disable_unprepare(dsi->pllref_clk); - return ret; } =20 static int dw_mipi_dsi_rockchip_remove(struct platform_device *pdev) From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 695AEC43219 for ; Mon, 24 Jan 2022 19:37:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353507AbiAXTev (ORCPT ); Mon, 24 Jan 2022 14:34:51 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49276 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351230AbiAXT0N (ORCPT ); Mon, 24 Jan 2022 14:26:13 -0500 Received: from smtp.kernel.org (relay.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 76487B81215; Mon, 24 Jan 2022 19:26:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D667CC340E5; Mon, 24 Jan 2022 19:26:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052371; bh=5mn8xY2Rw2yKpuokmAWh9/JaNI4qxPL/snAS97h6juY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dOTH3XaZl5yYBguUNO/G6KM5EmJNdohXxKeyLFWqOlZn5v2urvQxpev9x4gY05qh6 ISXaPQqmgHQ0583d6BME7xbUPzFULUJCDd78UPVqErA8ovqs67govj7LPYuCDBQPgW JqAJL0/8X8WN+G6Khsie5SBSQsKV+QVkoluYxsAM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Hai , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.4 037/320] Bluetooth: cmtp: fix possible panic when cmtp_init_sockets() fails Date: Mon, 24 Jan 2022 19:40:21 +0100 Message-Id: <20220124183955.010672799@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wang Hai [ Upstream commit 2a7ca7459d905febf519163bd9e3eed894de6bb7 ] I got a kernel BUG report when doing fault injection test: Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:45! ... RIP: 0010:__list_del_entry_valid.cold+0x12/0x4d ... Call Trace: proto_unregister+0x83/0x220 cmtp_cleanup_sockets+0x37/0x40 [cmtp] cmtp_exit+0xe/0x1f [cmtp] do_syscall_64+0x35/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xae If cmtp_init_sockets() in cmtp_init() fails, cmtp_init() still returns success. This will cause a kernel bug when accessing uncreated ctmp related data when the module exits. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Hulk Robot Signed-off-by: Wang Hai Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- net/bluetooth/cmtp/core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index 0a2d78e811cf5..83eb84e8e688f 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c @@ -501,9 +501,7 @@ static int __init cmtp_init(void) { BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION); =20 - cmtp_init_sockets(); - - return 0; + return cmtp_init_sockets(); } =20 static void __exit cmtp_exit(void) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C14AC46467 for ; Mon, 24 Jan 2022 20:11:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379197AbiAXUKe (ORCPT ); Mon, 24 Jan 2022 15:10:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352195AbiAXTwp (ORCPT ); Mon, 24 Jan 2022 14:52:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB36DC061394; Mon, 24 Jan 2022 11:26:16 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7286CB81239; Mon, 24 Jan 2022 19:26:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90EB5C340E5; Mon, 24 Jan 2022 19:26:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052374; bh=l2qkhwyajAQCjSYqn/KNwyizSyty6BnN/EXpCzFQ+wo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tLW8eWyoX1+p02EU0QUytJiG+npQONmDhc1fatLSU7/guTU/fPsJrMGzhBQFOWNQr AyVep+D4wolJ3HWpddkHuHTsdjJ/3djIeQH7QGvmz8rXkSf6Rrftxtb3/k4Y9rAcjE Q5rpfscjmnVTkmzi9kYigTqRk2/YHP9fvxByMWXQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Stephen Boyd , Nicolas Saenz Julienne , Michael Stapelberg , Sasha Levin Subject: [PATCH 5.4 038/320] clk: bcm-2835: Pick the closest clock rate Date: Mon, 24 Jan 2022 19:40:22 +0100 Message-Id: <20220124183955.050123837@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit 5517357a4733d7cf7c17fc79d0530cfa47add372 ] The driver currently tries to pick the closest rate that is lower than the rate being requested. This causes an issue with clk_set_min_rate() since it actively checks for the rounded rate to be above the minimum that was just set. Let's change the logic a bit to pick the closest rate to the requested rate, no matter if it's actually higher or lower. Fixes: 6d18b8adbe67 ("clk: bcm2835: Support for clock parent selection") Signed-off-by: Maxime Ripard Acked-by: Stephen Boyd Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne # boot and basic func= tionality Tested-by: Michael Stapelberg Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-= 2-maxime@cerno.tech Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/clk/bcm/clk-bcm2835.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index c5486537b9284..b2af320d1b6c5 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -1216,7 +1216,7 @@ static int bcm2835_clock_determine_rate(struct clk_hw= *hw, rate =3D bcm2835_clock_choose_div_and_prate(hw, i, req->rate, &div, &prate, &avgrate); - if (rate > best_rate && rate <=3D req->rate) { + if (abs(req->rate - rate) < abs(req->rate - best_rate)) { best_parent =3D parent; best_prate =3D prate; best_rate =3D rate; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A369BC4321E for ; Mon, 24 Jan 2022 19:37:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353530AbiAXTe4 (ORCPT ); Mon, 24 Jan 2022 14:34:56 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53914 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351281AbiAXT0S (ORCPT ); Mon, 24 Jan 2022 14:26:18 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 99AB961488; Mon, 24 Jan 2022 19:26:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4F67C340E5; Mon, 24 Jan 2022 19:26:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052377; bh=72uVLfWtCUTcy40tSIsRs3Qyj1G0Z5DXq+tMgL7Yfqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L9QzUtzUbdFeAz7VdbD1eimFhCqzX0+QveElqTaHnMAu+quz/tE+5LMmQXeYQVSVE wAhlVlUrJeTyQQmdpkRi+S8TXw/XIahpf2w2LkjNXYj/Tc9LxaYvO5HJr/sYZyyMKN tx7LHd+httazakaCBgPOAg3lEH0OVl5ZwUZcPWKI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Stephen Boyd , Nicolas Saenz Julienne , Michael Stapelberg , Sasha Levin Subject: [PATCH 5.4 039/320] clk: bcm-2835: Remove rounding up the dividers Date: Mon, 24 Jan 2022 19:40:23 +0100 Message-Id: <20220124183955.088147075@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit 8ca011ef4af48a7af7b15afd8a4a44039dd04cea ] The driver, once it found a divider, tries to round it up by increasing the least significant bit of the fractional part by one when the round_up argument is set and there's a remainder. However, since it increases the divider it will actually reduce the clock rate below what we were asking for, leading to issues with clk_set_min_rate() that will complain that our rounded clock rate is below the minimum of the rate. Since the dividers are fairly precise already, let's remove that part so that we can have clk_set_min_rate() working. This is effectively a revert of 9c95b32ca093 ("clk: bcm2835: add a round up ability to the clock divisor"). Fixes: 9c95b32ca093 ("clk: bcm2835: add a round up ability to the clock div= isor") Signed-off-by: Maxime Ripard Acked-by: Stephen Boyd Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne # boot and basic func= tionality Tested-by: Michael Stapelberg Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-= 3-maxime@cerno.tech Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/clk/bcm/clk-bcm2835.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index b2af320d1b6c5..e637bd6b295bd 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -932,8 +932,7 @@ static int bcm2835_clock_is_on(struct clk_hw *hw) =20 static u32 bcm2835_clock_choose_div(struct clk_hw *hw, unsigned long rate, - unsigned long parent_rate, - bool round_up) + unsigned long parent_rate) { struct bcm2835_clock *clock =3D bcm2835_clock_from_hw(hw); const struct bcm2835_clock_data *data =3D clock->data; @@ -945,10 +944,6 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, =20 rem =3D do_div(temp, rate); div =3D temp; - - /* Round up and mask off the unused bits */ - if (round_up && ((div & unused_frac_mask) !=3D 0 || rem !=3D 0)) - div +=3D unused_frac_mask + 1; div &=3D ~unused_frac_mask; =20 /* different clamping limits apply for a mash clock */ @@ -1079,7 +1074,7 @@ static int bcm2835_clock_set_rate(struct clk_hw *hw, struct bcm2835_clock *clock =3D bcm2835_clock_from_hw(hw); struct bcm2835_cprman *cprman =3D clock->cprman; const struct bcm2835_clock_data *data =3D clock->data; - u32 div =3D bcm2835_clock_choose_div(hw, rate, parent_rate, false); + u32 div =3D bcm2835_clock_choose_div(hw, rate, parent_rate); u32 ctl; =20 spin_lock(&cprman->regs_lock); @@ -1130,7 +1125,7 @@ static unsigned long bcm2835_clock_choose_div_and_pra= te(struct clk_hw *hw, =20 if (!(BIT(parent_idx) & data->set_rate_parent)) { *prate =3D clk_hw_get_rate(parent); - *div =3D bcm2835_clock_choose_div(hw, rate, *prate, true); + *div =3D bcm2835_clock_choose_div(hw, rate, *prate); =20 *avgrate =3D bcm2835_clock_rate_from_divisor(clock, *prate, *div); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A36CC433EF for ; Mon, 24 Jan 2022 19:37:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353577AbiAXTfA (ORCPT ); Mon, 24 Jan 2022 14:35:00 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53936 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351307AbiAXT0V (ORCPT ); Mon, 24 Jan 2022 14:26:21 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B1BD26148F; Mon, 24 Jan 2022 19:26:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CE9AC340E5; Mon, 24 Jan 2022 19:26:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052380; bh=r6e+fF/5rc9o7aH9xY3L04cGqonlLwRa/MfShbrQAt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xesPHjdpYC/LqnucsgcwM7KcaNI2KR6AZ9c2kofIIqKt2UvJWJ0LrDodYtqmTHVzr se456peV1cwMQf/QEt6kcKUm+A20rTJ7zpZWv/J/TzTPikJo8rehmbNyteMnu06Pvd TaYl5wSunoujCQTraL5eB8J7fDVO8anXwB48JGxA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Kalle Valo , Sasha Levin Subject: [PATCH 5.4 040/320] wcn36xx: Indicate beacon not connection loss on MISSED_BEACON_IND Date: Mon, 24 Jan 2022 19:40:24 +0100 Message-Id: <20220124183955.120302955@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 588b45c88ae130fe373a8c50edaf54735c3f4fe3 ] Firmware can trigger a missed beacon indication, this is not the same as a lost signal. Flag to Linux the missed beacon and let the WiFi stack decide for itself if the link is up or down by sending its own probe to determine this. We should only be signalling the link is lost when the firmware indicates Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680= hardware") Signed-off-by: Bryan O'Donoghue Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211027232529.657764-1-bryan.odonoghue@lin= aro.org Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/wireless/ath/wcn36xx/smd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/= ath/wcn36xx/smd.c index a7532028bf9db..74cf173c186ff 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2311,7 +2311,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct wcn36= xx *wcn, wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n", tmp->bss_index); vif =3D wcn36xx_priv_to_vif(tmp); - ieee80211_connection_loss(vif); + ieee80211_beacon_loss(vif); } return 0; } @@ -2326,7 +2326,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct wcn36= xx *wcn, wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n", rsp->bss_index); vif =3D wcn36xx_priv_to_vif(tmp); - ieee80211_connection_loss(vif); + ieee80211_beacon_loss(vif); return 0; } } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BEAEC35273 for ; Mon, 24 Jan 2022 20:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355924AbiAXUOo (ORCPT ); Mon, 24 Jan 2022 15:14:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351783AbiAXTwn (ORCPT ); Mon, 24 Jan 2022 14:52:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 164BEC061395; Mon, 24 Jan 2022 11:26:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AA6ED6148C; Mon, 24 Jan 2022 19:26:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77DCEC340E5; Mon, 24 Jan 2022 19:26:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052383; bh=XLSLNSZKrLzuOonGSWPffYXKyT9mQ/W4Hk3kFvBGZ7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W2VLwLU9uUR4fVbgRClcD8tSODYdIaNLk34lv3IrCd5iiMBM9hscCSxn/VJffAOmP Uurs0c99VcKCCAP/9DFxjmYoW/l6BECHGzXAFtSTbr9BJl2Gzm9TjoUOVu2ujbiaqf IfTupIxC2yRSmjRV69JZ9H8Cx35HnG1tD15EuvbE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Kalle Valo , Sasha Levin Subject: [PATCH 5.4 041/320] wcn36xx: Release DMA channel descriptor allocations Date: Mon, 24 Jan 2022 19:40:25 +0100 Message-Id: <20220124183955.151421264@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 3652096e5263ad67604b0323f71d133485f410e5 ] When unloading the driver we are not releasing the DMA descriptors which we previously allocated. Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680= hardware") Signed-off-by: Bryan O'Donoghue Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211105122152.1580542-3-bryan.odonoghue@li= naro.org Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/wireless/ath/wcn36xx/dxe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/= ath/wcn36xx/dxe.c index 4da25e84793b7..c400261352bc8 100644 --- a/drivers/net/wireless/ath/wcn36xx/dxe.c +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c @@ -952,4 +952,9 @@ void wcn36xx_dxe_deinit(struct wcn36xx *wcn) =20 wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_l_ch); wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_h_ch); + + wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_tx_l_ch); + wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_tx_h_ch); + wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_rx_l_ch); + wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_rx_h_ch); } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFE7CC35268 for ; Mon, 24 Jan 2022 19:37:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353604AbiAXTfC (ORCPT ); Mon, 24 Jan 2022 14:35:02 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49556 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344211AbiAXT03 (ORCPT ); Mon, 24 Jan 2022 14:26:29 -0500 Received: from smtp.kernel.org (relay.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 6ACDEB8121C; Mon, 24 Jan 2022 19:26:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 972DFC340E5; Mon, 24 Jan 2022 19:26:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052386; bh=66NPtosod8Ok5mYiep4rLe3S9UA9BN0GARK4K96mHsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lUdz36eQJpaXpLwP6XDhLOCzBux5uTlixxai62XjPd0WJvj8ZA34eItYI5/wW5CY1 fWO5piRWzGdMbUapeEOs7ukRqC//JMBZRnXtjgps4Kik1hRXomcvc8ugIUWGgwb1Ld 4b5xr7WaEWATKJyk52wBbvhende++zsuMGpJK3Bw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dillon Min , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 042/320] media: videobuf2: Fix the size printk format Date: Mon, 24 Jan 2022 19:40:26 +0100 Message-Id: <20220124183955.184939952@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dillon Min [ Upstream commit c9ee220d76775e42f35d634479c978d9350077d3 ] Since the type of parameter size is unsigned long, it should printk by %lu, instead of %ld, fix it. Fixes: 7952be9b6ece ("media: drivers/media/common/videobuf2: rename from vi= deobuf") Signed-off-by: Dillon Min Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/common/videobuf2/videobuf2-dma-contig.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/driver= s/media/common/videobuf2/videobuf2-dma-contig.c index 44cd0e530bbd3..093ebe6f279f7 100644 --- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c @@ -154,7 +154,7 @@ static void *vb2_dc_alloc(struct device *dev, unsigned = long attrs, buf->cookie =3D dma_alloc_attrs(dev, size, &buf->dma_addr, GFP_KERNEL | gfp_flags, buf->attrs); if (!buf->cookie) { - dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size); + dev_err(dev, "dma_alloc_coherent of size %lu failed\n", size); kfree(buf); return ERR_PTR(-ENOMEM); } @@ -200,9 +200,9 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_s= truct *vma) =20 vma->vm_ops->open(vma); =20 - pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %ld\n", - __func__, (unsigned long)buf->dma_addr, vma->vm_start, - buf->size); + pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %lu\n", + __func__, (unsigned long)buf->dma_addr, vma->vm_start, + buf->size); =20 return 0; } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D823C433EF for ; Mon, 24 Jan 2022 19:58:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350021AbiAXT6N (ORCPT ); Mon, 24 Jan 2022 14:58:13 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49672 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347799AbiAXT0d (ORCPT ); Mon, 24 Jan 2022 14:26:33 -0500 Received: from smtp.kernel.org (relay.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 810CFB81239; Mon, 24 Jan 2022 19:26:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B626C340E8; Mon, 24 Jan 2022 19:26:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052389; bh=hoWclYbzWFU22+lq/kIaZSoukxFXpex2giDGDMdzYwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IynKtxFX0cESh/HNR2gLKBMfqYkKt5SZCzdOv9wGnv3W0Yd616Ig6ZXp8S5os134U cLS5wpmT5vD29aUFOvPYKwuz//3YdCD2sgcB+tmThEi3CgOXMX/AHI0q+PrhUkcpnN o8Rflucs8azjcAKgzpWYFmxCX+bSdAjBh85LEQvs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jammy Huang , Paul Menzel , Joel Stanley , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 043/320] media: aspeed: fix mode-detect always time out at 2nd run Date: Mon, 24 Jan 2022 19:40:27 +0100 Message-Id: <20220124183955.216607446@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jammy Huang [ Upstream commit 62cea52ad4bead0ae4be2cfe1142eb0aae0e9fbd ] aspeed_video_get_resolution() will try to do res-detect again if the timing got in last try is invalid. But it will always time out because VE_SEQ_CTRL_TRIG_MODE_DET is only cleared after 1st mode-detect. To fix the problem, just clear VE_SEQ_CTRL_TRIG_MODE_DET before setting it in aspeed_video_enable_mode_detect(). Fixes: d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver") Signed-off-by: Jammy Huang Acked-by: Paul Menzel Reviewed-by: Joel Stanley Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/platform/aspeed-video.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform= /aspeed-video.c index 6dde49d9aa4c2..be1238f22b8ae 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -477,6 +477,10 @@ static void aspeed_video_enable_mode_detect(struct asp= eed_video *video) aspeed_video_update(video, VE_INTERRUPT_CTRL, 0, VE_INTERRUPT_MODE_DETECT); =20 + /* Disable mode detect in order to re-trigger */ + aspeed_video_update(video, VE_SEQ_CTRL, + VE_SEQ_CTRL_TRIG_MODE_DET, 0); + /* Trigger mode detect */ aspeed_video_update(video, VE_SEQ_CTRL, 0, VE_SEQ_CTRL_TRIG_MODE_DET); } @@ -764,10 +768,6 @@ static void aspeed_video_get_resolution(struct aspeed_= video *video) return; } =20 - /* Disable mode detect in order to re-trigger */ - aspeed_video_update(video, VE_SEQ_CTRL, - VE_SEQ_CTRL_TRIG_MODE_DET, 0); - aspeed_video_check_and_set_polarity(video); =20 aspeed_video_enable_mode_detect(video); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A540C433F5 for ; Mon, 24 Jan 2022 20:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354500AbiAXUDF (ORCPT ); Mon, 24 Jan 2022 15:03:05 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54262 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345185AbiAXT0g (ORCPT ); Mon, 24 Jan 2022 14:26:36 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DD54A614DC; Mon, 24 Jan 2022 19:26:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C39EDC340EE; Mon, 24 Jan 2022 19:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052395; bh=bfB2/RcW2K+xexjn5NVIMB7nOFtsU1aTuXcNAlD80bY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MqzU+wtmBNolgyk/XqOY5A1m9sJYf2czZjn3E+pLtUWGZ132sT5b9hC+4JLBXLx1e uIRE+pEheD0DhfCx2tlV0VeBM02AnKzbScyQPtqU2wwEp2XDCWaPU8yJ0uQz00ABEb bdD0HCH1kgy46lNgUJ9aikcZ5VloWGUTf7ZcsJFI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Dongliang Mu , syzkaller , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 044/320] media: em28xx: fix memory leak in em28xx_init_dev Date: Mon, 24 Jan 2022 19:40:28 +0100 Message-Id: <20220124183955.247242999@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dongliang Mu [ Upstream commit 22be5a10d0b24eec9e45decd15d7e6112b25f080 ] In the em28xx_init_rev, if em28xx_audio_setup fails, this function fails to deallocate the media_dev allocated in the em28xx_media_device_init. Fix this by adding em28xx_unregister_media_device to free media_dev. BTW, this patch is tested in my local syzkaller instance, and it can prevent the memory leak from occurring again. CC: Pavel Skripkin Fixes: 37ecc7b1278f ("[media] em28xx: add media controller support") Signed-off-by: Dongliang Mu Reported-by: syzkaller Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/usb/em28xx/em28xx-cards.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em= 28xx/em28xx-cards.c index 3e96b4b711d75..bfca9d0a1fe15 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -3515,8 +3515,10 @@ static int em28xx_init_dev(struct em28xx *dev, struc= t usb_device *udev, =20 if (dev->is_audio_only) { retval =3D em28xx_audio_setup(dev); - if (retval) - return -ENODEV; + if (retval) { + retval =3D -ENODEV; + goto err_deinit_media; + } em28xx_init_extension(dev); =20 return 0; @@ -3535,7 +3537,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct= usb_device *udev, dev_err(&dev->intf->dev, "%s: em28xx_i2c_register bus 0 - error [%d]!\n", __func__, retval); - return retval; + goto err_deinit_media; } =20 /* register i2c bus 1 */ @@ -3551,9 +3553,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct= usb_device *udev, "%s: em28xx_i2c_register bus 1 - error [%d]!\n", __func__, retval); =20 - em28xx_i2c_unregister(dev, 0); - - return retval; + goto err_unreg_i2c; } } =20 @@ -3561,6 +3561,12 @@ static int em28xx_init_dev(struct em28xx *dev, struc= t usb_device *udev, em28xx_card_setup(dev); =20 return 0; + +err_unreg_i2c: + em28xx_i2c_unregister(dev, 0); +err_deinit_media: + em28xx_unregister_media_device(dev); + return retval; } =20 static int em28xx_duplicate_dev(struct em28xx *dev) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F73DC4321E for ; Mon, 24 Jan 2022 20:11:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379542AbiAXULh (ORCPT ); Mon, 24 Jan 2022 15:11:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356682AbiAXTxF (ORCPT ); Mon, 24 Jan 2022 14:53:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1824C0613A6; Mon, 24 Jan 2022 11:26:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7D6CCB81240; Mon, 24 Jan 2022 19:26:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6E1DC339CC; Mon, 24 Jan 2022 19:26:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052398; bh=lUHBLmJPWPHY9xfX0f7oW/LhUvOKBWyNMSXZN69tKvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J1esuzkOf5o2e8ciRTwNfR4YdyyQ6fV3vkARvZxCqG0npTBw/jUuMLUnCF9fLYfuI Gx8XXGsjtdYWpRMeZuFdOhkF4W/dspi4seoyCxlkw9Mj9B1CDF4bX8orH4BizaPRLw YadGTTkNl23zjDvDyqbolR2bLgKRK0NsNcwHoYN4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jammy Huang , Paul Menzel , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 045/320] media: aspeed: Update signal status immediately to ensure sane hw state Date: Mon, 24 Jan 2022 19:40:29 +0100 Message-Id: <20220124183955.277750504@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jammy Huang [ Upstream commit af6d1bde395cac174ee71adcd3fa43f6435c7206 ] If res-chg, VE_INTERRUPT_MODE_DETECT_WD irq will be raised. But v4l2_input_status won't be updated to no-signal immediately until aspeed_video_get_resolution() in aspeed_video_resolution_work(). During the period of time, aspeed_video_start_frame() could be called because it doesn't know signal becomes unstable now. If it goes with aspeed_video_init_regs() of aspeed_video_irq_res_change() simultaneously, it will mess up hw state. To fix this problem, v4l2_input_status is updated to no-signal immediately for VE_INTERRUPT_MODE_DETECT_WD irq. Fixes: d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver") Signed-off-by: Jammy Huang Acked-by: Paul Menzel Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/platform/aspeed-video.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform= /aspeed-video.c index be1238f22b8ae..1e0867016bf37 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -533,6 +533,8 @@ static void aspeed_video_irq_res_change(struct aspeed_v= ideo *video, ulong delay) set_bit(VIDEO_RES_CHANGE, &video->flags); clear_bit(VIDEO_FRAME_INPRG, &video->flags); =20 + video->v4l2_input_status =3D V4L2_IN_ST_NO_SIGNAL; + aspeed_video_off(video); aspeed_video_bufs_done(video, VB2_BUF_STATE_ERROR); =20 @@ -1315,7 +1317,6 @@ static void aspeed_video_resolution_work(struct work_= struct *work) struct delayed_work *dwork =3D to_delayed_work(work); struct aspeed_video *video =3D container_of(dwork, struct aspeed_video, res_work); - u32 input_status =3D video->v4l2_input_status; =20 aspeed_video_on(video); =20 @@ -1328,8 +1329,7 @@ static void aspeed_video_resolution_work(struct work_= struct *work) aspeed_video_get_resolution(video); =20 if (video->detected_timings.width !=3D video->active_timings.width || - video->detected_timings.height !=3D video->active_timings.height || - input_status !=3D video->v4l2_input_status) { + video->detected_timings.height !=3D video->active_timings.height) { static const struct v4l2_event ev =3D { .type =3D V4L2_EVENT_SOURCE_CHANGE, .u.src_change.changes =3D V4L2_EVENT_SRC_CH_RESOLUTION, --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C79BC4167B for ; Mon, 24 Jan 2022 20:11:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379269AbiAXUK7 (ORCPT ); Mon, 24 Jan 2022 15:10:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357862AbiAXTxF (ORCPT ); Mon, 24 Jan 2022 14:53:05 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 549C6C0613AD; Mon, 24 Jan 2022 11:26:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E77C261540; Mon, 24 Jan 2022 19:26:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC3CAC339E5; Mon, 24 Jan 2022 19:26:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052401; bh=gTOwM/AJNlhw90ddlzY29TznZrDBWvCqLnrdpaZbPLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S3eE/dmDcBjqnlRuL5n84dzpdETRFksU2dWqyG1utm0aGg+DnN8j9CFAuoEbS0moG 1gjlKguPgjXbVcQ0Fk3kgOkG13nNkmsFJsQzW/vgwBCGR1UWWICjyWJiOG5nNzsRhR i4JrqAowEon06cvAKfRoQ/hJ65YJvAKNApCpklFE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Hewitt , Neil Armstrong , Sasha Levin Subject: [PATCH 5.4 046/320] arm64: dts: meson-gxbb-wetek: fix HDMI in early boot Date: Mon, 24 Jan 2022 19:40:30 +0100 Message-Id: <20220124183955.313991239@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Hewitt [ Upstream commit 8182a35868db5f053111d5d9d4da8fcb3f99259d ] Mark the VDDIO_AO18 regulator always-on and set hdmi-supply for the hdmi_tx node to ensure HDMI is powered in the early stages of boot. Fixes: fb72c03e0e32 ("ARM64: dts: meson-gxbb-wetek: add a wetek specific dt= si to cleanup hub and play2") Signed-off-by: Christian Hewitt Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20211012052522.30873-2-christianshewitt@gma= il.com Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64= /boot/dts/amlogic/meson-gxbb-wetek.dtsi index e3d17569d98ad..d7d0b65713841 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi @@ -64,6 +64,7 @@ regulator-name =3D "VDDIO_AO18"; regulator-min-microvolt =3D <1800000>; regulator-max-microvolt =3D <1800000>; + regulator-always-on; }; =20 vcc_3v3: regulator-vcc_3v3 { @@ -157,6 +158,7 @@ status =3D "okay"; pinctrl-0 =3D <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; pinctrl-names =3D "default"; + hdmi-supply =3D <&vddio_ao18>; }; =20 &hdmi_tx_tmds_port { --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 726F7C43217 for ; Mon, 24 Jan 2022 20:11:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354780AbiAXULR (ORCPT ); Mon, 24 Jan 2022 15:11:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344754AbiAXTxF (ORCPT ); Mon, 24 Jan 2022 14:53:05 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BC2EC061340; Mon, 24 Jan 2022 11:26:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1AE7F6149A; Mon, 24 Jan 2022 19:26:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEB4DC340E5; Mon, 24 Jan 2022 19:26:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052404; bh=TwdPhdXhXkecM3Z8zXwBoX/gGUgexIZjp4FmZkHH3so=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XtJrgN1w+SOUYt6L9S4kkQcS4VbrYqRtMXktbxFMuBOOVyxhYWKB+ZpITpJRFrToD wkBAw/sNi2IRRGbT/mRVhq+BbjHCYD3HVFFS4mM1xlgJpIvUHsOFs0ywkhzGH4N469 k3X751Mig6UDTcConL6tEi9buKv2xnGX/adtXz3s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Hewitt , Neil Armstrong , Sasha Levin Subject: [PATCH 5.4 047/320] arm64: dts: meson-gxbb-wetek: fix missing GPIO binding Date: Mon, 24 Jan 2022 19:40:31 +0100 Message-Id: <20220124183955.346783603@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Hewitt [ Upstream commit c019abb2feba3cbbd7cf7178f8e6499c4fa6fced ] The absence of this binding appears to be harmless in Linux but it breaks Ethernet support in mainline u-boot. So add the binding (which is present in all other u-boot supported GXBB device-trees). Fixes: fb72c03e0e32 ("ARM64: dts: meson-gxbb-wetek: add a wetek specific dt= si to cleanup hub and play2") Signed-off-by: Christian Hewitt Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20211012052522.30873-3-christianshewitt@gma= il.com Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64= /boot/dts/amlogic/meson-gxbb-wetek.dtsi index d7d0b65713841..e94f09c2d4e32 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi @@ -6,6 +6,7 @@ */ =20 #include "meson-gxbb.dtsi" +#include =20 / { aliases { --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C800C4707A for ; Mon, 24 Jan 2022 19:37:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353634AbiAXTfE (ORCPT ); Mon, 24 Jan 2022 14:35:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54470 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351341AbiAXT0s (ORCPT ); Mon, 24 Jan 2022 14:26:48 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 315C261490; Mon, 24 Jan 2022 19:26:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15805C340E7; Mon, 24 Jan 2022 19:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052407; bh=GPFW5CjYuPUZgOYdRtErkjhYGlNzp0ODw02p11efQ5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=afObzakXOuB4FKwkq54W/aLfEOSaVLiQ71vR5y3IGr55CRPX0o1V4VkryhJRJfrV8 ka4EVGyrgXPDQS/i9RDXmdlGUvEPAPZuIb5rNiRJxAfycvMLrP05IqWvaQFZsQPkOA RIFQqnBP+txhzUbO+rxlb2blEpK86kLJDHvWSjE0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Marcel Holtmann , Sasha Levin , syzbot+e3fcb9c4f3c2a931dc40@syzkaller.appspotmail.com Subject: [PATCH 5.4 048/320] Bluetooth: stop proccessing malicious adv data Date: Mon, 24 Jan 2022 19:40:32 +0100 Message-Id: <20220124183955.376929250@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 3a56ef719f0b9682afb8a86d64b2399e36faa4e6 ] Syzbot reported slab-out-of-bounds read in hci_le_adv_report_evt(). The problem was in missing validaion check. We should check if data is not malicious and we can read next data block. If we won't check ptr validness, code can read a way beyond skb->end and it can cause problems, of course. Fixes: e95beb414168 ("Bluetooth: hci_le_adv_report_evt code refactoring") Reported-and-tested-by: syzbot+e3fcb9c4f3c2a931dc40@syzkaller.appspotmail.c= om Signed-off-by: Pavel Skripkin Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/bluetooth/hci_event.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 31469ff084cd3..40f1593651e84 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -5506,7 +5506,8 @@ static void hci_le_adv_report_evt(struct hci_dev *hde= v, struct sk_buff *skb) struct hci_ev_le_advertising_info *ev =3D ptr; s8 rssi; =20 - if (ev->length <=3D HCI_MAX_AD_LENGTH) { + if (ev->length <=3D HCI_MAX_AD_LENGTH && + ev->data + ev->length <=3D skb_tail_pointer(skb)) { rssi =3D ev->data[ev->length]; process_adv_report(hdev, ev->evt_type, &ev->bdaddr, ev->bdaddr_type, NULL, 0, rssi, @@ -5516,6 +5517,11 @@ static void hci_le_adv_report_evt(struct hci_dev *hd= ev, struct sk_buff *skb) } =20 ptr +=3D sizeof(*ev) + ev->length + 1; + + if (ptr > (void *) skb_tail_pointer(skb) - sizeof(*ev)) { + bt_dev_err(hdev, "Malicious advertising data. Stopping processing"); + break; + } } =20 hci_dev_unlock(hdev); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05FB3C433EF for ; Mon, 24 Jan 2022 20:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378022AbiAXUL1 (ORCPT ); Mon, 24 Jan 2022 15:11:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357927AbiAXTxW (ORCPT ); Mon, 24 Jan 2022 14:53:22 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0716C061254; Mon, 24 Jan 2022 11:26:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4F16161447; Mon, 24 Jan 2022 19:26:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EDC2C340E7; Mon, 24 Jan 2022 19:26:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052410; bh=KIWtqTmSiuBT2qbKK6tGpxzLx9BdKMIp2SxoYq1fvlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M5Dp3QuZBV6phYXLJRa2xperGyjZGTunKqr0qAq6dLmddLagMJpVdz0GiJG1+iTjP mPPAzLcRfXC8AIXcMgqPC2jj1C0Yxn+JcfdjZ+Myta+vU50fQ4BZS2SoEAVxQLAc+s iKk/Kc5gYUBtK7SAIaPsYidf09653xoubuWVDkDg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sumit Garg , Jens Wiklander , Sasha Levin Subject: [PATCH 5.4 049/320] tee: fix put order in teedev_close_context() Date: Mon, 24 Jan 2022 19:40:33 +0100 Message-Id: <20220124183955.408084829@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jens Wiklander [ Upstream commit f18397ab3ae23e8e43bba9986e66af6d4497f2ad ] Prior to this patch was teedev_close_context() calling tee_device_put() before teedev_ctx_put() leading to teedev_ctx_release() accessing ctx->teedev just after the reference counter was decreased on the teedev. Fix this by calling teedev_ctx_put() before tee_device_put(). Fixes: 217e0250cccb ("tee: use reference counting for tee_context") Reviewed-by: Sumit Garg Signed-off-by: Jens Wiklander Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/tee/tee_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c index 0f16d9ffd8d12..85e0cef9e917e 100644 --- a/drivers/tee/tee_core.c +++ b/drivers/tee/tee_core.c @@ -84,8 +84,10 @@ void teedev_ctx_put(struct tee_context *ctx) =20 static void teedev_close_context(struct tee_context *ctx) { - tee_device_put(ctx->teedev); + struct tee_device *teedev =3D ctx->teedev; + teedev_ctx_put(ctx); + tee_device_put(teedev); } =20 static int tee_open(struct inode *inode, struct file *filp) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8383C433FE for ; Mon, 24 Jan 2022 20:03:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354471AbiAXUDB (ORCPT ); Mon, 24 Jan 2022 15:03:01 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50302 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351367AbiAXT07 (ORCPT ); Mon, 24 Jan 2022 14:26:59 -0500 Received: from smtp.kernel.org (relay.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 1FD60B8123F; Mon, 24 Jan 2022 19:26:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42889C340E5; Mon, 24 Jan 2022 19:26:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052413; bh=qne+I7FLNYBtN/84TB3R3SwarzcOPorxaSIPNuVN8VA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yTsU0/sb/71i7om2RPQYuVI/s7vfCalvk02l7z7Hox2PNpx/IFfRzgGE97o4RtM2F sBCwc8Ie4YEZosGlPtuQcEPnnihTbwhlvpTGiCADnbiAXPNfjnQYCX0InG856L9xAU L+ZUsPrtq24gl82adLDn8eT0ivwCAPxt6CSkNQeI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Hai , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 050/320] media: dmxdev: fix UAF when dvb_register_device() fails Date: Mon, 24 Jan 2022 19:40:34 +0100 Message-Id: <20220124183955.437735171@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wang Hai [ Upstream commit ab599eb11882f834951c436cc080c3455ba32b9b ] I got a use-after-free report: dvbdev: dvb_register_device: failed to create device dvb1.dvr0 (-12) ... =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BUG: KASAN: use-after-free in dvb_dmxdev_release+0xce/0x2f0 ... Call Trace: dump_stack_lvl+0x6c/0x8b print_address_description.constprop.0+0x48/0x70 kasan_report.cold+0x82/0xdb __asan_load4+0x6b/0x90 dvb_dmxdev_release+0xce/0x2f0 ... Allocated by task 7666: kasan_save_stack+0x23/0x50 __kasan_kmalloc+0x83/0xa0 kmem_cache_alloc_trace+0x22e/0x470 dvb_register_device+0x12f/0x980 dvb_dmxdev_init+0x1f3/0x230 ... Freed by task 7666: kasan_save_stack+0x23/0x50 kasan_set_track+0x20/0x30 kasan_set_free_info+0x24/0x40 __kasan_slab_free+0xf2/0x130 kfree+0xd1/0x5c0 dvb_register_device.cold+0x1ac/0x1fa dvb_dmxdev_init+0x1f3/0x230 ... When dvb_register_device() in dvb_dmxdev_init() fails, dvb_dmxdev_init() does not return a failure, and the memory pointed to by dvbdev or dvr_dvbdev is invalid at this point. If they are used subsequently, it will result in UFA or null-ptr-deref. If dvb_register_device() in dvb_dmxdev_init() fails, fix the bug by making dvb_dmxdev_init() return an error as well. Link: https://lore.kernel.org/linux-media/20211015085741.1203283-1-wanghai3= 8@huawei.com Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Hulk Robot Signed-off-by: Wang Hai Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/dvb-core/dmxdev.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxde= v.c index f14a872d12687..e58cb8434dafe 100644 --- a/drivers/media/dvb-core/dmxdev.c +++ b/drivers/media/dvb-core/dmxdev.c @@ -1413,7 +1413,7 @@ static const struct dvb_device dvbdev_dvr =3D { }; int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) { - int i; + int i, ret; =20 if (dmxdev->demux->open(dmxdev->demux) < 0) return -EUSERS; @@ -1432,14 +1432,26 @@ int dvb_dmxdev_init(struct dmxdev *dmxdev, struct d= vb_adapter *dvb_adapter) DMXDEV_STATE_FREE); } =20 - dvb_register_device(dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, dmxdev, + ret =3D dvb_register_device(dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, = dmxdev, DVB_DEVICE_DEMUX, dmxdev->filternum); - dvb_register_device(dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, + if (ret < 0) + goto err_register_dvbdev; + + ret =3D dvb_register_device(dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, dmxdev, DVB_DEVICE_DVR, dmxdev->filternum); + if (ret < 0) + goto err_register_dvr_dvbdev; =20 dvb_ringbuffer_init(&dmxdev->dvr_buffer, NULL, 8192); =20 return 0; + +err_register_dvr_dvbdev: + dvb_unregister_device(dmxdev->dvbdev); +err_register_dvbdev: + vfree(dmxdev->filter); + dmxdev->filter =3D NULL; + return ret; } =20 EXPORT_SYMBOL(dvb_dmxdev_init); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B473C433F5 for ; Mon, 24 Jan 2022 20:03:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354333AbiAXUC4 (ORCPT ); Mon, 24 Jan 2022 15:02:56 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50344 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346328AbiAXT07 (ORCPT ); Mon, 24 Jan 2022 14:26:59 -0500 Received: from smtp.kernel.org (relay.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 37559B81235; Mon, 24 Jan 2022 19:26:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C950C340E5; Mon, 24 Jan 2022 19:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052417; bh=N32OVYcY/f1gbuRqAcysnzXSOICorRmIH14nLnx0rl0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1OKTi7ZbxR3sWSY+dB0fVAvhP0XcrlN2efKLy6wXuZ+r9ExGPaDcBWz6DIsM0ePHk VXIuShcuMfbit6KZHlj7i3twmNylCrGGrZ/g7M4pW//sLl/VYpRO314JzcsFVTJDwy 4xo3Z1seZpBWhZu4aB3pLw21CEQN7qreHyieAqW8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chengfeng Ye , Thara Gopinath , Herbert Xu , Sasha Levin Subject: [PATCH 5.4 051/320] crypto: qce - fix uaf on qce_ahash_register_one Date: Mon, 24 Jan 2022 19:40:35 +0100 Message-Id: <20220124183955.475962978@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chengfeng Ye [ Upstream commit b4cb4d31631912842eb7dce02b4350cbb7562d5e ] Pointer base points to sub field of tmpl, it is dereferenced after tmpl is freed. Fix this by accessing base before free tmpl. Fixes: ec8f5d8f ("crypto: qce - Qualcomm crypto engine driver") Signed-off-by: Chengfeng Ye Acked-by: Thara Gopinath Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/crypto/qce/sha.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c index 0853e74583ade..29b0bad2507b1 100644 --- a/drivers/crypto/qce/sha.c +++ b/drivers/crypto/qce/sha.c @@ -512,8 +512,8 @@ static int qce_ahash_register_one(const struct qce_ahas= h_def *def, =20 ret =3D crypto_register_ahash(alg); if (ret) { - kfree(tmpl); dev_err(qce->dev, "%s registration failed\n", base->cra_name); + kfree(tmpl); return ret; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E868C433EF for ; Mon, 24 Jan 2022 20:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348702AbiAXUME (ORCPT ); Mon, 24 Jan 2022 15:12:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357951AbiAXTxa (ORCPT ); Mon, 24 Jan 2022 14:53:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC651C061199; Mon, 24 Jan 2022 11:27:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6EFC161491; Mon, 24 Jan 2022 19:27:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D34AC340E8; Mon, 24 Jan 2022 19:26:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052419; bh=YG1xf9oNHSBgV2sgH8XU82z4delKmUNuv0XKdlfsUA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WDz4YMgElrlj+8vUkDn6rC5eTEE2umi1oXF5TkGI0WDVI2Ox7Fd0aEcybAHxc0pCn wszu2UhY5qTBnz+D+efpIbwsyId8qK8ybueg6UTh3+GQSbYy16fiAlXqrHnB4LHIeh JBIDCLK874WtSEGuYHGtmfNf2A48i5AxB5ddeLBY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan , Nishanth Menon , Vignesh Raghavendra , Sasha Levin Subject: [PATCH 5.4 052/320] arm64: dts: ti: k3-j721e: correct cache-sets info Date: Mon, 24 Jan 2022 19:40:36 +0100 Message-Id: <20220124183955.515036978@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Fan [ Upstream commit 7a0df1f969c14939f60a7f9a6af72adcc314675f ] A72 Cluster has 48KB Icache, 32KB Dcache and 1MB L2 Cache - ICache is 3-way set-associative - Dcache is 2-way set-associative - Line size are 64bytes So correct the cache-sets info. Fixes: 2d87061e70dea ("arm64: dts: ti: Add Support for J721E SoC") Signed-off-by: Peng Fan Reviewed-by: Nishanth Menon Signed-off-by: Vignesh Raghavendra Link: https://lore.kernel.org/r/20211112063155.3485777-1-peng.fan@oss.nxp.c= om Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm64/boot/dts/ti/k3-j721e.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/ti/k3-j721e.dtsi b/arch/arm64/boot/dts/ti/= k3-j721e.dtsi index 43ea1ba979220..f4d8f3b37d5bb 100644 --- a/arch/arm64/boot/dts/ti/k3-j721e.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j721e.dtsi @@ -60,7 +60,7 @@ i-cache-sets =3D <256>; d-cache-size =3D <0x8000>; d-cache-line-size =3D <64>; - d-cache-sets =3D <128>; + d-cache-sets =3D <256>; next-level-cache =3D <&L2_0>; }; =20 @@ -74,7 +74,7 @@ i-cache-sets =3D <256>; d-cache-size =3D <0x8000>; d-cache-line-size =3D <64>; - d-cache-sets =3D <128>; + d-cache-sets =3D <256>; next-level-cache =3D <&L2_0>; }; }; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74F57C433EF for ; Mon, 24 Jan 2022 20:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353359AbiAXUCx (ORCPT ); Mon, 24 Jan 2022 15:02:53 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53088 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351456AbiAXT1F (ORCPT ); Mon, 24 Jan 2022 14:27:05 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6C29E61318; Mon, 24 Jan 2022 19:27:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DF23C340E5; Mon, 24 Jan 2022 19:27:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052422; bh=yXIQYxnNF1SjKzWmxAKfDHtSZ7/8iwVx/Mr08aAye/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U0aSIDiA5HgRrd+8fgKDMco3+NJLoTaP9SVPjzWIGHalxQbYnLTJ/j/x+EsRWQ8+6 2ODv+xyIZuIJrcMED2MH7xR5R0U08hDMkI45k2jpwfuT06O8pFQIENQITduPzQDxuX mMhPCw0H36Fek8gRkcwR8FcLDbUYvWvswivvlQsw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Richard Genoud , Sasha Levin Subject: [PATCH 5.4 053/320] tty: serial: atmel: Check return code of dmaengine_submit() Date: Mon, 24 Jan 2022 19:40:37 +0100 Message-Id: <20220124183955.547475165@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus [ Upstream commit 1e67bd2b8cb90b66e89562598e9c2046246832d3 ] The tx_submit() method of struct dma_async_tx_descriptor is entitled to do sanity checks and return errors if encountered. It's not the case for the DMA controller drivers that this client is using (at_h/xdmac), because they currently don't do sanity checks and always return a positive cookie at tx_submit() method. In case the controller drivers will implement sanity checks and return errors, print a message so that the client will be informed that something went wrong at tx_submit() level. Fixes: 08f738be88bb ("serial: at91: add tx dma support") Signed-off-by: Tudor Ambarus Acked-by: Richard Genoud Link: https://lore.kernel.org/r/20211125090028.786832-3-tudor.ambarus@micro= chip.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/tty/serial/atmel_serial.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_s= erial.c index 8a909d5561859..da076493b336a 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -1002,6 +1002,11 @@ static void atmel_tx_dma(struct uart_port *port) desc->callback =3D atmel_complete_tx_dma; desc->callback_param =3D atmel_port; atmel_port->cookie_tx =3D dmaengine_submit(desc); + if (dma_submit_error(atmel_port->cookie_tx)) { + dev_err(port->dev, "dma_submit_error %d\n", + atmel_port->cookie_tx); + return; + } } =20 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) @@ -1262,6 +1267,11 @@ static int atmel_prepare_rx_dma(struct uart_port *po= rt) desc->callback_param =3D port; atmel_port->desc_rx =3D desc; atmel_port->cookie_rx =3D dmaengine_submit(desc); + if (dma_submit_error(atmel_port->cookie_rx)) { + dev_err(port->dev, "dma_submit_error %d\n", + atmel_port->cookie_rx); + goto chan_err; + } =20 return 0; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D6E4C433F5 for ; Mon, 24 Jan 2022 19:58:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349837AbiAXT6E (ORCPT ); Mon, 24 Jan 2022 14:58:04 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50538 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351483AbiAXT1N (ORCPT ); Mon, 24 Jan 2022 14:27:13 -0500 Received: from smtp.kernel.org (relay.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 3B967B81233; Mon, 24 Jan 2022 19:27:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E8FCC340E7; Mon, 24 Jan 2022 19:27:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052429; bh=5dfdM11Vu6Ql+YgfcST9a+l5HW3BDYKh79+zoWWMh4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZ1cPx3hIB0yidB/wuqUA7i/JB83qx1CyypujD+rY8z6I5vrjxCJ/TOPbsG92UgZ8 l0AnfepAiJJmDiMNG1fhJcf3f3dGfu2Jr0lewBa4pm+oI/Z2x0pwGsAgOx+qKHTTIW lj7xixKgydn4sAP3JVo+FxSJO3Gn6LdoI0E1cJQ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Sasha Levin Subject: [PATCH 5.4 054/320] tty: serial: atmel: Call dma_async_issue_pending() Date: Mon, 24 Jan 2022 19:40:38 +0100 Message-Id: <20220124183955.577865981@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus [ Upstream commit 4f4b9b5895614eb2e2b5f4cab7858f44bd113e1b ] The driver wrongly assummed that tx_submit() will start the transfer, which is not the case, now that the at_xdmac driver is fixed. tx_submit is supposed to push the current transaction descriptor to a pending queue, waiting for issue_pending to be called. issue_pending must start the transfer, not tx_submit. Fixes: 34df42f59a60 ("serial: at91: add rx dma support") Fixes: 08f738be88bb ("serial: at91: add tx dma support") Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20211125090028.786832-4-tudor.ambarus@micro= chip.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/tty/serial/atmel_serial.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_s= erial.c index da076493b336a..3b2c25bd2e06b 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -1007,6 +1007,8 @@ static void atmel_tx_dma(struct uart_port *port) atmel_port->cookie_tx); return; } + + dma_async_issue_pending(chan); } =20 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) @@ -1273,6 +1275,8 @@ static int atmel_prepare_rx_dma(struct uart_port *por= t) goto chan_err; } =20 + dma_async_issue_pending(atmel_port->chan_rx); + return 0; =20 chan_err: --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90487C433EF for ; Mon, 24 Jan 2022 20:12:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354860AbiAXUMv (ORCPT ); Mon, 24 Jan 2022 15:12:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355648AbiAXTyN (ORCPT ); Mon, 24 Jan 2022 14:54:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76B7FC041899; Mon, 24 Jan 2022 11:27:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 345E7B81238; Mon, 24 Jan 2022 19:27:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 637A8C340E5; Mon, 24 Jan 2022 19:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052431; bh=7qJYOBbowqh8wUi59F2Jgk5pd7lhjQA/WH7nAkqaXQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IpuslQ5CnI+5T1RPM+OQEe8F134VabPRoiWHlKR7585AtNqaQ5myA4Z+nVkqFEuxf nmK0XmvFmSxbMwG2+2CRM0tcgL+9vAZuTz5vmGSSM9qQ7kPpjRPesjnAfIT5K0jgDV THNUTIxbyBB6C+GzNjSIcPrPHgtrumN0YXzGIHeI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suresh Udipi , Kazuyoshi Akiyama , Michael Rodin , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 055/320] media: rcar-csi2: Correct the selection of hsfreqrange Date: Mon, 24 Jan 2022 19:40:39 +0100 Message-Id: <20220124183955.608113027@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Suresh Udipi [ Upstream commit cee44d4fbacbbdfe62697ec94e76c6e4f726c5df ] hsfreqrange should be chosen based on the calculated mbps which is closer to the default bit rate and within the range as per table[1]. But current calculation always selects first value which is greater than or equal to the calculated mbps which may lead to chosing a wrong range in some cases. For example for 360 mbps for H3/M3N Existing logic selects Calculated value 360Mbps : Default 400Mbps Range [368.125 -433.125 mbps] This hsfreqrange is out of range. The logic is changed to get the default value which is closest to the calculated value [1] Calculated value 360Mbps : Default 350Mbps Range [320.625 -380.625 mpbs] [1] specs r19uh0105ej0200-r-car-3rd-generation.pdf [Table 25.9] Please note that According to Renesas in Table 25.9 the range for 220 default value is corrected as below |Range (Mbps) | Default Bit rate (Mbps) | ----------------------------------------------- | 197.125-244.125 | 220 | ----------------------------------------------- Fixes: 769afd212b16 ("media: rcar-csi2: add Renesas R-Car MIPI CSI-2 receiv= er driver") Signed-off-by: Suresh Udipi Signed-off-by: Kazuyoshi Akiyama Signed-off-by: Michael Rodin Reviewed-by: Niklas S=C3=B6derlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/platform/rcar-vin/rcar-csi2.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/pl= atform/rcar-vin/rcar-csi2.c index e01f22bf826d4..99b28611eb12c 100644 --- a/drivers/media/platform/rcar-vin/rcar-csi2.c +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c @@ -430,16 +430,23 @@ static int rcsi2_wait_phy_start(struct rcar_csi2 *pri= v) static int rcsi2_set_phypll(struct rcar_csi2 *priv, unsigned int mbps) { const struct rcsi2_mbps_reg *hsfreq; + const struct rcsi2_mbps_reg *hsfreq_prev =3D NULL; =20 - for (hsfreq =3D priv->info->hsfreqrange; hsfreq->mbps !=3D 0; hsfreq++) + for (hsfreq =3D priv->info->hsfreqrange; hsfreq->mbps !=3D 0; hsfreq++) { if (hsfreq->mbps >=3D mbps) break; + hsfreq_prev =3D hsfreq; + } =20 if (!hsfreq->mbps) { dev_err(priv->dev, "Unsupported PHY speed (%u Mbps)", mbps); return -ERANGE; } =20 + if (hsfreq_prev && + ((mbps - hsfreq_prev->mbps) <=3D (hsfreq->mbps - mbps))) + hsfreq =3D hsfreq_prev; + rcsi2_write(priv, PHYPLL_REG, PHYPLL_HSFREQRANGE(hsfreq->reg)); =20 return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9EF6C433FE for ; Mon, 24 Jan 2022 19:37:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353676AbiAXTfN (ORCPT ); Mon, 24 Jan 2022 14:35:13 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50606 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351509AbiAXT1R (ORCPT ); Mon, 24 Jan 2022 14:27:17 -0500 Received: from smtp.kernel.org (relay.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 127E1B81238; Mon, 24 Jan 2022 19:27:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38CECC340E5; Mon, 24 Jan 2022 19:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052434; bh=jo1QdWXfxk/xuGISj2AdjzU5SrJsUUu9kwioQXF1HGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aOT/0oz635qDGSYXk/pQmnkqzBfASksYTYQ2drrwNRx9OCtd7h7GoeP8piNN/JKka rM6lRfNl2xfatSYprnO4syCQq5dMpflakGHVGlCkVPGCo3OsHh1t0w5Wt+RzaonMJw 20Bl2qM+kLl7Z9mMfvZlGkQsTdaBPR3WoJVtCO3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 056/320] media: imx-pxp: Initialize the spinlock prior to using it Date: Mon, 24 Jan 2022 19:40:40 +0100 Message-Id: <20220124183955.640446385@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabio Estevam [ Upstream commit ed2f97ad4b21072f849cf4ae6645d1f2b1d3f550 ] After devm_request_threaded_irq() is called there is a chance that an interrupt may occur before the spinlock is initialized, which will trigger a kernel oops. To prevent that, move the initialization of the spinlock prior to requesting the interrupts. Fixes: 51abcf7fdb70 ("media: imx-pxp: add i.MX Pixel Pipeline driver") Signed-off-by: Fabio Estevam Reviewed-by: Philipp Zabel Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/platform/imx-pxp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/imx-pxp.c b/drivers/media/platform/imx-= pxp.c index 38d9423223025..3c36cefddec7c 100644 --- a/drivers/media/platform/imx-pxp.c +++ b/drivers/media/platform/imx-pxp.c @@ -1664,6 +1664,8 @@ static int pxp_probe(struct platform_device *pdev) if (irq < 0) return irq; =20 + spin_lock_init(&dev->irqlock); + ret =3D devm_request_threaded_irq(&pdev->dev, irq, NULL, pxp_irq_handler, IRQF_ONESHOT, dev_name(&pdev->dev), dev); if (ret < 0) { @@ -1681,8 +1683,6 @@ static int pxp_probe(struct platform_device *pdev) goto err_clk; } =20 - spin_lock_init(&dev->irqlock); - ret =3D v4l2_device_register(&pdev->dev, &dev->v4l2_dev); if (ret) goto err_clk; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4DE5C35268 for ; Mon, 24 Jan 2022 20:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380098AbiAXUPk (ORCPT ); Mon, 24 Jan 2022 15:15:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358413AbiAXTzI (ORCPT ); Mon, 24 Jan 2022 14:55:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C036C0418B1; Mon, 24 Jan 2022 11:27:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 05889B81243; Mon, 24 Jan 2022 19:27:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33E35C340E7; Mon, 24 Jan 2022 19:27:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052437; bh=fntRpshkPH1kBf19IZiQRtlhXjIeJ4hCEiSlfehiMwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IOqHTpz7uQp39FFBwlM+7FHzveyW3T7IZ82Uzf3+bFIzRKQ0ZQ67oVietWCnM0Iv1 eTdU+0AR5xHwL2TYgacdTENGOuPw9q5qoTtRGdmvj15kd8CYvJ/V7EE0DjQ0NW5BmL 84H9mPijXCfacmKhlP4O9XtiWWXMEmfxGWIAdVlM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Yang Yingliang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 057/320] media: si470x-i2c: fix possible memory leak in si470x_i2c_probe() Date: Mon, 24 Jan 2022 19:40:41 +0100 Message-Id: <20220124183955.677433044@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit ef054e345ed8c79ce1121a3599b5a2dfd78e57a0 ] n the 'radio->hdl.error' error handling, ctrl handler allocated by v4l2_ctrl_new_std() does not released, and caused memory leak as follows: unreferenced object 0xffff888033d54200 (size 256): comm "i2c-si470x-19", pid 909, jiffies 4294914203 (age 8.072s) hex dump (first 32 bytes): e8 69 11 03 80 88 ff ff 00 46 d5 33 80 88 ff ff .i.......F.3.... 10 42 d5 33 80 88 ff ff 10 42 d5 33 80 88 ff ff .B.3.....B.3.... backtrace: [<00000000086bd4ed>] __kmalloc_node+0x1eb/0x360 [<00000000bdb68871>] kvmalloc_node+0x66/0x120 [<00000000fac74e4c>] v4l2_ctrl_new+0x7b9/0x1c60 [videodev] [<00000000693bf940>] v4l2_ctrl_new_std+0x19b/0x270 [videodev] [<00000000c0cb91bc>] si470x_i2c_probe+0x2d3/0x9a0 [radio_si470x_i2c] [<0000000056a6f01f>] i2c_device_probe+0x4d8/0xbe0 Fix the error handling path to avoid memory leak. Reported-by: Hulk Robot Fixes: 8c081b6f9a9b ("media: radio: Critical v4l2 registration...") Signed-off-by: Yang Yingliang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/radio/si470x/radio-si470x-i2c.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/= radio/si470x/radio-si470x-i2c.c index a972c0705ac79..76d39e2e87706 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -368,7 +368,7 @@ static int si470x_i2c_probe(struct i2c_client *client) if (radio->hdl.error) { retval =3D radio->hdl.error; dev_err(&client->dev, "couldn't register control\n"); - goto err_dev; + goto err_all; } =20 /* video device initialization */ @@ -463,7 +463,6 @@ static int si470x_i2c_probe(struct i2c_client *client) return 0; err_all: v4l2_ctrl_handler_free(&radio->hdl); -err_dev: v4l2_device_unregister(&radio->v4l2_dev); err_initial: return retval; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2310DC4332F for ; Mon, 24 Jan 2022 19:37:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353962AbiAXTfj (ORCPT ); Mon, 24 Jan 2022 14:35:39 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50650 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343521AbiAXT1X (ORCPT ); Mon, 24 Jan 2022 14:27:23 -0500 Received: from smtp.kernel.org (relay.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 21FC1B8124B; Mon, 24 Jan 2022 19:27:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 243A1C340E5; Mon, 24 Jan 2022 19:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052440; bh=vdjIyARKgv9EcTFHB7v6+qdFjZqx2Du06oVGbIDEcyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fxN6cgpAKc1PLy2f+50C0JHmsI1wG2iE7xQ6l9pRm2Cm02Di0CMFeiZ9j6TPYniHF JgC89bKTrX4BC9Jg6od3Rx4i/Cdq/bS2u6GaHFd+3Nlaupgj3urHq1JERonnkJzpO+ bhkoDDd9iXz4KGilBQsitd5gqYVXTA2dY87l7tMc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dafna Hirschfeld , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 058/320] media: mtk-vcodec: call v4l2_m2m_ctx_release first when file is released Date: Mon, 24 Jan 2022 19:40:42 +0100 Message-Id: <20220124183955.713557769@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dafna Hirschfeld [ Upstream commit 9f89c881bffbdffe4060ffaef3489a2830a6dd9c ] The func v4l2_m2m_ctx_release waits for currently running jobs to finish and then stop streaming both queues and frees the buffers. All this should be done before the call to mtk_vcodec_enc_release which frees the encoder handler. This fixes null-pointer dereference bug: [ 638.028076] Mem abort info: [ 638.030932] ESR =3D 0x96000004 [ 638.033978] EC =3D 0x25: DABT (current EL), IL =3D 32 bits [ 638.039293] SET =3D 0, FnV =3D 0 [ 638.042338] EA =3D 0, S1PTW =3D 0 [ 638.045474] FSC =3D 0x04: level 0 translation fault [ 638.050349] Data abort info: [ 638.053224] ISV =3D 0, ISS =3D 0x00000004 [ 638.057055] CM =3D 0, WnR =3D 0 [ 638.060018] user pgtable: 4k pages, 48-bit VAs, pgdp=3D000000012b6db000 [ 638.066485] [00000000000001a0] pgd=3D0000000000000000, p4d=3D00000000000= 00000 [ 638.073277] Internal error: Oops: 96000004 [#1] SMP [ 638.078145] Modules linked in: rfkill mtk_vcodec_dec mtk_vcodec_enc uvcv= ideo mtk_mdp mtk_vcodec_common videobuf2_dma_contig v4l2_h264 cdc_ether v4l= 2_mem2mem videobuf2_vmalloc usbnet videobuf2_memops videobuf2_v4l2 r8152 vi= deobuf2_common videodev cros_ec_sensors cros_ec_sensors_core industrialio_t= riggered_buffer kfifo_buf elan_i2c elants_i2c sbs_battery mc cros_usbpd_cha= rger cros_ec_chardev cros_usbpd_logger crct10dif_ce mtk_vpu fuse ip_tables = x_tables ipv6 [ 638.118583] CPU: 0 PID: 212 Comm: kworker/u8:5 Not tainted 5.15.0-06427-= g58a1d4dcfc74-dirty #109 [ 638.127357] Hardware name: Google Elm (DT) [ 638.131444] Workqueue: mtk-vcodec-enc mtk_venc_worker [mtk_vcodec_enc] [ 638.137974] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE= =3D--) [ 638.144925] pc : vp8_enc_encode+0x34/0x2b0 [mtk_vcodec_enc] [ 638.150493] lr : venc_if_encode+0xac/0x1b0 [mtk_vcodec_enc] [ 638.156060] sp : ffff8000124d3c40 [ 638.159364] x29: ffff8000124d3c40 x28: 0000000000000000 x27: 00000000000= 00000 [ 638.166493] x26: 0000000000000000 x25: ffff0000e7f252d0 x24: ffff8000124= d3d58 [ 638.173621] x23: ffff8000124d3d58 x22: ffff8000124d3d60 x21: 00000000000= 00001 [ 638.180750] x20: ffff80001137e000 x19: 0000000000000000 x18: 00000000000= 00001 [ 638.187878] x17: 000000040044ffff x16: 00400032b5503510 x15: 00000000000= 00000 [ 638.195006] x14: ffff8000118536c0 x13: ffff8000ee1da000 x12: 0000000030d= 4d91d [ 638.202134] x11: 0000000000000000 x10: 0000000000000980 x9 : ffff8000124= d3b20 [ 638.209262] x8 : ffff0000c18d4ea0 x7 : ffff0000c18d44c0 x6 : ffff0000c18= d44c0 [ 638.216391] x5 : ffff80000904a3b0 x4 : ffff8000124d3d58 x3 : ffff8000124= d3d60 [ 638.223519] x2 : ffff8000124d3d78 x1 : 0000000000000001 x0 : ffff8000113= 7efb8 [ 638.230648] Call trace: [ 638.233084] vp8_enc_encode+0x34/0x2b0 [mtk_vcodec_enc] [ 638.238304] venc_if_encode+0xac/0x1b0 [mtk_vcodec_enc] [ 638.243525] mtk_venc_worker+0x110/0x250 [mtk_vcodec_enc] [ 638.248918] process_one_work+0x1f8/0x498 [ 638.252923] worker_thread+0x140/0x538 [ 638.256664] kthread+0x148/0x158 [ 638.259884] ret_from_fork+0x10/0x20 [ 638.263455] Code: f90023f9 2a0103f5 aa0303f6 aa0403f8 (f940d277) [ 638.269538] ---[ end trace e374fc10f8e181f5 ]--- [gst-master] root@debian:~/gst-build# [ 638.019193] Unable to handle kerne= l NULL pointer dereference at virtual address 00000000000001a0 Fixes: 4e855a6efa547 ("[media] vcodec: mediatek: Add Mediatek V4L2 Video En= coder Driver") Signed-off-by: Dafna Hirschfeld Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drive= rs/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c index 1d82aa2b6017c..dea0ee2cb7245 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -209,11 +209,11 @@ static int fops_vcodec_release(struct file *file) mtk_v4l2_debug(1, "[%d] encoder", ctx->id); mutex_lock(&dev->dev_mutex); =20 + v4l2_m2m_ctx_release(ctx->m2m_ctx); mtk_vcodec_enc_release(ctx); v4l2_fh_del(&ctx->fh); v4l2_fh_exit(&ctx->fh); v4l2_ctrl_handler_free(&ctx->ctrl_hdl); - v4l2_m2m_ctx_release(ctx->m2m_ctx); =20 list_del_init(&ctx->list); kfree(ctx); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40FB5C43217 for ; Mon, 24 Jan 2022 19:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354073AbiAXTf4 (ORCPT ); Mon, 24 Jan 2022 14:35:56 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52128 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348122AbiAXT3a (ORCPT ); Mon, 24 Jan 2022 14:29:30 -0500 Received: from smtp.kernel.org (relay.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 2A2F3B81232; Mon, 24 Jan 2022 19:29:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59AF6C340E5; Mon, 24 Jan 2022 19:29:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052566; bh=Kld7CYDt2mevVIhsIFjhJ24FekgJ91SGTvQxVwukp8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2JeXP8IxrU5DVFQ4ej/QHUWKSWqRLTv2CUK37GPlzQJiCmCK3anqrisFo8M+Ulg9i MBP/sDKptYDyZgGjClcyD4r2xYGR8WleBO8Z+xqJP3p3OrzX1N6dXiVdxVD5ptkK4v zTQDuSk9tiWm5X8LtkUKBlxL4qtQuY+6bh7Fy7ao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 059/320] media: venus: core: Fix a resource leak in the error handling path of venus_probe() Date: Mon, 24 Jan 2022 19:40:43 +0100 Message-Id: <20220124183955.745569890@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 8cc7a1b2aca067397a016cdb971a5e6ad9b640c7 ] A successful 'of_platform_populate()' call should be balanced by a corresponding 'of_platform_depopulate()' call in the error handling path of the probe, as already done in the remove function. A successful 'venus_firmware_init()' call should be balanced by a corresponding 'venus_firmware_deinit()' call in the error handling path of the probe, as already done in the remove function. Update the error handling path accordingly. Fixes: f9799fcce4bb ("media: venus: firmware: register separate platform_de= vice for firmware loader") Signed-off-by: Christophe JAILLET Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/platform/qcom/venus/core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platf= orm/qcom/venus/core.c index bbc430a003443..7b52d3e5d3f89 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -289,11 +289,11 @@ static int venus_probe(struct platform_device *pdev) =20 ret =3D venus_firmware_init(core); if (ret) - goto err_runtime_disable; + goto err_of_depopulate; =20 ret =3D venus_boot(core); if (ret) - goto err_runtime_disable; + goto err_firmware_deinit; =20 ret =3D hfi_core_resume(core, true); if (ret) @@ -329,6 +329,10 @@ err_core_deinit: hfi_core_deinit(core, false); err_venus_shutdown: venus_shutdown(core); +err_firmware_deinit: + venus_firmware_deinit(core); +err_of_depopulate: + of_platform_depopulate(dev); err_runtime_disable: pm_runtime_put_noidle(dev); pm_runtime_set_suspended(dev); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84414C35268 for ; Mon, 24 Jan 2022 20:29:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383246AbiAXU1C (ORCPT ); Mon, 24 Jan 2022 15:27:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352349AbiAXT5Y (ORCPT ); Mon, 24 Jan 2022 14:57:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3047FC047CD2; Mon, 24 Jan 2022 11:27:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CC56DB8122F; Mon, 24 Jan 2022 19:27:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2019C340E5; Mon, 24 Jan 2022 19:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052463; bh=7XPshxeoNpqnYhbFwujpf2lKWjymnt6lMU5HFqfZ5xU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FJ2IFaZI5S/u1rd3Bh3Iugv/kCNqN3UOBiy0Btc0WvM2vPAuR8VcXDas9afYgnsc+ umSIrQNSOK0rTvSwjvb1Edzea3nSrG7UK5WfjyWYPMFx9wb0PKL7VBCzbM/pXwo3R+ ZZ25vkcXuyzr6ppS9dzbBxMZ5yJF2T1EBy0X9BqQ= 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 , Amish Chana Subject: [PATCH 5.4 060/320] netfilter: bridge: add support for pppoe filtering Date: Mon, 24 Jan 2022 19:40:44 +0100 Message-Id: <20220124183955.776948917@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 28b78ecffea8078d81466b2e01bb5a154509f1ba ] This makes 'bridge-nf-filter-pppoe-tagged' sysctl work for bridged traffic. Looking at the original commit it doesn't appear this ever worked: static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff *= *pskb, [..] if (skb->protocol =3D=3D htons(ETH_P_8021Q)) { skb_pull(skb, VLAN_HLEN); skb->network_header +=3D VLAN_HLEN; + } else if (skb->protocol =3D=3D htons(ETH_P_PPP_SES)) { + skb_pull(skb, PPPOE_SES_HLEN); + skb->network_header +=3D PPPOE_SES_HLEN; } [..] NF_HOOK(... POST_ROUTING, ...) ... but the adjusted offsets are never restored. The alternative would be to rip this code out for good, but otoh we'd have to keep this anyway for the vlan handling (which works because vlan tag info is in the skb, not the packet payload). Reported-and-tested-by: Amish Chana Fixes: 516299d2f5b6f97 ("[NETFILTER]: bridge-nf: filter bridged IPv4/IPv6 e= ncapsulated in pppoe traffic") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/bridge/br_netfilter_hooks.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hook= s.c index 2371b833b2bcd..480e4111b24c1 100644 --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c @@ -743,6 +743,9 @@ static int br_nf_dev_queue_xmit(struct net *net, struct= sock *sk, struct sk_buff if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu) mtu =3D nf_bridge->frag_max_size; =20 + nf_bridge_update_protocol(skb); + nf_bridge_push_encap_header(skb); + if (skb_is_gso(skb) || skb->len + mtu_reserved <=3D mtu) { nf_bridge_info_free(skb); return br_dev_queue_push_xmit(net, sk, skb); @@ -760,8 +763,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct= sock *sk, struct sk_buff =20 IPCB(skb)->frag_max_size =3D nf_bridge->frag_max_size; =20 - nf_bridge_update_protocol(skb); - data =3D this_cpu_ptr(&brnf_frag_data_storage); =20 if (skb_vlan_tag_present(skb)) { @@ -789,8 +790,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct= sock *sk, struct sk_buff =20 IP6CB(skb)->frag_max_size =3D nf_bridge->frag_max_size; =20 - nf_bridge_update_protocol(skb); - data =3D this_cpu_ptr(&brnf_frag_data_storage); data->encap_size =3D nf_bridge_encap_header_len(skb); data->size =3D ETH_HLEN + data->encap_size; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD5C3C4332F for ; Mon, 24 Jan 2022 20:29:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382996AbiAXU0h (ORCPT ); Mon, 24 Jan 2022 15:26:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359630AbiAXT75 (ORCPT ); Mon, 24 Jan 2022 14:59:57 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D647C04D63B; Mon, 24 Jan 2022 11:28:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4579AB8119D; Mon, 24 Jan 2022 19:28:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DDB8C340E5; Mon, 24 Jan 2022 19:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052497; bh=f9JKyd9rol/S9GiU0MrQzzrG3hpPdnm2HGeVfi+YH18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EpzoPg5OHAXl7SlfhfbsvrXD4iDYoeB9SUr6zfsLyvbACBLjKhC4GTGS3mbVRPNOR DYRKf+0x8kE6hZvsB+1DlYDpkGwsripCuQt4AguEUVRBnV2jdwy2fV8PhKfis/AYug KzhGnJDmcwfwqeQB+faynSJGwSy7bYn1L+ZsZbNg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.4 061/320] arm64: dts: qcom: msm8916: fix MMC controller aliases Date: Mon, 24 Jan 2022 19:40:45 +0100 Message-Id: <20220124183955.808212535@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Baryshkov [ Upstream commit b0293c19d42f6d6951c2fab9a47fed50baf2c14d ] Change sdhcN aliases to mmcN to make them actually work. Currently the board uses non-standard aliases sdhcN, which do not work, resulting in mmc0 and mmc1 hosts randomly changing indices between boots. Fixes: c4da5a561627 ("arm64: dts: qcom: Add msm8916 sdhci configuration nod= es") Signed-off-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211201020559.1611890-1-dmitry.baryshkov@l= inaro.org Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm64/boot/dts/qcom/msm8916.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qc= om/msm8916.dtsi index 449843f2184d8..301c1c467c0b7 100644 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -16,8 +16,8 @@ #size-cells =3D <2>; =20 aliases { - sdhc1 =3D &sdhc_1; /* SDC1 eMMC slot */ - sdhc2 =3D &sdhc_2; /* SDC2 SD card slot */ + mmc0 =3D &sdhc_1; /* SDC1 eMMC slot */ + mmc1 =3D &sdhc_2; /* SDC2 SD card slot */ }; =20 chosen { }; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37333C3526D for ; Mon, 24 Jan 2022 19:37:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353976AbiAXTfl (ORCPT ); Mon, 24 Jan 2022 14:35:41 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51726 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344758AbiAXT2x (ORCPT ); Mon, 24 Jan 2022 14:28:53 -0500 Received: from smtp.kernel.org (relay.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 3F3D5B8121C; Mon, 24 Jan 2022 19:28:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71778C340E5; Mon, 24 Jan 2022 19:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052530; bh=iFINq28iOH83+2XQ54V20s6c/vN5UWOCAIoSrAo5+1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WF6ml9+WkcMQR+Vm5Qlkk3xqbfeuivYLuq4rK/SnKCXT7hg0jtrTskKlLAXVQZb/u MzA+ICQ1n730YHE5507ncFZ1V3GeniJbQtBbKARepFibu399WobBWTPrjB7rOLIsVR FoUOCpRbfNignwujIjwuPQKl4zYfY9CJEducb+l0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.4 062/320] ACPI: EC: Rework flushing of EC work while suspended to idle Date: Mon, 24 Jan 2022 19:40:46 +0100 Message-Id: <20220124183955.838613390@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki [ Upstream commit 4a9af6cac050dce2e895ec3205c4615383ad9112 ] The flushing of pending work in the EC driver uses drain_workqueue() to flush the event handling work that can requeue itself via advance_transaction(), but this is problematic, because that work may also be requeued from the query workqueue. Namely, if an EC transaction is carried out during the execution of a query handler, it involves calling advance_transaction() which may queue up the event handling work again. This causes the kernel to complain about attempts to add a work item to the EC event workqueue while it is being drained and worst-case it may cause a valid event to be skipped. To avoid this problem, introduce two new counters, events_in_progress and queries_in_progress, incremented when a work item is queued on the event workqueue or the query workqueue, respectively, and decremented at the end of the corresponding work function, and make acpi_ec_dispatch_gpe() the workqueues in a loop until the both of these counters are zero (or system wakeup is pending) instead of calling acpi_ec_flush_work(). At the same time, change __acpi_ec_flush_work() to call flush_workqueue() instead of drain_workqueue() to flush the event workqueue. While at it, use the observation that the work item queued in acpi_ec_query() cannot be pending at that time, because it is used only once, to simplify the code in there. Additionally, clean up a comment in acpi_ec_query() and adjust white space in acpi_ec_event_processor(). Fixes: f0ac20c3f613 ("ACPI: EC: Fix flushing of pending work") Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/acpi/ec.c | 57 +++++++++++++++++++++++++++++++---------- drivers/acpi/internal.h | 2 ++ 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 258a8df235cfb..e5b92958c299e 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -167,6 +167,7 @@ struct acpi_ec_query { struct transaction transaction; struct work_struct work; struct acpi_ec_query_handler *handler; + struct acpi_ec *ec; }; =20 static int acpi_ec_query(struct acpi_ec *ec, u8 *data); @@ -462,6 +463,7 @@ static void acpi_ec_submit_query(struct acpi_ec *ec) ec_dbg_evt("Command(%s) submitted/blocked", acpi_ec_cmd_string(ACPI_EC_COMMAND_QUERY)); ec->nr_pending_queries++; + ec->events_in_progress++; queue_work(ec_wq, &ec->work); } } @@ -528,7 +530,7 @@ static void acpi_ec_enable_event(struct acpi_ec *ec) #ifdef CONFIG_PM_SLEEP static void __acpi_ec_flush_work(void) { - drain_workqueue(ec_wq); /* flush ec->work */ + flush_workqueue(ec_wq); /* flush ec->work */ flush_workqueue(ec_query_wq); /* flush queries */ } =20 @@ -1119,7 +1121,7 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec,= u8 query_bit) } EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); =20 -static struct acpi_ec_query *acpi_ec_create_query(u8 *pval) +static struct acpi_ec_query *acpi_ec_create_query(struct acpi_ec *ec, u8 *= pval) { struct acpi_ec_query *q; struct transaction *t; @@ -1127,11 +1129,13 @@ static struct acpi_ec_query *acpi_ec_create_query(u= 8 *pval) q =3D kzalloc(sizeof (struct acpi_ec_query), GFP_KERNEL); if (!q) return NULL; + INIT_WORK(&q->work, acpi_ec_event_processor); t =3D &q->transaction; t->command =3D ACPI_EC_COMMAND_QUERY; t->rdata =3D pval; t->rlen =3D 1; + q->ec =3D ec; return q; } =20 @@ -1148,13 +1152,21 @@ static void acpi_ec_event_processor(struct work_str= uct *work) { struct acpi_ec_query *q =3D container_of(work, struct acpi_ec_query, work= ); struct acpi_ec_query_handler *handler =3D q->handler; + struct acpi_ec *ec =3D q->ec; =20 ec_dbg_evt("Query(0x%02x) started", handler->query_bit); + if (handler->func) handler->func(handler->data); else if (handler->handle) acpi_evaluate_object(handler->handle, NULL, NULL, NULL); + ec_dbg_evt("Query(0x%02x) stopped", handler->query_bit); + + spin_lock_irq(&ec->lock); + ec->queries_in_progress--; + spin_unlock_irq(&ec->lock); + acpi_ec_delete_query(q); } =20 @@ -1164,7 +1176,7 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data) int result; struct acpi_ec_query *q; =20 - q =3D acpi_ec_create_query(&value); + q =3D acpi_ec_create_query(ec, &value); if (!q) return -ENOMEM; =20 @@ -1186,19 +1198,20 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *da= ta) } =20 /* - * It is reported that _Qxx are evaluated in a parallel way on - * Windows: + * It is reported that _Qxx are evaluated in a parallel way on Windows: * https://bugzilla.kernel.org/show_bug.cgi?id=3D94411 * - * Put this log entry before schedule_work() in order to make - * it appearing before any other log entries occurred during the - * work queue execution. + * Put this log entry before queue_work() to make it appear in the log + * before any other messages emitted during workqueue handling. */ ec_dbg_evt("Query(0x%02x) scheduled", value); - if (!queue_work(ec_query_wq, &q->work)) { - ec_dbg_evt("Query(0x%02x) overlapped", value); - result =3D -EBUSY; - } + + spin_lock_irq(&ec->lock); + + ec->queries_in_progress++; + queue_work(ec_query_wq, &q->work); + + spin_unlock_irq(&ec->lock); =20 err_exit: if (result) @@ -1256,6 +1269,10 @@ static void acpi_ec_event_handler(struct work_struct= *work) ec_dbg_evt("Event stopped"); =20 acpi_ec_check_event(ec); + + spin_lock_irqsave(&ec->lock, flags); + ec->events_in_progress--; + spin_unlock_irqrestore(&ec->lock, flags); } =20 static u32 acpi_ec_gpe_handler(acpi_handle gpe_device, @@ -1972,6 +1989,7 @@ void acpi_ec_set_gpe_wake_mask(u8 action) =20 bool acpi_ec_dispatch_gpe(void) { + bool work_in_progress; u32 ret; =20 if (!first_ec) @@ -1992,8 +2010,19 @@ bool acpi_ec_dispatch_gpe(void) if (ret =3D=3D ACPI_INTERRUPT_HANDLED) pm_pr_dbg("EC GPE dispatched\n"); =20 - /* Flush the event and query workqueues. */ - acpi_ec_flush_work(); + /* Drain EC work. */ + do { + acpi_ec_flush_work(); + + pm_pr_dbg("ACPI EC work flushed\n"); + + spin_lock_irq(&first_ec->lock); + + work_in_progress =3D first_ec->events_in_progress + + first_ec->queries_in_progress > 0; + + spin_unlock_irq(&first_ec->lock); + } while (work_in_progress && !pm_wakeup_pending()); =20 return false; } diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 159c422601bc4..62b6b36f3a37c 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -183,6 +183,8 @@ struct acpi_ec { struct work_struct work; unsigned long timestamp; unsigned long nr_pending_queries; + unsigned int events_in_progress; + unsigned int queries_in_progress; bool busy_polling; unsigned int polling_guard; }; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C62CC433EF for ; Mon, 24 Jan 2022 20:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381514AbiAXUVL (ORCPT ); Mon, 24 Jan 2022 15:21:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354537AbiAXUDK (ORCPT ); Mon, 24 Jan 2022 15:03:10 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB840C068099; Mon, 24 Jan 2022 11:29:09 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 787A06121F; Mon, 24 Jan 2022 19:29:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C1EFC340E5; Mon, 24 Jan 2022 19:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052548; bh=j9v4ELVvP4tqIhgux2H8+EMhBOnwF6PBYkPSz86upds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G0WaE1aTAcgMlTHqJv98wachaC5XXSfBUJpayNXB0bc0jcpDCL+q1uhbPesMALmua WiOXgvM1bOkoBnzFgNIgtDyj+NfKL4KYLVIJ83ulK9vHQ4eLRSTYJQsmmIBAQLZ/1k Loh/pxdXqBuEsaJILT0oIuAb5+JIguuv7mZRjY/E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Alex Deucher , Sasha Levin Subject: [PATCH 5.4 063/320] drm/amdgpu: Fix a NULL pointer dereference in amdgpu_connector_lcd_native_mode() Date: Mon, 24 Jan 2022 19:40:47 +0100 Message-Id: <20220124183955.871825060@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit b220110e4cd442156f36e1d9b4914bb9e87b0d00 ] In amdgpu_connector_lcd_native_mode(), the return value of drm_mode_duplicate() is assigned to mode, and there is a dereference of it in amdgpu_connector_lcd_native_mode(), which will lead to a NULL pointer dereference on failure of drm_mode_duplicate(). Fix this bug add a check of mode. This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_DRM_AMDGPU=3Dm show no new warnings, and our static analyzer no longer warns about this code. Fixes: d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)") Signed-off-by: Zhou Qingyang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/d= rm/amd/amdgpu/amdgpu_connectors.c index 0d39e386f6e9c..0e1cacf731698 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -389,6 +389,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *en= coder) native_mode->vdisplay !=3D 0 && native_mode->clock !=3D 0) { mode =3D drm_mode_duplicate(dev, native_mode); + if (!mode) + return NULL; + mode->type =3D DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; drm_mode_set_name(mode); =20 @@ -403,6 +406,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *en= coder) * simpler. */ mode =3D drm_cvt_mode(dev, native_mode->hdisplay, native_mode->vdisplay,= 60, true, false, false); + if (!mode) + return NULL; + mode->type =3D DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; DRM_DEBUG_KMS("Adding cvt approximation of native panel mode %s\n", mode= ->name); } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 181F9C433EF for ; Mon, 24 Jan 2022 20:02:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348503AbiAXUCj (ORCPT ); Mon, 24 Jan 2022 15:02:39 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51910 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242910AbiAXT3S (ORCPT ); Mon, 24 Jan 2022 14:29:18 -0500 Received: from smtp.kernel.org (relay.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 3AD25B8119D; Mon, 24 Jan 2022 19:29:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69F3BC340E5; Mon, 24 Jan 2022 19:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052552; bh=WiPti4Hvt08D59RYFB4prrRHKNnMGFuDb65RGfn33H0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jGDroVWFT4yS9dm+z81FB5LvgDhdV6hfxWIC6bHJOHJukfmqKXhb2Ohh7F9yGBFmV C1iQpjiZxd+lrzzE0o8E7qQEh0sZqNGfh8QytwFM4qVYHNzzP3v8Nz4BSOAxun/sWj sYfJslEFULqRl7VfUkSog0ALnPx1Yo3djChamkh4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20K=C3=B6nig?= , Zhou Qingyang , Alex Deucher , Sasha Levin Subject: [PATCH 5.4 064/320] drm/radeon/radeon_kms: Fix a NULL pointer dereference in radeon_driver_open_kms() Date: Mon, 24 Jan 2022 19:40:48 +0100 Message-Id: <20220124183955.904758423@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Zhou Qingyang [ Upstream commit ab50cb9df8896b39aae65c537a30de2c79c19735 ] In radeon_driver_open_kms(), radeon_vm_bo_add() is assigned to vm->ib_bo_va and passes and used in radeon_vm_bo_set_addr(). In radeon_vm_bo_set_addr(), there is a dereference of vm->ib_bo_va, which could lead to a NULL pointer dereference on failure of radeon_vm_bo_add(). Fix this bug by adding a check of vm->ib_bo_va. This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_DRM_RADEON=3Dm show no new warnings, and our static analyzer no longer warns about this code. Fixes: cc9e67e3d700 ("drm/radeon: fix VM IB handling") Reviewed-by: Christian K=C3=B6nig Signed-off-by: Zhou Qingyang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/radeon/radeon_kms.c | 36 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/r= adeon_kms.c index 03d3550ecc7cb..5d04dd744af3d 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -634,6 +634,8 @@ void radeon_driver_lastclose_kms(struct drm_device *dev) int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_p= riv) { struct radeon_device *rdev =3D dev->dev_private; + struct radeon_fpriv *fpriv; + struct radeon_vm *vm; int r; =20 file_priv->driver_priv =3D NULL; @@ -646,8 +648,6 @@ int radeon_driver_open_kms(struct drm_device *dev, stru= ct drm_file *file_priv) =20 /* new gpu have virtual address space support */ if (rdev->family >=3D CHIP_CAYMAN) { - struct radeon_fpriv *fpriv; - struct radeon_vm *vm; =20 fpriv =3D kzalloc(sizeof(*fpriv), GFP_KERNEL); if (unlikely(!fpriv)) { @@ -658,35 +658,39 @@ int radeon_driver_open_kms(struct drm_device *dev, st= ruct drm_file *file_priv) if (rdev->accel_working) { vm =3D &fpriv->vm; r =3D radeon_vm_init(rdev, vm); - if (r) { - kfree(fpriv); - goto out_suspend; - } + if (r) + goto out_fpriv; =20 r =3D radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); - if (r) { - radeon_vm_fini(rdev, vm); - kfree(fpriv); - goto out_suspend; - } + if (r) + goto out_vm_fini; =20 /* map the ib pool buffer read only into * virtual address space */ vm->ib_bo_va =3D radeon_vm_bo_add(rdev, vm, rdev->ring_tmp_bo.bo); + if (!vm->ib_bo_va) { + r =3D -ENOMEM; + goto out_vm_fini; + } + r =3D radeon_vm_bo_set_addr(rdev, vm->ib_bo_va, RADEON_VA_IB_OFFSET, RADEON_VM_PAGE_READABLE | RADEON_VM_PAGE_SNOOPED); - if (r) { - radeon_vm_fini(rdev, vm); - kfree(fpriv); - goto out_suspend; - } + if (r) + goto out_vm_fini; } file_priv->driver_priv =3D fpriv; } =20 + if (!r) + goto out_suspend; + +out_vm_fini: + radeon_vm_fini(rdev, vm); +out_fpriv: + kfree(fpriv); out_suspend: pm_runtime_mark_last_busy(dev->dev); pm_runtime_put_autosuspend(dev->dev); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B86AC433EF for ; Mon, 24 Jan 2022 20:21:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381472AbiAXUVC (ORCPT ); Mon, 24 Jan 2022 15:21:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354592AbiAXUDK (ORCPT ); Mon, 24 Jan 2022 15:03:10 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21817C0680A1; Mon, 24 Jan 2022 11:29:16 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B475E6121F; Mon, 24 Jan 2022 19:29:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FC1AC340E5; Mon, 24 Jan 2022 19:29:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052555; bh=Io6GojHjOIH5iEGY0sX45+CZjrtUYNzXyKuwv4OimYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zGOH3KS/iO5ybjej1z6bKqm0+LEBRkqAYZhOeKVkuZmtyJrsPi9WcJfw6hJkWsyop O7o285oy82OzB92UrSq4FgY2JfgQpG9Ni2P6D6W/ncPOa+ODC7isVuRWTbZceHYzkQ Lx9nrDL2jA9WaM5uUK3+47X+5t6tOT6C98bQ+eyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan , Nishanth Menon , Pratyush Yadav , Vignesh Raghavendra , Sasha Levin Subject: [PATCH 5.4 065/320] arm64: dts: ti: k3-j721e: Fix the L2 cache sets Date: Mon, 24 Jan 2022 19:40:49 +0100 Message-Id: <20220124183955.936018891@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nishanth Menon [ Upstream commit e9ba3a5bc6fdc2c796c69fdaf5ed6c9957cf9f9d ] A72's L2 cache[1] on J721e[2] is 1MB. A72's L2 is fixed line length of 64 bytes and 16-way set-associative cache structure. 1MB of L2 / 64 (line length) =3D 16384 ways 16384 ways / 16 =3D 1024 sets Fix the l2 cache-sets. [1] https://developer.arm.com/documentation/100095/0003/Level-2-Memory-Syst= em/About-the-L2-memory-system [2] http://www.ti.com/lit/pdf/spruil1 Fixes: 2d87061e70de ("arm64: dts: ti: Add Support for J721E SoC") Reported-by: Peng Fan Signed-off-by: Nishanth Menon Reviewed-by: Pratyush Yadav Signed-off-by: Vignesh Raghavendra Link: https://lore.kernel.org/r/20211113043639.4413-1-nm@ti.com Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm64/boot/dts/ti/k3-j721e.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/ti/k3-j721e.dtsi b/arch/arm64/boot/dts/ti/= k3-j721e.dtsi index f4d8f3b37d5bb..5a6e74636d6fc 100644 --- a/arch/arm64/boot/dts/ti/k3-j721e.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j721e.dtsi @@ -84,7 +84,7 @@ cache-level =3D <2>; cache-size =3D <0x100000>; cache-line-size =3D <64>; - cache-sets =3D <2048>; + cache-sets =3D <1024>; next-level-cache =3D <&msmc_l3>; }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A676C433EF for ; Mon, 24 Jan 2022 19:37:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354056AbiAXTfw (ORCPT ); Mon, 24 Jan 2022 14:35:52 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56854 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239424AbiAXT3T (ORCPT ); Mon, 24 Jan 2022 14:29:19 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8334961318; Mon, 24 Jan 2022 19:29:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63496C340E7; Mon, 24 Jan 2022 19:29:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052558; bh=5+WVR8/VwfqjhVkSmEbR7E7LpMZedr93a/vPe4N8MMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kJ8waSCWfU6vQ58frZU4U2+Mfr0m+u7N6kbJJusUA63Sj+ipcwHdKVY4xTsNS0QFK EofTPDmq6T/xFeDajnYHU/irdS2urNuyNcU4xU/7e/PSO8jeTS+OJKqtsaWvZfOoPU TZNZNPPCfwnZjoqvCtaf9oaUml/hAIR/sJbhqcYk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lizhi Hou , Sasha Levin Subject: [PATCH 5.4 066/320] tty: serial: uartlite: allow 64 bit address Date: Mon, 24 Jan 2022 19:40:50 +0100 Message-Id: <20220124183955.969344022@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lizhi Hou [ Upstream commit 3672fb65155530b5eea6225685c75329b6debec3 ] The base address of uartlite registers could be 64 bit address which is from device resource. When ulite_probe() calls ulite_assign(), this 64 bit address is casted to 32-bit. The fix is to replace "u32" type with "phys_addr_t" type for the base address in ulite_assign() argument list. Fixes: 8fa7b6100693 ("[POWERPC] Uartlite: Separate the bus binding from the= driver proper") Signed-off-by: Lizhi Hou Link: https://lore.kernel.org/r/20211129202302.1319033-1-lizhi.hou@xilinx.c= om Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/tty/serial/uartlite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c index 56066d93a65b8..9a4049c894f7a 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c @@ -618,7 +618,7 @@ static struct uart_driver ulite_uart_driver =3D { * * Returns: 0 on success, <0 otherwise */ -static int ulite_assign(struct device *dev, int id, u32 base, int irq, +static int ulite_assign(struct device *dev, int id, phys_addr_t base, int = irq, struct uartlite_data *pdata) { struct uart_port *port; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69508C433FE for ; Mon, 24 Jan 2022 20:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359778AbiAXUCc (ORCPT ); Mon, 24 Jan 2022 15:02:32 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52022 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351979AbiAXT3Z (ORCPT ); Mon, 24 Jan 2022 14:29:25 -0500 Received: from smtp.kernel.org (relay.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 390DFB81215; Mon, 24 Jan 2022 19:29:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EE1DC340E8; Mon, 24 Jan 2022 19:29:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052561; bh=24dK8aJynKW8UzRARZZ9LbUpGPtlKnYUFP2ad0kgR6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B5171Y+625JkClYzYTXaRyQ8sBAP6hwT3oaobyt4pz+VQ3hLiEBPeQEsrgEEIRxbk mCktEIcbjwLEVQ+duoXmVyH3tMMkFUo45pKB3j6i2nLvb6H6MRwHE734qdKD3BQO7B NZzdwymd8j1Xcxa8TmmwFCCa10YcZIFCuTCJ+cWQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lino Sanfilippo , Sasha Levin Subject: [PATCH 5.4 067/320] serial: amba-pl011: do not request memory region twice Date: Mon, 24 Jan 2022 19:40:51 +0100 Message-Id: <20220124183956.008990956@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Lino Sanfilippo [ Upstream commit d1180405c7b5c7a1c6bde79d5fc24fe931430737 ] With commit 3873e2d7f63a ("drivers: PL011: refactor pl011_probe()") the function devm_ioremap() called from pl011_setup_port() was replaced with devm_ioremap_resource(). Since this function not only remaps but also requests the ports io memory region it now collides with the .config_port() callback which requests the same region at uart port registration. Since devm_ioremap_resource() already claims the memory successfully, the request in .config_port() fails. Later at uart port deregistration the attempt to release the unclaimed memory also fails. The failure results in a =E2=80=9CTrying to free nonexis= tent resource" warning. Fix these issues by removing the callbacks that implement the redundant memory allocation/release. Also make sure that changing the drivers io memory base address via TIOCSSERIAL is not allowed any more. Fixes: 3873e2d7f63a ("drivers: PL011: refactor pl011_probe()") Signed-off-by: Lino Sanfilippo Link: https://lore.kernel.org/r/20211129174238.8333-1-LinoSanfilippo@gmx.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/tty/serial/amba-pl011.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl01= 1.c index 6741d0f3daf94..0bd8c05d72d60 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2094,32 +2094,13 @@ static const char *pl011_type(struct uart_port *por= t) return uap->port.type =3D=3D PORT_AMBA ? uap->type : NULL; } =20 -/* - * Release the memory region(s) being used by 'port' - */ -static void pl011_release_port(struct uart_port *port) -{ - release_mem_region(port->mapbase, SZ_4K); -} - -/* - * Request the memory region(s) being used by 'port' - */ -static int pl011_request_port(struct uart_port *port) -{ - return request_mem_region(port->mapbase, SZ_4K, "uart-pl011") - !=3D NULL ? 0 : -EBUSY; -} - /* * Configure/autoconfigure the port. */ static void pl011_config_port(struct uart_port *port, int flags) { - if (flags & UART_CONFIG_TYPE) { + if (flags & UART_CONFIG_TYPE) port->type =3D PORT_AMBA; - pl011_request_port(port); - } } =20 /* @@ -2134,6 +2115,8 @@ static int pl011_verify_port(struct uart_port *port, = struct serial_struct *ser) ret =3D -EINVAL; if (ser->baud_base < 9600) ret =3D -EINVAL; + if (port->mapbase !=3D (unsigned long) ser->iomem_base) + ret =3D -EINVAL; return ret; } =20 @@ -2151,8 +2134,6 @@ static const struct uart_ops amba_pl011_pops =3D { .flush_buffer =3D pl011_dma_flush_buffer, .set_termios =3D pl011_set_termios, .type =3D pl011_type, - .release_port =3D pl011_release_port, - .request_port =3D pl011_request_port, .config_port =3D pl011_config_port, .verify_port =3D pl011_verify_port, #ifdef CONFIG_CONSOLE_POLL @@ -2182,8 +2163,6 @@ static const struct uart_ops sbsa_uart_pops =3D { .shutdown =3D sbsa_uart_shutdown, .set_termios =3D sbsa_uart_set_termios, .type =3D pl011_type, - .release_port =3D pl011_release_port, - .request_port =3D pl011_request_port, .config_port =3D pl011_config_port, .verify_port =3D pl011_verify_port, #ifdef CONFIG_CONSOLE_POLL --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75D89C433F5 for ; Mon, 24 Jan 2022 20:21:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343943AbiAXUVd (ORCPT ); Mon, 24 Jan 2022 15:21:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354637AbiAXUDQ (ORCPT ); Mon, 24 Jan 2022 15:03:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2528C0680B1; Mon, 24 Jan 2022 11:29:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 822DF6121F; Mon, 24 Jan 2022 19:29:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F8ACC340E5; Mon, 24 Jan 2022 19:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052564; bh=O+wV61hDuUBLN9MQUp3fRVGM3ohEbAo7+Lu3sKVPxfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y3L9HqBZ8xjspTEoaQdxe0FqizTnQHloQ64un2ZleSOEkKtUxA2aSD7ySs4h/3Y+8 dmN3R7EMYlMZdr3OK4AvtHWVzwy+HBWAPr9sXgqmwrR4RKgNN97UDXkmUOiws2/WVv ahZvr1AQB2EX0Ol539lmxs8ueNfttomEf13bJmhg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tasos Sahanidis , Denis Efremov , Jens Axboe , Sasha Levin Subject: [PATCH 5.4 068/320] floppy: Fix hang in watchdog when disk is ejected Date: Mon, 24 Jan 2022 19:40:52 +0100 Message-Id: <20220124183956.040262234@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tasos Sahanidis [ Upstream commit fb48febce7e30baed94dd791e19521abd2c3fd83 ] When the watchdog detects a disk change, it calls cancel_activity(), which in turn tries to cancel the fd_timer delayed work. In the above scenario, fd_timer_fn is set to fd_watchdog(), meaning it is trying to cancel its own work. This results in a hang as cancel_delayed_work_sync() is waiting for the watchdog (itself) to return, which never happens. This can be reproduced relatively consistently by attempting to read a broken floppy, and ejecting it while IO is being attempted and retried. To resolve this, this patch calls cancel_delayed_work() instead, which cancels the work without waiting for the watchdog to return and finish. Before this regression was introduced, the code in this section used del_timer(), and not del_timer_sync() to delete the watchdog timer. Link: https://lore.kernel.org/r/399e486c-6540-db27-76aa-7a271b061f76@tasoss= ah.com Fixes: 070ad7e793dc ("floppy: convert to delayed work and single-thread wq") Signed-off-by: Tasos Sahanidis Signed-off-by: Denis Efremov Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/block/floppy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index ac97a1e2e5ddc..212a1e1ce0d9e 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -1003,7 +1003,7 @@ static DECLARE_DELAYED_WORK(fd_timer, fd_timer_workfn= ); static void cancel_activity(void) { do_floppy =3D NULL; - cancel_delayed_work_sync(&fd_timer); + cancel_delayed_work(&fd_timer); cancel_work_sync(&floppy_work); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3714C4321E for ; Mon, 24 Jan 2022 20:29:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383228AbiAXU07 (ORCPT ); Mon, 24 Jan 2022 15:26:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352528AbiAXT51 (ORCPT ); Mon, 24 Jan 2022 14:57:27 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16748C047CD7; Mon, 24 Jan 2022 11:27:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D16ABB8124F; Mon, 24 Jan 2022 19:27:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A340C340E8; Mon, 24 Jan 2022 19:27:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052466; bh=2GpnY8vqsVSbMQOw9UMBU8BSPRxFPtHHdtM8Ph3ap/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gCEZuOWSXCNIXsIZ362k7BB9mOOelRlU4PrN0NBEBQslkvZlzQ1IzglM6pc5FxO3x uf2QbA6Lem3LeTd9jVjdW7q/pPTshdGGYnrQZRvlWPtQ7ooMDG6HD4KtyrEFQbFXbz HFDXxVqyTU6fjmpjAb2+fBX5WsHY+6ij92UcsO7Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Pavel Skripkin , Yang Yingliang , Sasha Levin Subject: [PATCH 5.4 069/320] staging: rtl8192e: return error code from rtllib_softmac_init() Date: Mon, 24 Jan 2022 19:40:53 +0100 Message-Id: <20220124183956.071298714@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit 68bf78ff59a0891eb1239948e94ce10f73a9dd30 ] If it fails to allocate 'dot11d_info', rtllib_softmac_init() should return error code. And remove unneccessary error message. Fixes: 94a799425eee ("From: wlanfae ") Reviewed-by: Dan Carpenter Reviewed-by: Pavel Skripkin Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20211202030704.2425621-2-yangyingliang@huaw= ei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/staging/rtl8192e/rtllib.h | 2 +- drivers/staging/rtl8192e/rtllib_softmac.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/r= tllib.h index 2eeb9a43734e3..49bf3ad31f912 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -1982,7 +1982,7 @@ void rtllib_softmac_xmit(struct rtllib_txb *txb, stru= ct rtllib_device *ieee); void rtllib_stop_send_beacons(struct rtllib_device *ieee); void notify_wx_assoc_event(struct rtllib_device *ieee); void rtllib_start_ibss(struct rtllib_device *ieee); -void rtllib_softmac_init(struct rtllib_device *ieee); +int rtllib_softmac_init(struct rtllib_device *ieee); void rtllib_softmac_free(struct rtllib_device *ieee); void rtllib_disassociate(struct rtllib_device *ieee); void rtllib_stop_scan(struct rtllib_device *ieee); diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rt= l8192e/rtllib_softmac.c index f2f7529e7c80e..4ff8fd694c600 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2952,7 +2952,7 @@ void rtllib_start_protocol(struct rtllib_device *ieee) } } =20 -void rtllib_softmac_init(struct rtllib_device *ieee) +int rtllib_softmac_init(struct rtllib_device *ieee) { int i; =20 @@ -2963,7 +2963,8 @@ void rtllib_softmac_init(struct rtllib_device *ieee) ieee->seq_ctrl[i] =3D 0; ieee->dot11d_info =3D kzalloc(sizeof(struct rt_dot11d_info), GFP_ATOMIC); if (!ieee->dot11d_info) - netdev_err(ieee->dev, "Can't alloc memory for DOT11D\n"); + return -ENOMEM; + ieee->LinkDetectInfo.SlotIndex =3D 0; ieee->LinkDetectInfo.SlotNum =3D 2; ieee->LinkDetectInfo.NumRecvBcnInPeriod =3D 0; @@ -3031,6 +3032,7 @@ void rtllib_softmac_init(struct rtllib_device *ieee) (void(*)(unsigned long)) rtllib_sta_ps, (unsigned long)ieee); =20 + return 0; } =20 void rtllib_softmac_free(struct rtllib_device *ieee) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53F77C3527B for ; Mon, 24 Jan 2022 20:17:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380514AbiAXUQZ (ORCPT ); Mon, 24 Jan 2022 15:16:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352696AbiAXT5b (ORCPT ); Mon, 24 Jan 2022 14:57:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E420C047CE0; Mon, 24 Jan 2022 11:27:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AA432B811F9; Mon, 24 Jan 2022 19:27:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA315C340E7; Mon, 24 Jan 2022 19:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052469; bh=TVOUWNBzfDhAxoXUMjAv2R95FzmE2kWLWGzml5e+0xM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yim4rdW855uNiP8MExWtHJoNutDxW8Wd8R+24/U2jroz4wfFRDIsrO46wzsD62QeZ g8sRJpdJQtia5tn651TZ2dj80+3G3NK1bOvcd+oxBJ2Y4Ba0GUnG4h3FoQ1hrj11Dd 0N0qJ5k1I8iX1qdDVvIb1SKWppdDDgE23aX6dPOU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Pavel Skripkin , Yang Yingliang , Sasha Levin Subject: [PATCH 5.4 070/320] staging: rtl8192e: rtllib_module: fix error handle case in alloc_rtllib() Date: Mon, 24 Jan 2022 19:40:54 +0100 Message-Id: <20220124183956.108196673@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit e730cd57ac2dfe94bca0f14a3be8e1b21de41a9c ] Some variables are leaked in the error handling in alloc_rtllib(), free the variables in the error path. Fixes: 94a799425eee ("From: wlanfae ") Reviewed-by: Dan Carpenter Reviewed-by: Pavel Skripkin Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20211202030704.2425621-3-yangyingliang@huaw= ei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/staging/rtl8192e/rtllib_module.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl= 8192e/rtllib_module.c index 64d9feee1f392..f00ac94b2639b 100644 --- a/drivers/staging/rtl8192e/rtllib_module.c +++ b/drivers/staging/rtl8192e/rtllib_module.c @@ -88,7 +88,7 @@ struct net_device *alloc_rtllib(int sizeof_priv) err =3D rtllib_networks_allocate(ieee); if (err) { pr_err("Unable to allocate beacon storage: %d\n", err); - goto failed; + goto free_netdev; } rtllib_networks_initialize(ieee); =20 @@ -121,11 +121,13 @@ struct net_device *alloc_rtllib(int sizeof_priv) ieee->hwsec_active =3D 0; =20 memset(ieee->swcamtable, 0, sizeof(struct sw_cam_table) * 32); - rtllib_softmac_init(ieee); + err =3D rtllib_softmac_init(ieee); + if (err) + goto free_crypt_info; =20 ieee->pHTInfo =3D kzalloc(sizeof(struct rt_hi_throughput), GFP_KERNEL); if (!ieee->pHTInfo) - return NULL; + goto free_softmac; =20 HTUpdateDefaultSetting(ieee); HTInitializeHTInfo(ieee); @@ -141,8 +143,14 @@ struct net_device *alloc_rtllib(int sizeof_priv) =20 return dev; =20 - failed: +free_softmac: + rtllib_softmac_free(ieee); +free_crypt_info: + lib80211_crypt_info_free(&ieee->crypt_info); + rtllib_networks_free(ieee); +free_netdev: free_netdev(dev); + return NULL; } EXPORT_SYMBOL(alloc_rtllib); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CBFCC4167B for ; Mon, 24 Jan 2022 20:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380683AbiAXUQn (ORCPT ); Mon, 24 Jan 2022 15:16:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346894AbiAXT6B (ORCPT ); Mon, 24 Jan 2022 14:58:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64F64C047CE9; Mon, 24 Jan 2022 11:27:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 017CA614B8; Mon, 24 Jan 2022 19:27:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4E6BC340E5; Mon, 24 Jan 2022 19:27:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052472; bh=twygcYS3MkXap/tO7SELMXxCodF8l1SPOiexz0O7FVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V6wAW3JhNW83z3ZL1DQh3dBSQaaDyoOBPT5qvQRrYRZrxRPG6SdvlPuUxlBVXJgEv 0pFtoFp9wfnpKtzRdlSekgvGn2Aj0wTO90IZY8K+490xt8FvkSipIvqlYbYEEIyF0T 966C6emvGR9NiAcQGUPjICWe2T+Jzt1DvchtETu4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark-yw Chen , Sean Wang , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.4 071/320] Bluetooth: btmtksdio: fix resume failure Date: Mon, 24 Jan 2022 19:40:55 +0100 Message-Id: <20220124183956.139201313@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wang [ Upstream commit 561ae1d46a8ddcbc13162d5771f5ed6c8249e730 ] btmtksdio have to rely on MMC_PM_KEEP_POWER in pm_flags to avoid that SDIO power is being shut off during the device is in suspend. That fixes the SDIO command fails to access the bus after the device is resumed. Fixes: 7f3c563c575e7 ("Bluetooth: btmtksdio: Add runtime PM support to SDIO= based Bluetooth") Co-developed-by: Mark-yw Chen Signed-off-by: Mark-yw Chen Signed-off-by: Sean Wang Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/bluetooth/btmtksdio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c index 304178be1ef40..c2eb64bcd5d5d 100644 --- a/drivers/bluetooth/btmtksdio.c +++ b/drivers/bluetooth/btmtksdio.c @@ -1041,6 +1041,8 @@ static int btmtksdio_runtime_suspend(struct device *d= ev) if (!bdev) return 0; =20 + sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); + sdio_claim_host(bdev->func); =20 sdio_writel(bdev->func, C_FW_OWN_REQ_SET, MTK_REG_CHLPCR, &err); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 450A3C433EF for ; Mon, 24 Jan 2022 20:29:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383076AbiAXU0q (ORCPT ); Mon, 24 Jan 2022 15:26:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347462AbiAXT6o (ORCPT ); Mon, 24 Jan 2022 14:58:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A134C047CFB; Mon, 24 Jan 2022 11:27:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 82712B8122F; Mon, 24 Jan 2022 19:27:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2F0AC340E5; Mon, 24 Jan 2022 19:27:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052476; bh=Yp1NnFfvlH+1ASCwb2Hc7AdUpcyrvhhExdH1MabsrVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Xjq6jHOahJydU2phcUygrU3kn7I8+7JflXeRkRiUKW6Hwn9DjbzDRL7YXQxUIyHR WQuNP26z2Cy1b+JLIPCcnpSnPFWaeqAD7GTrc/4uvSz3QBsJV5rdra7KfAYTo3lTnt vuxXB3guWeDgWUAzifDlen4dApS8AeYcmnQT+EOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 072/320] media: dib8000: Fix a memleak in dib8000_init() Date: Mon, 24 Jan 2022 19:40:56 +0100 Message-Id: <20220124183956.175905593@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit 8dbdcc7269a83305ee9d677b75064d3530a48ee2 ] In dib8000_init(), the variable fe is not freed or passed out on the failure of dib8000_identify(&state->i2c), which could lead to a memleak. Fix this bug by adding a kfree of fe in the error path. This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_DVB_DIB8000=3Dm show no new warnings, and our static analyzer no longer warns about this code. Fixes: 77e2c0f5d471 ("V4L/DVB (12900): DiB8000: added support for DiBcom IS= DB-T/ISDB-Tsb demodulator DiB8000") Signed-off-by: Zhou Qingyang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/dvb-frontends/dib8000.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-fron= tends/dib8000.c index bb02354a48b81..d67f2dd997d06 100644 --- a/drivers/media/dvb-frontends/dib8000.c +++ b/drivers/media/dvb-frontends/dib8000.c @@ -4473,8 +4473,10 @@ static struct dvb_frontend *dib8000_init(struct i2c_= adapter *i2c_adap, u8 i2c_ad =20 state->timf_default =3D cfg->pll->timf; =20 - if (dib8000_identify(&state->i2c) =3D=3D 0) + if (dib8000_identify(&state->i2c) =3D=3D 0) { + kfree(fe); goto error; + } =20 dibx000_init_i2c_master(&state->i2c_master, DIB8000, state->i2c.adap, sta= te->i2c.addr); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35121C4167B for ; Mon, 24 Jan 2022 20:17:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380710AbiAXUQs (ORCPT ); Mon, 24 Jan 2022 15:16:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347532AbiAXT6p (ORCPT ); Mon, 24 Jan 2022 14:58:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D49AC047CFF; Mon, 24 Jan 2022 11:28:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BAC7460917; Mon, 24 Jan 2022 19:27:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94CE0C340E5; Mon, 24 Jan 2022 19:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052479; bh=tmTLQNf5BhZCWTqkO9rUODhM5eaul2RlC0GLt8NNmhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qvsgcyVHEpSnCTW9ddLpVAkoW+jCybLMC++JaRnGtxw3axb4zb8QvDPZ+AStk8X6s bPQVErX5Idsl5zpvuGt96huWVh+jppYfmNP4baf1lnpxiWqoSGGtj5dbIXooOzgK6q 6gDkB+r2ctMh3of2EVBM0UgHqaXp8fjo3sjCpcIw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 073/320] media: saa7146: mxb: Fix a NULL pointer dereference in mxb_attach() Date: Mon, 24 Jan 2022 19:40:57 +0100 Message-Id: <20220124183956.213783043@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit 0407c49ebe330333478440157c640fffd986f41b ] In mxb_attach(dev, info), saa7146_vv_init() is called to allocate a new memory for dev->vv_data. saa7146_vv_release() will be called on failure of mxb_probe(dev). There is a dereference of dev->vv_data in saa7146_vv_release(), which could lead to a NULL pointer dereference on failure of saa7146_vv_init(). Fix this bug by adding a check of saa7146_vv_init(). This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_VIDEO_MXB=3Dm show no new warnings, and our static analyzer no longer warns about this code. Fixes: 03b1930efd3c ("V4L/DVB: saa7146: fix regression of the av7110/budget= -av driver") Signed-off-by: Zhou Qingyang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/pci/saa7146/mxb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mx= b.c index 952ea250feda0..58fe4c1619eeb 100644 --- a/drivers/media/pci/saa7146/mxb.c +++ b/drivers/media/pci/saa7146/mxb.c @@ -683,10 +683,16 @@ static struct saa7146_ext_vv vv_data; static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio= n_data *info) { struct mxb *mxb; + int ret; =20 DEB_EE("dev:%p\n", dev); =20 - saa7146_vv_init(dev, &vv_data); + ret =3D saa7146_vv_init(dev, &vv_data); + if (ret) { + ERR("Error in saa7146_vv_init()"); + return ret; + } + if (mxb_probe(dev)) { saa7146_vv_release(dev); return -1; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D1A0C433EF for ; Mon, 24 Jan 2022 22:54:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839579AbiAXWvX (ORCPT ); Mon, 24 Jan 2022 17:51:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1458135AbiAXVmr (ORCPT ); Mon, 24 Jan 2022 16:42:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB8C2C04D602; Mon, 24 Jan 2022 11:28:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 73A3CB8121B; Mon, 24 Jan 2022 19:28:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0E30C340E5; Mon, 24 Jan 2022 19:28:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052482; bh=4FbeBf20xb7bbU524D4+GOwUrzmhwbI/YceguH5f59g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1+ooUKFPn9fKJdPCzNIAH+5YdmnwoS6Yg2pKEOjJkSoEyOzgNt/4dVpSaY4d9m76Q VXl0XbfyKQtAe00kxo+d16Fa8J5IhQLoJho5rlAoQHLRW4iwAPsHizpxm3r0CbNXtu Dt+zhavZmX+xRPYbU9QhLB6af2XwvsNs5koRi0OI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Schlabbach , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 074/320] media: si2157: Fix "warm" tuner state detection Date: Mon, 24 Jan 2022 19:40:58 +0100 Message-Id: <20220124183956.248493211@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Schlabbach [ Upstream commit a6441ea29cb2c9314654e093a1cd8020b9b851c8 ] Commit e955f959ac52 ("media: si2157: Better check for running tuner in init") completely broke the "warm" tuner detection of the si2157 driver due to a simple endian error: The Si2157 CRYSTAL_TRIM property code is 0x0402 and needs to be transmitted LSB first. However, it was inserted MSB first, causing the warm detection to always fail and spam the kernel log with tuner initialization messages each time the DVB frontend device was closed and reopened: [ 312.215682] si2157 16-0060: found a 'Silicon Labs Si2157-A30' [ 312.264334] si2157 16-0060: firmware version: 3.0.5 [ 342.248593] si2157 16-0060: found a 'Silicon Labs Si2157-A30' [ 342.295743] si2157 16-0060: firmware version: 3.0.5 [ 372.328574] si2157 16-0060: found a 'Silicon Labs Si2157-A30' [ 372.385035] si2157 16-0060: firmware version: 3.0.5 Also, the reinitializations were observed disturb _other_ tuners on multi-tuner cards such as the Hauppauge WinTV-QuadHD, leading to missed or errored packets when one of the other DVB frontend devices on that card was opened. Fix the order of the property code bytes to make the warm detection work again, also reducing the tuner initialization message in the kernel log to once per power-on, as well as fixing the interference with other tuners. Link: https://lore.kernel.org/linux-media/trinity-2a86eb9d-6264-4387-95e1-b= a7b79a4050f-1638392923493@3c-app-gmx-bap03 Fixes: e955f959ac52 ("media: si2157: Better check for running tuner in init= ") Reported-by: Robert Schlabbach Signed-off-by: Robert Schlabbach Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/tuners/si2157.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index a39e1966816bf..8db9f0eb98b52 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -80,7 +80,7 @@ static int si2157_init(struct dvb_frontend *fe) dev_dbg(&client->dev, "\n"); =20 /* Try to get Xtal trim property, to verify tuner still running */ - memcpy(cmd.args, "\x15\x00\x04\x02", 4); + memcpy(cmd.args, "\x15\x00\x02\x04", 4); cmd.wlen =3D 4; cmd.rlen =3D 4; ret =3D si2157_cmd_execute(client, &cmd); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F55BC2BA4C for ; Mon, 24 Jan 2022 20:17:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380731AbiAXUQu (ORCPT ); Mon, 24 Jan 2022 15:16:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356913AbiAXT7I (ORCPT ); Mon, 24 Jan 2022 14:59:08 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30145C04D604; Mon, 24 Jan 2022 11:28:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C165C6121F; Mon, 24 Jan 2022 19:28:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 900C9C340E5; Mon, 24 Jan 2022 19:28:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052485; bh=SDmuqKKJKCdfPSdrmdGO3w9+OKJGRiaeqpCfaCY7LT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=It96iIimv5JktXAlcIPXhmrtFmuGmSDsVFyhqg+eD97QizqUkBm2jV5HptkGCS9wu UYvrr7FLESPkDSKy9Ebf4IVgCQxWBxDCaRvCeFXyJTpzgQ5R2ZaFw6aDZE9HiMx62R FzSIEVoO32T9dZoqv96qLRLNh51rq2rAqYo6CE20= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Li Hua , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.4 075/320] sched/rt: Try to restart rt period timer when rt runtime exceeded Date: Mon, 24 Jan 2022 19:40:59 +0100 Message-Id: <20220124183956.280235644@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Li Hua [ Upstream commit 9b58e976b3b391c0cf02e038d53dd0478ed3013c ] When rt_runtime is modified from -1 to a valid control value, it may cause the task to be throttled all the time. Operations like the following will trigger the bug. E.g: 1. echo -1 > /proc/sys/kernel/sched_rt_runtime_us 2. Run a FIFO task named A that executes while(1) 3. echo 950000 > /proc/sys/kernel/sched_rt_runtime_us When rt_runtime is -1, The rt period timer will not be activated when task A enqueued. And then the task will be throttled after setting rt_runtime to 950,000. The task will always be throttled because the rt period timer is not activated. Fixes: d0b27fa77854 ("sched: rt-group: synchonised bandwidth period") Reported-by: Hulk Robot Signed-off-by: Li Hua Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20211203033618.11895-1-hucool.lihua@huawei.= com Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- kernel/sched/rt.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 2dffb8762e16b..28c82dee13ea9 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -52,11 +52,8 @@ void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 pe= riod, u64 runtime) rt_b->rt_period_timer.function =3D sched_rt_period_timer; } =20 -static void start_rt_bandwidth(struct rt_bandwidth *rt_b) +static inline void do_start_rt_bandwidth(struct rt_bandwidth *rt_b) { - if (!rt_bandwidth_enabled() || rt_b->rt_runtime =3D=3D RUNTIME_INF) - return; - raw_spin_lock(&rt_b->rt_runtime_lock); if (!rt_b->rt_period_active) { rt_b->rt_period_active =3D 1; @@ -75,6 +72,14 @@ static void start_rt_bandwidth(struct rt_bandwidth *rt_b) raw_spin_unlock(&rt_b->rt_runtime_lock); } =20 +static void start_rt_bandwidth(struct rt_bandwidth *rt_b) +{ + if (!rt_bandwidth_enabled() || rt_b->rt_runtime =3D=3D RUNTIME_INF) + return; + + do_start_rt_bandwidth(rt_b); +} + void init_rt_rq(struct rt_rq *rt_rq) { struct rt_prio_array *array; @@ -983,13 +988,17 @@ static void update_curr_rt(struct rq *rq) =20 for_each_sched_rt_entity(rt_se) { struct rt_rq *rt_rq =3D rt_rq_of_se(rt_se); + int exceeded; =20 if (sched_rt_runtime(rt_rq) !=3D RUNTIME_INF) { raw_spin_lock(&rt_rq->rt_runtime_lock); rt_rq->rt_time +=3D delta_exec; - if (sched_rt_runtime_exceeded(rt_rq)) + exceeded =3D sched_rt_runtime_exceeded(rt_rq); + if (exceeded) resched_curr(rq); raw_spin_unlock(&rt_rq->rt_runtime_lock); + if (exceeded) + do_start_rt_bandwidth(sched_rt_bandwidth(rt_rq)); } } } @@ -2659,8 +2668,12 @@ static int sched_rt_global_validate(void) =20 static void sched_rt_do_global(void) { + unsigned long flags; + + raw_spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags); def_rt_bandwidth.rt_runtime =3D global_rt_runtime(); def_rt_bandwidth.rt_period =3D ns_to_ktime(global_rt_period()); + raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags); } =20 int sched_rt_handler(struct ctl_table *table, int write, --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADAA9C2BA4C for ; Mon, 24 Jan 2022 19:37:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353943AbiAXTfh (ORCPT ); Mon, 24 Jan 2022 14:35:37 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49014 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348197AbiAXT2L (ORCPT ); Mon, 24 Jan 2022 14:28:11 -0500 Received: from smtp.kernel.org (relay.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 62A72B8121A; Mon, 24 Jan 2022 19:28:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90400C340E5; Mon, 24 Jan 2022 19:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052488; bh=8x76DRlB8IfR/34mTMkzRlPwJKUqVUcLK23r2U2ikrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ndXtwCZU80x33cDBMe/2cFS9/OwN9DGSZIIaL9AVS32uuCcPEhr3flajYPSHN5ITB 2nSl2Y/z7r4Hjta+6gCK+ZT8zh6ymVSJFm2r3hTpMkbR8MpQK8rd+dK6ingvc8E/D8 kRkAOohrZ+nRvAtuw2Bs+JufSO5bEHtjnK++lnfA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neeraj Upadhyay , Frederic Weisbecker , Uladzislau Rezki , Boqun Feng , Josh Triplett , Joel Fernandes , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.4 076/320] rcu/exp: Mark current CPU as exp-QS in IPI loop second pass Date: Mon, 24 Jan 2022 19:41:00 +0100 Message-Id: <20220124183956.321184458@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Frederic Weisbecker [ Upstream commit 81f6d49cce2d2fe507e3fddcc4a6db021d9c2e7b ] Expedited RCU grace periods invoke sync_rcu_exp_select_node_cpus(), which takes two passes over the leaf rcu_node structure's CPUs. The first pass gathers up the current CPU and CPUs that are in dynticks idle mode. The workqueue will report a quiescent state on their behalf later. The second pass sends IPIs to the rest of the CPUs, but excludes the current CPU, incorrectly assuming it has been included in the first pass's list of CPUs. Unfortunately the current CPU may have changed between the first and second pass, due to the fact that the various rcu_node structures' ->lock fields have been dropped, thus momentarily enabling preemption. This means that if the second pass's CPU was not on the first pass's list, it will be ignored completely. There will be no IPI sent to it, and there will be no reporting of quiescent states on its behalf. Unfortunately, the expedited grace period will nevertheless be waiting for that CPU to report a quiescent state, but with that CPU having no reason to believe that such a report is needed. The result will be an expedited grace period stall. Fix this by no longer excluding the current CPU from consideration during the second pass. Fixes: b9ad4d6ed18e ("rcu: Avoid self-IPI in sync_rcu_exp_select_node_cpus(= )") Reviewed-by: Neeraj Upadhyay Signed-off-by: Frederic Weisbecker Cc: Uladzislau Rezki Cc: Neeraj Upadhyay Cc: Boqun Feng Cc: Josh Triplett Cc: Joel Fernandes Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- kernel/rcu/tree_exp.h | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h index 4c4d7683a4e5b..173e3ce607900 100644 --- a/kernel/rcu/tree_exp.h +++ b/kernel/rcu/tree_exp.h @@ -382,6 +382,7 @@ retry_ipi: continue; } if (get_cpu() =3D=3D cpu) { + mask_ofl_test |=3D mask; put_cpu(); continue; } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 635D0C43217 for ; Mon, 24 Jan 2022 19:37:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353766AbiAXTfV (ORCPT ); Mon, 24 Jan 2022 14:35:21 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53838 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348205AbiAXT2M (ORCPT ); Mon, 24 Jan 2022 14:28:12 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 97FFF612A5; Mon, 24 Jan 2022 19:28:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 667E4C340E5; Mon, 24 Jan 2022 19:28:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052491; bh=/KO7TjZdTKaIEWpeAtBTzlVw9Z4gVP4KOb9QTuY+Arg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FkPwXAEEFcfyc8Iw2PerFH6w5zZ3tQ0qEegMZi3tq/l7Tv3Vu4swE8aDnLA9V9ArN Ij344ybehN3DYIgisJCtaez1Bo3pqqRB/acz1fgJxP+sZDPGsk5SjB9da1n2gol3fD /j7YVOCo6EmXHDzRxNnKsarbr457l56yLS0j1gXg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , TOTE Robot , Brian Norris , Kalle Valo , Sasha Levin Subject: [PATCH 5.4 077/320] mwifiex: Fix possible ABBA deadlock Date: Mon, 24 Jan 2022 19:41:01 +0100 Message-Id: <20220124183956.360963062@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris [ Upstream commit 1b8bb8919ef81bfc8873d223b9361f1685f2106d ] Quoting Jia-Ju Bai : mwifiex_dequeue_tx_packet() spin_lock_bh(&priv->wmm.ra_list_spinlock); --> Line 1432 (Lock A) mwifiex_send_addba() spin_lock_bh(&priv->sta_list_spinlock); --> Line 608 (Lock B) mwifiex_process_sta_tx_pause() spin_lock_bh(&priv->sta_list_spinlock); --> Line 398 (Lock B) mwifiex_update_ralist_tx_pause() spin_lock_bh(&priv->wmm.ra_list_spinlock); --> Line 941 (Lock A) Similar report for mwifiex_process_uap_tx_pause(). While the locking expectations in this driver are a bit unclear, the Fixed commit only intended to protect the sta_ptr, so we can drop the lock as soon as we're done with it. IIUC, this deadlock cannot actually happen, because command event processing (which calls mwifiex_process_sta_tx_pause()) is sequentialized with TX packet processing (e.g., mwifiex_dequeue_tx_packet()) via the main loop (mwifiex_main_process()). But it's good not to leave this potential issue lurking. Fixes: f0f7c2275fb9 ("mwifiex: minor cleanups w/ sta_list_spinlock in cfg80= 211.c") Cc: Douglas Anderson Reported-by: TOTE Robot Link: https://lore.kernel.org/linux-wireless/0e495b14-efbb-e0da-37bd-af6bd6= 77ee2c@gmail.com/ Signed-off-by: Brian Norris Reviewed-by: Douglas Anderson Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YaV0pllJ5p/EuUat@google.com Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/wireless/marvell/mwifiex/sta_event.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net= /wireless/marvell/mwifiex/sta_event.c index 5fdffb114913d..fd12093863801 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c @@ -364,10 +364,12 @@ static void mwifiex_process_uap_tx_pause(struct mwifi= ex_private *priv, sta_ptr =3D mwifiex_get_sta_entry(priv, tp->peermac); if (sta_ptr && sta_ptr->tx_pause !=3D tp->tx_pause) { sta_ptr->tx_pause =3D tp->tx_pause; + spin_unlock_bh(&priv->sta_list_spinlock); mwifiex_update_ralist_tx_pause(priv, tp->peermac, tp->tx_pause); + } else { + spin_unlock_bh(&priv->sta_list_spinlock); } - spin_unlock_bh(&priv->sta_list_spinlock); } } =20 @@ -399,11 +401,13 @@ static void mwifiex_process_sta_tx_pause(struct mwifi= ex_private *priv, sta_ptr =3D mwifiex_get_sta_entry(priv, tp->peermac); if (sta_ptr && sta_ptr->tx_pause !=3D tp->tx_pause) { sta_ptr->tx_pause =3D tp->tx_pause; + spin_unlock_bh(&priv->sta_list_spinlock); mwifiex_update_ralist_tx_pause(priv, tp->peermac, tp->tx_pause); + } else { + spin_unlock_bh(&priv->sta_list_spinlock); } - spin_unlock_bh(&priv->sta_list_spinlock); } } } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8642AC41535 for ; Mon, 24 Jan 2022 20:17:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380790AbiAXUQz (ORCPT ); Mon, 24 Jan 2022 15:16:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358398AbiAXT7X (ORCPT ); Mon, 24 Jan 2022 14:59:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10219C04D628; Mon, 24 Jan 2022 11:28:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 917DF60BB9; Mon, 24 Jan 2022 19:28:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F5EBC340E7; Mon, 24 Jan 2022 19:28:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052494; bh=8Qb3odU96UAZmSxkT0ILSF9+4S+jInvXDLtNLOeojlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZUNhiNAwwx1y0vtI+W31x9ejhFIxvDE6l6byynmvy1iui7+sFvrS8obr4vsisip46 F1a7sF9Im2A7BDHr6QT6uThwGnOv6gQ5R/iZ1Exyeb4yYDBRlkKzQBK2Y8awlHYn9l 2vXSWoCU7VggUvRJ17fRuNkVqSzZ6CyrISlVBI+k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Steffen Klassert , Sasha Levin Subject: [PATCH 5.4 078/320] xfrm: fix a small bug in xfrm_sa_len() Date: Mon, 24 Jan 2022 19:41:02 +0100 Message-Id: <20220124183956.397450184@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 7770a39d7c63faec6c4f33666d49a8cb664d0482 ] copy_user_offload() will actually push a struct struct xfrm_user_offload, which is different than (struct xfrm_state *)->xso (struct xfrm_state_offload) Fixes: d77e38e612a01 ("xfrm: Add an IPsec hardware offloading API") Signed-off-by: Eric Dumazet Cc: Steffen Klassert Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/xfrm/xfrm_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 0cee2d3c6e452..ddcf569d852f7 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -2816,7 +2816,7 @@ static inline unsigned int xfrm_sa_len(struct xfrm_st= ate *x) if (x->props.extra_flags) l +=3D nla_total_size(sizeof(x->props.extra_flags)); if (x->xso.dev) - l +=3D nla_total_size(sizeof(x->xso)); + l +=3D nla_total_size(sizeof(struct xfrm_user_offload)); if (x->props.smark.v | x->props.smark.m) { l +=3D nla_total_size(sizeof(x->props.smark.v)); l +=3D nla_total_size(sizeof(x->props.smark.m)); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70115C433F5 for ; Mon, 24 Jan 2022 20:29:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382920AbiAXU0b (ORCPT ); Mon, 24 Jan 2022 15:26:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359709AbiAXUAE (ORCPT ); Mon, 24 Jan 2022 15:00:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86D70C04D63F; Mon, 24 Jan 2022 11:28:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2EB14B8119D; Mon, 24 Jan 2022 19:28:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A984C340E5; Mon, 24 Jan 2022 19:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052499; bh=S5wGeD/UHHh8DIKXW9frLb7k6IW0Fo+4rr8C207b6Y8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R9tSQkDeR2SyTzk2oxqnRVrzmmSDUv87bqBEKMYfpsh/GgkXHRVkKvBInYl6HtB1D vM9m5/MedjI75a4dHymwsiC958LedSHUjDyRfyh3sjH4Frkr6U0x8xOzRbdjpHP9Ic NucM/WwmjlpmO5quao1yUkgQmyvNGowEovmx5pqs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Toromanoff , Herbert Xu , Sasha Levin Subject: [PATCH 5.4 079/320] crypto: stm32/cryp - fix xts and race condition in crypto_engine requests Date: Mon, 24 Jan 2022 19:41:03 +0100 Message-Id: <20220124183956.427945438@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Toromanoff [ Upstream commit d703c7a994ee34b7fa89baf21631fca0aa9f17fc ] Don't erase key: If key is erased before the crypto_finalize_.*_request() call, some pending process will run with a key=3D{ 0 }. Moreover if the key is reset at end of request, it breaks xts chaining mode, as for last xts block (in case input len is not a multiple of block) a new AES request is started without calling again set_key(). Fixes: 9e054ec21ef8 ("crypto: stm32 - Support for STM32 CRYP crypto module") Signed-off-by: Nicolas Toromanoff Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/crypto/stm32/stm32-cryp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32= -cryp.c index 9b3511236ba25..92472a48c0454 100644 --- a/drivers/crypto/stm32/stm32-cryp.c +++ b/drivers/crypto/stm32/stm32-cryp.c @@ -669,8 +669,6 @@ static void stm32_cryp_finish_req(struct stm32_cryp *cr= yp, int err) else crypto_finalize_ablkcipher_request(cryp->engine, cryp->req, err); - - memset(cryp->ctx->key, 0, cryp->ctx->keylen); } =20 static int stm32_cryp_cpu_start(struct stm32_cryp *cryp) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 351C5C46467 for ; Mon, 24 Jan 2022 20:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349938AbiAXURF (ORCPT ); Mon, 24 Jan 2022 15:17:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359784AbiAXUAL (ORCPT ); Mon, 24 Jan 2022 15:00:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81EE8C055A87; Mon, 24 Jan 2022 11:28:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4050FB8121B; Mon, 24 Jan 2022 19:28:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F353C340E5; Mon, 24 Jan 2022 19:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052503; bh=d9OmUHPKQrZ6Natp9JukyqTsw+yMgXrciAtgaRtw1yw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zEM0u6kRT1DHFNCejlgqNV54VPrPlb9P8OqADzV2ci4FVMwqzxsMSTRj8IoZXFPxJ eTLubtEwCzl77r3AfdVfaNhBSq0efKlkecnKuQkDZJIpAIGwOmMORZTtobBMZ7zR7j DJvMZyKNC4G2+zMaqVP1qaafzPsPoSUxFNVv0hSM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Nicolas Toromanoff , Herbert Xu , Sasha Levin Subject: [PATCH 5.4 080/320] crypto: stm32/cryp - fix double pm exit Date: Mon, 24 Jan 2022 19:41:04 +0100 Message-Id: <20220124183956.457673340@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Toromanoff [ Upstream commit 6c12e742785bf9333faf60bfb96575bdd763448e ] Delete extraneous lines in probe error handling code: pm was disabled twice. Fixes: 65f9aa36ee47 ("crypto: stm32/cryp - Add power management support") Reported-by: Marek Vasut Signed-off-by: Nicolas Toromanoff Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/crypto/stm32/stm32-cryp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32= -cryp.c index 92472a48c0454..c41e66211c5b4 100644 --- a/drivers/crypto/stm32/stm32-cryp.c +++ b/drivers/crypto/stm32/stm32-cryp.c @@ -2034,8 +2034,6 @@ err_engine1: list_del(&cryp->list); spin_unlock(&cryp_list.lock); =20 - pm_runtime_disable(dev); - pm_runtime_put_noidle(dev); pm_runtime_disable(dev); pm_runtime_put_noidle(dev); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DC20C433F5 for ; Mon, 24 Jan 2022 20:18:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347557AbiAXUSF (ORCPT ); Mon, 24 Jan 2022 15:18:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359865AbiAXUBJ (ORCPT ); Mon, 24 Jan 2022 15:01:09 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7264EC055A93; Mon, 24 Jan 2022 11:28:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2FDBFB811F9; Mon, 24 Jan 2022 19:28:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ED6DC36AE3; Mon, 24 Jan 2022 19:28:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052506; bh=FWCm5xysMWqZECp81pwlwVFvC6oJtYvAhrTXIKd5FAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OLKJokWwxdNrY2IYVCAa/piluTBHpyz/kTsryj91JUt/SOuogvPL78OwZra1L6mcX +fRM8FgXo7l+oOoWGAeS2gUnf5qkvKoyW0LWxgjbdb89BpzQQulrU/K5qil5baSTY5 Wc3flPrkzDu5xffQsuOp4rfQrx9/lrYMdNENKLJQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Toromanoff , Herbert Xu , Sasha Levin Subject: [PATCH 5.4 081/320] crypto: stm32/cryp - fix lrw chaining mode Date: Mon, 24 Jan 2022 19:41:05 +0100 Message-Id: <20220124183956.496146394@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Toromanoff [ Upstream commit fa97dc2d48b476ea98199d808d3248d285987e99 ] This fixes the lrw autotest if lrw uses the CRYP as the AES block cipher provider (as ecb(aes)). At end of request, CRYP should not update the IV in case of ECB chaining mode. Indeed the ECB chaining mode never uses the IV, but the software LRW chaining mode uses the IV field as a counter and due to the (unexpected) update done by CRYP while the AES block process, the counter get a wrong value when the IV overflow. Fixes: 5f49f18d27cd ("crypto: stm32/cryp - update to return iv_out") Signed-off-by: Nicolas Toromanoff Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/crypto/stm32/stm32-cryp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32= -cryp.c index c41e66211c5b4..69c2468f1053d 100644 --- a/drivers/crypto/stm32/stm32-cryp.c +++ b/drivers/crypto/stm32/stm32-cryp.c @@ -639,7 +639,7 @@ static void stm32_cryp_finish_req(struct stm32_cryp *cr= yp, int err) /* Phase 4 : output tag */ err =3D stm32_cryp_read_auth_tag(cryp); =20 - if (!err && (!(is_gcm(cryp) || is_ccm(cryp)))) + if (!err && (!(is_gcm(cryp) || is_ccm(cryp) || is_ecb(cryp)))) stm32_cryp_get_iv(cryp); =20 if (cryp->sgs_copied) { --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A89CC433EF for ; Mon, 24 Jan 2022 20:23:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348826AbiAXUXf (ORCPT ); Mon, 24 Jan 2022 15:23:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359871AbiAXUBJ (ORCPT ); Mon, 24 Jan 2022 15:01:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 039C2C055A9B; Mon, 24 Jan 2022 11:28:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 839FB60917; Mon, 24 Jan 2022 19:28:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6185CC340E8; Mon, 24 Jan 2022 19:28:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052509; bh=hazNcpa85LKHtize4WzzuyjDhfQX2MzPxLFQYOF7I9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q53UTEcAn/blL6RqQFGl5QqEudgClKrBOHSCby2R95fiPXOBcOIOXecTZlcJiNJ+H BrawiiD2IDz2+VJ6bM1UYLIHHGR4Grd6hvpj+gkgODBTsosvXVbte0SUONhxKb1GFF WO0YNHNQnzybe7GqYl2LcI01OAlmafPmqwcAzJMY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steven Maddox , Christian Lamparter , Linus Walleij , Arnd Bergmann , Sasha Levin Subject: [PATCH 5.4 082/320] ARM: dts: gemini: NAS4220-B: fis-index-block with 128 KiB sectors Date: Mon, 24 Jan 2022 19:41:06 +0100 Message-Id: <20220124183956.534259323@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Lamparter [ Upstream commit 4754eab7e5a78bdefe7a960c5c260c95ebbb5fa6 ] Steven Maddox reported in the OpenWrt bugzilla, that his RaidSonic IB-NAS4220-B was no longer booting with the new OpenWrt 21.02 (uses linux 5.10's device-tree). However, it was working with the previous OpenWrt 19.07 series (uses 4.14). |[ 5.548038] No RedBoot partition table detected in 30000000.flash |[ 5.618553] Searching for RedBoot partition table in 30000000.flash at = offset 0x0 |[ 5.739093] No RedBoot partition table detected in 30000000.flash |... |[ 7.039504] Waiting for root device /dev/mtdblock3... The provided bootlog shows that the RedBoot partition parser was looking for the partition table "at offset 0x0". Which is strange since the comment in the device-tree says it should be at 0xfe0000. Further digging on the internet led to a review site that took some useful PCB pictures of their review unit back in February 2009. Their picture shows a Spansion S29GL128N11TFI01 flash chip. >From Spansion's Datasheet: "S29GL128N: One hundred twenty-eight 64 Kword (128 Kbyte) sectors" Steven also provided a "cat /sys/class/mtd/mtd0/erasesize" from his unit: "131072". With the 128 KiB Sector/Erasesize in mind. This patch changes the fis-index-block property to (0xfe0000 / 0x20000) =3D 0x7f. Fixes: b5a923f8c739 ("ARM: dts: gemini: Switch to redboot partition parsing= ") Reported-by: Steven Maddox Signed-off-by: Christian Lamparter Signed-off-by: Linus Walleij Tested-by: Steven Maddox Link: https://lore.kernel.org/r/20211206004334.4169408-1-linus.walleij@lina= ro.org' Bugzilla: https://bugs.openwrt.org/index.php?do=3Ddetails&task_id=3D4137 Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm/boot/dts/gemini-nas4220b.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/gemini-nas4220b.dts b/arch/arm/boot/dts/gemi= ni-nas4220b.dts index e1020e07e1366..60cec653ac7c6 100644 --- a/arch/arm/boot/dts/gemini-nas4220b.dts +++ b/arch/arm/boot/dts/gemini-nas4220b.dts @@ -84,7 +84,7 @@ partitions { compatible =3D "redboot-fis"; /* Eraseblock at 0xfe0000 */ - fis-index-block =3D <0x1fc>; + fis-index-block =3D <0x7f>; }; }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF395C433EF for ; Mon, 24 Jan 2022 20:28:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382848AbiAXU0X (ORCPT ); Mon, 24 Jan 2022 15:26:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376279AbiAXUBO (ORCPT ); Mon, 24 Jan 2022 15:01:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3C07C055AA1; Mon, 24 Jan 2022 11:28:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2C679B811F9; Mon, 24 Jan 2022 19:28:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55BDCC340E7; Mon, 24 Jan 2022 19:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052511; bh=jk1ge3taTyitFvNleTQFEhhdkorjAlJ4cQqbVWREqhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UVKTiM53M/leRUXzoLUhBFDVUaFo1LPom7Eg+QVw6FoKXw2s+UHrhB8PIAiKsVja+ VcrdUrlphZppWBWLzppvoPz/tlwYKbSIHn7/W58KUZAsFYUdhxJ11umo5ALs1uusYQ ccZPYUmtTHLArS7qRZEm8K7AmpNG9c+ZscY2p6IU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anton Vasilyev , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 083/320] media: dw2102: Fix use after free Date: Mon, 24 Jan 2022 19:41:07 +0100 Message-Id: <20220124183956.564966355@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Anton Vasilyev [ Upstream commit 589a9f0eb799f77de2c09583bf5bad221fa5d685 ] dvb_usb_device_init stores parts of properties at d->props and d->desc and uses it on dvb_usb_device_exit. Free of properties on module probe leads to use after free. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=3D204597 The patch makes properties static instead of allocated on heap to prevent memleak and use after free. Also fixes s421_properties.devices initialization to have 2 element instead of 6 copied from p7500_properties. [mchehab: fix function call alignments] Link: https://lore.kernel.org/linux-media/20190822104147.4420-1-vasilyev@is= pras.ru Signed-off-by: Anton Vasilyev Fixes: 299c7007e936 ("media: dw2102: Fix memleak on sequence of probes") Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/usb/dvb-usb/dw2102.c | 338 ++++++++++++++++++----------- 1 file changed, 215 insertions(+), 123 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb= /dw2102.c index b960abd00d483..8493ebb377c4d 100644 --- a/drivers/media/usb/dvb-usb/dw2102.c +++ b/drivers/media/usb/dvb-usb/dw2102.c @@ -2098,46 +2098,153 @@ static struct dvb_usb_device_properties s6x0_prope= rties =3D { } }; =20 -static const struct dvb_usb_device_description d1100 =3D { - "Prof 1100 USB ", - {&dw2102_table[PROF_1100], NULL}, - {NULL}, -}; +static struct dvb_usb_device_properties p1100_properties =3D { + .caps =3D DVB_USB_IS_AN_I2C_ADAPTER, + .usb_ctrl =3D DEVICE_SPECIFIC, + .size_of_priv =3D sizeof(struct dw2102_state), + .firmware =3D P1100_FIRMWARE, + .no_reconnect =3D 1, =20 -static const struct dvb_usb_device_description d660 =3D { - "TeVii S660 USB", - {&dw2102_table[TEVII_S660], NULL}, - {NULL}, -}; + .i2c_algo =3D &s6x0_i2c_algo, + .rc.core =3D { + .rc_interval =3D 150, + .rc_codes =3D RC_MAP_TBS_NEC, + .module_name =3D "dw2102", + .allowed_protos =3D RC_PROTO_BIT_NEC, + .rc_query =3D prof_rc_query, + }, =20 -static const struct dvb_usb_device_description d480_1 =3D { - "TeVii S480.1 USB", - {&dw2102_table[TEVII_S480_1], NULL}, - {NULL}, + .generic_bulk_ctrl_endpoint =3D 0x81, + .num_adapters =3D 1, + .download_firmware =3D dw2102_load_firmware, + .read_mac_address =3D s6x0_read_mac_address, + .adapter =3D { + { + .num_frontends =3D 1, + .fe =3D {{ + .frontend_attach =3D stv0288_frontend_attach, + .stream =3D { + .type =3D USB_BULK, + .count =3D 8, + .endpoint =3D 0x82, + .u =3D { + .bulk =3D { + .buffersize =3D 4096, + } + } + }, + } }, + } + }, + .num_device_descs =3D 1, + .devices =3D { + {"Prof 1100 USB ", + {&dw2102_table[PROF_1100], NULL}, + {NULL}, + }, + } }; =20 -static const struct dvb_usb_device_description d480_2 =3D { - "TeVii S480.2 USB", - {&dw2102_table[TEVII_S480_2], NULL}, - {NULL}, -}; +static struct dvb_usb_device_properties s660_properties =3D { + .caps =3D DVB_USB_IS_AN_I2C_ADAPTER, + .usb_ctrl =3D DEVICE_SPECIFIC, + .size_of_priv =3D sizeof(struct dw2102_state), + .firmware =3D S660_FIRMWARE, + .no_reconnect =3D 1, =20 -static const struct dvb_usb_device_description d7500 =3D { - "Prof 7500 USB DVB-S2", - {&dw2102_table[PROF_7500], NULL}, - {NULL}, -}; + .i2c_algo =3D &s6x0_i2c_algo, + .rc.core =3D { + .rc_interval =3D 150, + .rc_codes =3D RC_MAP_TEVII_NEC, + .module_name =3D "dw2102", + .allowed_protos =3D RC_PROTO_BIT_NEC, + .rc_query =3D dw2102_rc_query, + }, =20 -static const struct dvb_usb_device_description d421 =3D { - "TeVii S421 PCI", - {&dw2102_table[TEVII_S421], NULL}, - {NULL}, + .generic_bulk_ctrl_endpoint =3D 0x81, + .num_adapters =3D 1, + .download_firmware =3D dw2102_load_firmware, + .read_mac_address =3D s6x0_read_mac_address, + .adapter =3D { + { + .num_frontends =3D 1, + .fe =3D {{ + .frontend_attach =3D ds3000_frontend_attach, + .stream =3D { + .type =3D USB_BULK, + .count =3D 8, + .endpoint =3D 0x82, + .u =3D { + .bulk =3D { + .buffersize =3D 4096, + } + } + }, + } }, + } + }, + .num_device_descs =3D 3, + .devices =3D { + {"TeVii S660 USB", + {&dw2102_table[TEVII_S660], NULL}, + {NULL}, + }, + {"TeVii S480.1 USB", + {&dw2102_table[TEVII_S480_1], NULL}, + {NULL}, + }, + {"TeVii S480.2 USB", + {&dw2102_table[TEVII_S480_2], NULL}, + {NULL}, + }, + } }; =20 -static const struct dvb_usb_device_description d632 =3D { - "TeVii S632 USB", - {&dw2102_table[TEVII_S632], NULL}, - {NULL}, +static struct dvb_usb_device_properties p7500_properties =3D { + .caps =3D DVB_USB_IS_AN_I2C_ADAPTER, + .usb_ctrl =3D DEVICE_SPECIFIC, + .size_of_priv =3D sizeof(struct dw2102_state), + .firmware =3D P7500_FIRMWARE, + .no_reconnect =3D 1, + + .i2c_algo =3D &s6x0_i2c_algo, + .rc.core =3D { + .rc_interval =3D 150, + .rc_codes =3D RC_MAP_TBS_NEC, + .module_name =3D "dw2102", + .allowed_protos =3D RC_PROTO_BIT_NEC, + .rc_query =3D prof_rc_query, + }, + + .generic_bulk_ctrl_endpoint =3D 0x81, + .num_adapters =3D 1, + .download_firmware =3D dw2102_load_firmware, + .read_mac_address =3D s6x0_read_mac_address, + .adapter =3D { + { + .num_frontends =3D 1, + .fe =3D {{ + .frontend_attach =3D prof_7500_frontend_attach, + .stream =3D { + .type =3D USB_BULK, + .count =3D 8, + .endpoint =3D 0x82, + .u =3D { + .bulk =3D { + .buffersize =3D 4096, + } + } + }, + } }, + } + }, + .num_device_descs =3D 1, + .devices =3D { + {"Prof 7500 USB DVB-S2", + {&dw2102_table[PROF_7500], NULL}, + {NULL}, + }, + } }; =20 static struct dvb_usb_device_properties su3000_properties =3D { @@ -2209,6 +2316,59 @@ static struct dvb_usb_device_properties su3000_prope= rties =3D { } }; =20 +static struct dvb_usb_device_properties s421_properties =3D { + .caps =3D DVB_USB_IS_AN_I2C_ADAPTER, + .usb_ctrl =3D DEVICE_SPECIFIC, + .size_of_priv =3D sizeof(struct dw2102_state), + .power_ctrl =3D su3000_power_ctrl, + .num_adapters =3D 1, + .identify_state =3D su3000_identify_state, + .i2c_algo =3D &su3000_i2c_algo, + + .rc.core =3D { + .rc_interval =3D 150, + .rc_codes =3D RC_MAP_SU3000, + .module_name =3D "dw2102", + .allowed_protos =3D RC_PROTO_BIT_RC5, + .rc_query =3D su3000_rc_query, + }, + + .read_mac_address =3D su3000_read_mac_address, + + .generic_bulk_ctrl_endpoint =3D 0x01, + + .adapter =3D { + { + .num_frontends =3D 1, + .fe =3D {{ + .streaming_ctrl =3D su3000_streaming_ctrl, + .frontend_attach =3D m88rs2000_frontend_attach, + .stream =3D { + .type =3D USB_BULK, + .count =3D 8, + .endpoint =3D 0x82, + .u =3D { + .bulk =3D { + .buffersize =3D 4096, + } + } + } + } }, + } + }, + .num_device_descs =3D 2, + .devices =3D { + { "TeVii S421 PCI", + { &dw2102_table[TEVII_S421], NULL }, + { NULL }, + }, + { "TeVii S632 USB", + { &dw2102_table[TEVII_S632], NULL }, + { NULL }, + }, + } +}; + static struct dvb_usb_device_properties t220_properties =3D { .caps =3D DVB_USB_IS_AN_I2C_ADAPTER, .usb_ctrl =3D DEVICE_SPECIFIC, @@ -2326,101 +2486,33 @@ static struct dvb_usb_device_properties tt_s2_4600= _properties =3D { static int dw2102_probe(struct usb_interface *intf, const struct usb_device_id *id) { - int retval =3D -ENOMEM; - struct dvb_usb_device_properties *p1100; - struct dvb_usb_device_properties *s660; - struct dvb_usb_device_properties *p7500; - struct dvb_usb_device_properties *s421; - - p1100 =3D kmemdup(&s6x0_properties, - sizeof(struct dvb_usb_device_properties), GFP_KERNEL); - if (!p1100) - goto err0; - - /* copy default structure */ - /* fill only different fields */ - p1100->firmware =3D P1100_FIRMWARE; - p1100->devices[0] =3D d1100; - p1100->rc.core.rc_query =3D prof_rc_query; - p1100->rc.core.rc_codes =3D RC_MAP_TBS_NEC; - p1100->adapter->fe[0].frontend_attach =3D stv0288_frontend_attach; - - s660 =3D kmemdup(&s6x0_properties, - sizeof(struct dvb_usb_device_properties), GFP_KERNEL); - if (!s660) - goto err1; - - s660->firmware =3D S660_FIRMWARE; - s660->num_device_descs =3D 3; - s660->devices[0] =3D d660; - s660->devices[1] =3D d480_1; - s660->devices[2] =3D d480_2; - s660->adapter->fe[0].frontend_attach =3D ds3000_frontend_attach; - - p7500 =3D kmemdup(&s6x0_properties, - sizeof(struct dvb_usb_device_properties), GFP_KERNEL); - if (!p7500) - goto err2; - - p7500->firmware =3D P7500_FIRMWARE; - p7500->devices[0] =3D d7500; - p7500->rc.core.rc_query =3D prof_rc_query; - p7500->rc.core.rc_codes =3D RC_MAP_TBS_NEC; - p7500->adapter->fe[0].frontend_attach =3D prof_7500_frontend_attach; - - - s421 =3D kmemdup(&su3000_properties, - sizeof(struct dvb_usb_device_properties), GFP_KERNEL); - if (!s421) - goto err3; - - s421->num_device_descs =3D 2; - s421->devices[0] =3D d421; - s421->devices[1] =3D d632; - s421->adapter->fe[0].frontend_attach =3D m88rs2000_frontend_attach; - - if (0 =3D=3D dvb_usb_device_init(intf, &dw2102_properties, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, &dw2104_properties, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, &dw3101_properties, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, &s6x0_properties, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, p1100, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, s660, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, p7500, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, s421, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, &su3000_properties, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, &t220_properties, - THIS_MODULE, NULL, adapter_nr) || - 0 =3D=3D dvb_usb_device_init(intf, &tt_s2_4600_properties, - THIS_MODULE, NULL, adapter_nr)) { - - /* clean up copied properties */ - kfree(s421); - kfree(p7500); - kfree(s660); - kfree(p1100); + if (!(dvb_usb_device_init(intf, &dw2102_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &dw2104_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &dw3101_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &s6x0_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &p1100_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &s660_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &p7500_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &s421_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &su3000_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &t220_properties, + THIS_MODULE, NULL, adapter_nr) && + dvb_usb_device_init(intf, &tt_s2_4600_properties, + THIS_MODULE, NULL, adapter_nr))) { =20 return 0; } =20 - retval =3D -ENODEV; - kfree(s421); -err3: - kfree(p7500); -err2: - kfree(s660); -err1: - kfree(p1100); -err0: - return retval; + return -ENODEV; } =20 static void dw2102_disconnect(struct usb_interface *intf) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5305CC43217 for ; Mon, 24 Jan 2022 19:38:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353843AbiAXTf2 (ORCPT ); Mon, 24 Jan 2022 14:35:28 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56252 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348432AbiAXT2h (ORCPT ); Mon, 24 Jan 2022 14:28:37 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BB53861488; Mon, 24 Jan 2022 19:28:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87120C340E5; Mon, 24 Jan 2022 19:28:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052515; bh=dqbWfEMlNE/Ni041E7Yb6Yct9cWyfdGrWOafYB2jzak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=06DEDYjITSgUU2c0Yx2z00e8+8xIDS6eGTmnw2WSg5LqJ8ua6VDSQOVe6mrsFKT78 JyR6K/MfATqR6C2oNTB3435nb5pbgYT5ewL4eUMlx1s/Ae4j6srli+uYKT114x1JkM OuDelCKLd3O/KHQH+x/P5ts4bUVs9iio97TCAUV0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Hai , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 084/320] media: msi001: fix possible null-ptr-deref in msi001_probe() Date: Mon, 24 Jan 2022 19:41:08 +0100 Message-Id: <20220124183956.605918298@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wang Hai [ Upstream commit 3d5831a40d3464eea158180eb12cbd81c5edfb6a ] I got a null-ptr-deref report: BUG: kernel NULL pointer dereference, address: 0000000000000060 ... RIP: 0010:v4l2_ctrl_auto_cluster+0x57/0x270 ... Call Trace: msi001_probe+0x13b/0x24b [msi001] spi_probe+0xeb/0x130 ... do_syscall_64+0x35/0xb0 In msi001_probe(), if the creation of control for bandwidth_auto fails, there will be a null-ptr-deref issue when it is used in v4l2_ctrl_auto_cluster(). Check dev->hdl.error before v4l2_ctrl_auto_cluster() to fix this bug. Link: https://lore.kernel.org/linux-media/20211026112348.2878040-1-wanghai3= 8@huawei.com Fixes: 93203dd6c7c4 ("[media] msi001: Mirics MSi001 silicon tuner driver") Reported-by: Hulk Robot Signed-off-by: Wang Hai Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/tuners/msi001.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/media/tuners/msi001.c b/drivers/media/tuners/msi001.c index 78e6fd600d8ef..44247049a3190 100644 --- a/drivers/media/tuners/msi001.c +++ b/drivers/media/tuners/msi001.c @@ -442,6 +442,13 @@ static int msi001_probe(struct spi_device *spi) V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1); dev->bandwidth =3D v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, V4L2_CID_RF_TUNER_BANDWIDTH, 200000, 8000000, 1, 200000); + if (dev->hdl.error) { + ret =3D dev->hdl.error; + dev_err(&spi->dev, "Could not initialize controls\n"); + /* control init failed, free handler */ + goto err_ctrl_handler_free; + } + v4l2_ctrl_auto_cluster(2, &dev->bandwidth_auto, 0, false); dev->lna_gain =3D v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, V4L2_CID_RF_TUNER_LNA_GAIN, 0, 1, 1, 1); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7723DC4167B for ; Mon, 24 Jan 2022 19:37:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353795AbiAXTfX (ORCPT ); Mon, 24 Jan 2022 14:35:23 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51572 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351779AbiAXT2l (ORCPT ); Mon, 24 Jan 2022 14:28:41 -0500 Received: from smtp.kernel.org (relay.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 5E502B81239; Mon, 24 Jan 2022 19:28:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F506C340E5; Mon, 24 Jan 2022 19:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052518; bh=9o48Je1F87lDwxkuT1N6YQqhnrPGRVS42N5wlSw4AZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k8kPBItzBgej0Jpg9RLPOAy6bcKRv+gTFkm4E8NkOec3Kymjw4bg5ZFEislTvRB/i KkJJ5kbVYFWNHE5YA1FX4T7QhOhlzF/Ql/Bm2z8jGKcQznMnCsU5y3id+DsnWqGRAv ba6CCESFmpH+nr26kFX1CbkQqKBtsIuQNkJXGDoY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 085/320] media: coda/imx-vdoa: Handle dma_set_coherent_mask error codes Date: Mon, 24 Jan 2022 19:41:09 +0100 Message-Id: <20220124183956.637433565@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 43f0633f89947df57fe0b5025bdd741768007708 ] The return value of dma_set_coherent_mask() is not always 0. To catch the exception in case that dma is not support the mask. Link: https://lore.kernel.org/linux-media/20211206022201.1639460-1-jiasheng= @iscas.ac.cn Fixes: b0444f18e0b1 ("[media] coda: add i.MX6 VDOA driver") Signed-off-by: Jiasheng Jiang Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/platform/coda/imx-vdoa.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/coda/imx-vdoa.c b/drivers/media/platfor= m/coda/imx-vdoa.c index 8bc0d83718193..dd6e2e320264e 100644 --- a/drivers/media/platform/coda/imx-vdoa.c +++ b/drivers/media/platform/coda/imx-vdoa.c @@ -287,7 +287,11 @@ static int vdoa_probe(struct platform_device *pdev) struct resource *res; int ret; =20 - dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); + ret =3D dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(&pdev->dev, "DMA enable failed\n"); + return ret; + } =20 vdoa =3D devm_kzalloc(&pdev->dev, sizeof(*vdoa), GFP_KERNEL); if (!vdoa) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BE9CC433EF for ; Mon, 24 Jan 2022 20:23:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347352AbiAXUW6 (ORCPT ); Mon, 24 Jan 2022 15:22:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376330AbiAXUBY (ORCPT ); Mon, 24 Jan 2022 15:01:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA885C055AB2; Mon, 24 Jan 2022 11:28:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 64CA7B8123D; Mon, 24 Jan 2022 19:28:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 756A8C340E5; Mon, 24 Jan 2022 19:28:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052521; bh=aLxp9MG1FvXaB/4/0PbB5rq6RL/Jlk7y49FhlN07VPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pv/yinmDaYuVNA3OZeY751J75/xwZlux5ewd2GhSDXsAhrKHlSR08uzbISxH1FrZi 0KdhUdP5qHQvjElcYr0I+o/PMYmPt+/0neVU06EFTyT8+4XW82Gk/k4lQ7pNP8W9ue YJDqEAMxoGY8Af+R49mWrfvni0/GU+XrIOb+3pDU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Abhinav Kumar , Rob Clark , Sasha Levin Subject: [PATCH 5.4 086/320] drm/msm/dpu: fix safe status debugfs file Date: Mon, 24 Jan 2022 19:41:10 +0100 Message-Id: <20220124183956.668770381@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Baryshkov [ Upstream commit f31b0e24d31e18b4503eeaf0032baeacc0beaff6 ] Make safe_status debugfs fs file actually return safe status rather than danger status data. Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar Link: https://lore.kernel.org/r/20211201222633.2476780-3-dmitry.baryshkov@l= inaro.org Signed-off-by: Dmitry Baryshkov Signed-off-by: Rob Clark Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/= disp/dpu1/dpu_kms.c index 58b0485dc3750..72f487692adbb 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -88,8 +88,8 @@ static int _dpu_danger_signal_status(struct seq_file *s, &status); } else { seq_puts(s, "\nSafe signal status:\n"); - if (kms->hw_mdp->ops.get_danger_status) - kms->hw_mdp->ops.get_danger_status(kms->hw_mdp, + if (kms->hw_mdp->ops.get_safe_status) + kms->hw_mdp->ops.get_safe_status(kms->hw_mdp, &status); } pm_runtime_put_sync(&kms->pdev->dev); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE858C433EF for ; Mon, 24 Jan 2022 20:18:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359865AbiAXUSb (ORCPT ); Mon, 24 Jan 2022 15:18:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376355AbiAXUBb (ORCPT ); Mon, 24 Jan 2022 15:01:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D26CBC055AB8; Mon, 24 Jan 2022 11:28:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7A6D2B811F9; Mon, 24 Jan 2022 19:28:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98D1BC340E5; Mon, 24 Jan 2022 19:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052524; bh=yIwPMOuMtW3hepi44yX+nWOd3v69Bk/KG7AjPaytj0o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NoImzNL4ceY496bR3mNdzs6EvbubgY+GTIFsuZS9M/NpTqkhKH0fFzVLWrR/1bCZJ pHdmrEvlJ2v7M9HRURNyL/1jXke5qLKiVVyT6rc/MGyfNasLcqBPzf+LhP/SOdciWo bbf3L9Zl6VC+lScN4Ewys9zYfM9OI2aZ9xm32c9A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Douglas Anderson , Laurent Pinchart , Stephen Boyd , Robert Foss , Sasha Levin Subject: [PATCH 5.4 087/320] drm/bridge: ti-sn65dsi86: Set max register for regmap Date: Mon, 24 Jan 2022 19:41:11 +0100 Message-Id: <20220124183956.698481483@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephen Boyd [ Upstream commit 0b665d4af35837f0a0ae63135b84a3c187c1db3b ] Set the maximum register to 0xff so we can dump the registers for this device in debugfs. Fixes: a095f15c00e2 ("drm/bridge: add support for sn65dsi86 bridge driver") Cc: Rob Clark Cc: Douglas Anderson Cc: Laurent Pinchart Signed-off-by: Stephen Boyd Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20211215002529.382383-1= -swboyd@chromium.org Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge= /ti-sn65dsi86.c index f1de4bb6558ca..dbb4a374cb646 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -115,6 +115,7 @@ static const struct regmap_config ti_sn_bridge_regmap_c= onfig =3D { .val_bits =3D 8, .volatile_table =3D &ti_sn_bridge_volatile_table, .cache_type =3D REGCACHE_NONE, + .max_register =3D 0xFF, }; =20 static void ti_sn_bridge_write_u16(struct ti_sn_bridge *pdata, --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7782CC433FE for ; Mon, 24 Jan 2022 20:18:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348606AbiAXUSi (ORCPT ); Mon, 24 Jan 2022 15:18:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376372AbiAXUBc (ORCPT ); Mon, 24 Jan 2022 15:01:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1998CC055ABE; Mon, 24 Jan 2022 11:28:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ADDA26148F; Mon, 24 Jan 2022 19:28:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B0F3C340E7; Mon, 24 Jan 2022 19:28:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052527; bh=jNhhpFP2tNg+Npy4Crv5614QHwFsd4ldaIklWzBWj20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ncJBAo2PsG3u4k3A+vimOP90FEwhtem6E3chxLDlnL3dH76p/96eFWNAqHumcEyNr ySRtEXFRcj4dZCvUaDhyOZnbr0zJTHhy0zhf0EFLDz7ZWL2QRSt5SUj5qZZPgamGwv KUJXgHEy90bQR3er/+ZdnDIjsfHfvqOs2sCMFf10= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Andrzej Pietrasiewicz , Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 088/320] media: hantro: Fix probe func error path Date: Mon, 24 Jan 2022 19:41:12 +0100 Message-Id: <20220124183956.735090904@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jernej Skrabec [ Upstream commit 37af43b250fda6162005d47bf7c959c70d52b107 ] If clocks for some reason couldn't be enabled, probe function returns immediately, without disabling PM. This obviously leaves PM ref counters unbalanced. Fix that by jumping to appropriate error path, so effects of PM functions are reversed. Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver") Signed-off-by: Jernej Skrabec Acked-by: Andrzej Pietrasiewicz Reviewed-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/staging/media/hantro/hantro_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/me= dia/hantro/hantro_drv.c index 32e5966ba5c5f..58cf44045b396 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -823,7 +823,7 @@ static int hantro_probe(struct platform_device *pdev) ret =3D clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks); if (ret) { dev_err(&pdev->dev, "Failed to prepare clocks\n"); - return ret; + goto err_pm_disable; } =20 ret =3D v4l2_device_register(&pdev->dev, &vpu->v4l2_dev); @@ -879,6 +879,7 @@ err_v4l2_unreg: v4l2_device_unregister(&vpu->v4l2_dev); err_clk_unprepare: clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks); +err_pm_disable: pm_runtime_dont_use_autosuspend(vpu->dev); pm_runtime_disable(vpu->dev); return ret; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB1B9C3526F for ; Mon, 24 Jan 2022 19:37:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353827AbiAXTf1 (ORCPT ); Mon, 24 Jan 2022 14:35:27 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56514 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344466AbiAXT2y (ORCPT ); Mon, 24 Jan 2022 14:28:54 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 804976129A; Mon, 24 Jan 2022 19:28:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64A69C340E5; Mon, 24 Jan 2022 19:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052532; bh=oZ9fV1EcOdeX0gDXQYcufvalv4b+Oij4mIKQz1XPDRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jjwZ4GHqZxfqIH0PPaUQqbvcoNXHlM5OiGxO5LOcE6CIUJ9Srw6nQSHT9zFCiJP18 ChrPAFaT6o7srHJl1PPvsOS1jbGT6Q1zu+p4JLGUnJ6hLZkgix48InUnBAyC/Y6d7O qjbvwxsRqHhd/Lm2HPbrOkB7WwjVGC9eoQJBXfAU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antony Antony , Eyal Birger , Steffen Klassert , Sasha Levin Subject: [PATCH 5.4 089/320] xfrm: interface with if_id 0 should return error Date: Mon, 24 Jan 2022 19:41:13 +0100 Message-Id: <20220124183956.767515091@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antony Antony [ Upstream commit 8dce43919566f06e865f7e8949f5c10d8c2493f5 ] xfrm interface if_id =3D 0 would cause xfrm policy lookup errors since Commit 9f8550e4bd9d. Now explicitly fail to create an xfrm interface when if_id =3D 0 With this commit: ip link add ipsec0 type xfrm dev lo if_id 0 Error: if_id must be non zero. v1->v2 change: - add Fixes: tag Fixes: 9f8550e4bd9d ("xfrm: fix disable_xfrm sysctl when used on xfrm inter= faces") Signed-off-by: Antony Antony Reviewed-by: Eyal Birger Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/xfrm/xfrm_interface.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c index 74e90d78c3b46..08343201513a9 100644 --- a/net/xfrm/xfrm_interface.c +++ b/net/xfrm/xfrm_interface.c @@ -659,11 +659,16 @@ static int xfrmi_newlink(struct net *src_net, struct = net_device *dev, struct netlink_ext_ack *extack) { struct net *net =3D dev_net(dev); - struct xfrm_if_parms p; + struct xfrm_if_parms p =3D {}; struct xfrm_if *xi; int err; =20 xfrmi_netlink_parms(data, &p); + if (!p.if_id) { + NL_SET_ERR_MSG(extack, "if_id must be non zero"); + return -EINVAL; + } + xi =3D xfrmi_locate(net, &p); if (xi) return -EEXIST; @@ -688,7 +693,12 @@ static int xfrmi_changelink(struct net_device *dev, st= ruct nlattr *tb[], { struct xfrm_if *xi =3D netdev_priv(dev); struct net *net =3D xi->net; - struct xfrm_if_parms p; + struct xfrm_if_parms p =3D {}; + + if (!p.if_id) { + NL_SET_ERR_MSG(extack, "if_id must be non zero"); + return -EINVAL; + } =20 xfrmi_netlink_parms(data, &p); xi =3D xfrmi_locate(net, &p); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE05DC433FE for ; Mon, 24 Jan 2022 20:19:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345824AbiAXUTT (ORCPT ); Mon, 24 Jan 2022 15:19:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349343AbiAXUCF (ORCPT ); Mon, 24 Jan 2022 15:02:05 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7D14C068085; Mon, 24 Jan 2022 11:28:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 843D96148B; Mon, 24 Jan 2022 19:28:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74B1CC340E5; Mon, 24 Jan 2022 19:28:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052535; bh=7TEbViqa5qzpkns3ce5kg4p4DVWtQcObvdBdTHY3K1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o4ZYnh75VhWTcKiYCnSh8rZGXsUXJZtUa4hVlzsy4BgbqJ9wl8EolXd2LJGc0UTih qoOyXp0g6LHAlBX6rUSOV3YFSMmHvTIr6pgQx5S5s0+p4pe7zANqRrCyhW1mtWyQiF om06ZU8zN3r+DI5uUG90K0k7hX1XB7ure4+oRNyY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antony Antony , Steffen Klassert , Sasha Levin Subject: [PATCH 5.4 090/320] xfrm: state and policy should fail if XFRMA_IF_ID 0 Date: Mon, 24 Jan 2022 19:41:14 +0100 Message-Id: <20220124183956.800549443@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antony Antony [ Upstream commit 68ac0f3810e76a853b5f7b90601a05c3048b8b54 ] xfrm ineterface does not allow xfrm if_id =3D 0 fail to create or update xfrm state and policy. With this commit: ip xfrm policy add src 192.0.2.1 dst 192.0.2.2 dir out if_id 0 RTNETLINK answers: Invalid argument ip xfrm state add src 192.0.2.1 dst 192.0.2.2 proto esp spi 1 \ reqid 1 mode tunnel aead 'rfc4106(gcm(aes))' \ 0x1111111111111111111111111111111111111111 96 if_id 0 RTNETLINK answers: Invalid argument v1->v2 change: - add Fixes: tag Fixes: 9f8550e4bd9d ("xfrm: fix disable_xfrm sysctl when used on xfrm inter= faces") Signed-off-by: Antony Antony Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/xfrm/xfrm_user.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index ddcf569d852f7..42ff32700d68b 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -621,8 +621,13 @@ static struct xfrm_state *xfrm_state_construct(struct = net *net, =20 xfrm_smark_init(attrs, &x->props.smark); =20 - if (attrs[XFRMA_IF_ID]) + if (attrs[XFRMA_IF_ID]) { x->if_id =3D nla_get_u32(attrs[XFRMA_IF_ID]); + if (!x->if_id) { + err =3D -EINVAL; + goto error; + } + } =20 err =3D __xfrm_init_state(x, false, attrs[XFRMA_OFFLOAD_DEV]); if (err) @@ -1328,8 +1333,13 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, s= truct nlmsghdr *nlh, =20 mark =3D xfrm_mark_get(attrs, &m); =20 - if (attrs[XFRMA_IF_ID]) + if (attrs[XFRMA_IF_ID]) { if_id =3D nla_get_u32(attrs[XFRMA_IF_ID]); + if (!if_id) { + err =3D -EINVAL; + goto out_noput; + } + } =20 if (p->info.seq) { x =3D xfrm_find_acq_byseq(net, mark, p->info.seq); @@ -1631,8 +1641,13 @@ static struct xfrm_policy *xfrm_policy_construct(str= uct net *net, struct xfrm_us =20 xfrm_mark_get(attrs, &xp->mark); =20 - if (attrs[XFRMA_IF_ID]) + if (attrs[XFRMA_IF_ID]) { xp->if_id =3D nla_get_u32(attrs[XFRMA_IF_ID]); + if (!xp->if_id) { + err =3D -EINVAL; + goto error; + } + } =20 return xp; error: --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B7F9C433F5 for ; Mon, 24 Jan 2022 20:19:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348989AbiAXUTX (ORCPT ); Mon, 24 Jan 2022 15:19:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376547AbiAXUCN (ORCPT ); Mon, 24 Jan 2022 15:02:13 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB446C06808A; Mon, 24 Jan 2022 11:28:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 56F886141C; Mon, 24 Jan 2022 19:28:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36571C340E5; Mon, 24 Jan 2022 19:28:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052538; bh=OINsiS5UdLDal6aqCsCS5uap8QN3jI0D+lllzyNHj5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yqKqISlVts5CFFFWHtwQONCk3L84tzwN960Qok6i9hhc9D2IvZfJseIdxsrkhgLXN ZBYW63bbZQWT5+ot+Kdkc+mqWe3ZEcWYN4sz2rSnPgCsF5PpdcVrh3VLK0lir8xv4s Fs0t6DSYi/Mz+chdnfXUJQMMoc+YGGzRx5gzz5xQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andre Przywara , Adam Lackorzynski , Peter Maydell , Ard Biesheuvel , Linus Walleij , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.4 091/320] ARM: 9159/1: decompressor: Avoid UNPREDICTABLE NOP encoding Date: Mon, 24 Jan 2022 19:41:15 +0100 Message-Id: <20220124183956.841627066@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andre Przywara [ Upstream commit a92882a4d270fbcc021ee6848de5e48b7f0d27f3 ] In the decompressor's head.S we need to start with an instruction that is some kind of NOP, but also mimics as the PE/COFF header, when the kernel is linked as an UEFI application. The clever solution here is "tstne r0, #0x4d000", which in the worst case just clobbers the condition flags, and bears the magic "MZ" signature in the lowest 16 bits. However the encoding used (0x13105a4d) is actually not valid, since bits [15:12] are supposed to be 0 (written as "(0)" in the ARM ARM). Violating this is UNPREDICTABLE, and *can* trigger an UNDEFINED exception. Common Cortex cores seem to ignore those bits, but QEMU chooses to trap, so the code goes fishing because of a missing exception handler at this point. We are just saved by the fact that commonly (with -kernel or when running from U-Boot) the "Z" bit is set, so the instruction is never executed. See [0] for more details. To make things more robust and avoid UNPREDICTABLE behaviour in the kernel code, lets replace this with a "two-instruction NOP": The first instruction is an exclusive OR, the effect of which the second instruction reverts. This does not leave any trace, neither in a register nor in the condition flags. Also it's a perfectly valid encoding. Kudos to Peter Maydell for coming up with this gem. [0] https://lore.kernel.org/qemu-devel/YTPIdbUCmwagL5%2FD@os.inf.tu-dresden= .de/T/ Link: https://lore.kernel.org/linux-arm-kernel/20210908162617.104962-1-andr= e.przywara@arm.com/T/ Fixes: 81a0bc39ea19 ("ARM: add UEFI stub support") Signed-off-by: Andre Przywara Reported-by: Adam Lackorzynski Suggested-by: Peter Maydell Reviewed-by: Ard Biesheuvel Reviewed-by: Linus Walleij Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm/boot/compressed/efi-header.S | 22 ++++++++++++++-------- arch/arm/boot/compressed/head.S | 3 ++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/arch/arm/boot/compressed/efi-header.S b/arch/arm/boot/compress= ed/efi-header.S index a5983588f96b8..dd53d6eb53ade 100644 --- a/arch/arm/boot/compressed/efi-header.S +++ b/arch/arm/boot/compressed/efi-header.S @@ -9,16 +9,22 @@ #include =20 .macro __nop -#ifdef CONFIG_EFI_STUB - @ This is almost but not quite a NOP, since it does clobber the - @ condition flags. But it is the best we can do for EFI, since - @ PE/COFF expects the magic string "MZ" at offset 0, while the - @ ARM/Linux boot protocol expects an executable instruction - @ there. - .inst MZ_MAGIC | (0x1310 << 16) @ tstne r0, #0x4d000 -#else AR_CLASS( mov r0, r0 ) M_CLASS( nop.w ) + .endm + + .macro __initial_nops +#ifdef CONFIG_EFI_STUB + @ This is a two-instruction NOP, which happens to bear the + @ PE/COFF signature "MZ" in the first two bytes, so the kernel + @ is accepted as an EFI binary. Booting via the UEFI stub + @ will not execute those instructions, but the ARM/Linux + @ boot protocol does, so we need some NOPs here. + .inst MZ_MAGIC | (0xe225 << 16) @ eor r5, r5, 0x4d000 + eor r5, r5, 0x4d000 @ undo previous insn +#else + __nop + __nop #endif .endm =20 diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/hea= d.S index cbe126297f549..0a2410adc25b3 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -165,7 +165,8 @@ start: * were patching the initial instructions of the kernel, i.e * had started to exploit this "patch area". */ - .rept 7 + __initial_nops + .rept 5 __nop .endr #ifndef CONFIG_THUMB2_KERNEL --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6451C433FE for ; Mon, 24 Jan 2022 20:20:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379580AbiAXUTr (ORCPT ); Mon, 24 Jan 2022 15:19:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346369AbiAXUCt (ORCPT ); Mon, 24 Jan 2022 15:02:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4385C068097; Mon, 24 Jan 2022 11:29:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CE687B8122F; Mon, 24 Jan 2022 19:29:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E920C340E5; Mon, 24 Jan 2022 19:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052541; bh=WHWLhQoZZnT8xOEB9aZ3Z5FX6A3t6ikqFX0N6eVEfK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LSEKNFEIxzhQWTiutiaSc3x1P9y11BffA/IvKg+ISFUXFerFdLH5QIOSk3dWpqns7 GkPHGhMpUl2QfZL+DcHwDrnHR/eE07N9JDRSwyp6/IyhKdI4qPL1DwGjUNCgFSR+Py /bI3yLm6gIadcT6gNXADQvtyFgmFk4G/vX/LPd3Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wei Yongjun , Sasha Levin Subject: [PATCH 5.4 092/320] usb: ftdi-elan: fix memory leak on device disconnect Date: Mon, 24 Jan 2022 19:41:16 +0100 Message-Id: <20220124183956.872044331@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wei Yongjun [ Upstream commit 1646566b5e0c556f779180a8514e521ac735de1e ] 'ftdi' is alloced when probe device, but not free on device disconnect, this cause a memory leak as follows: unreferenced object 0xffff88800d584000 (size 8400): comm "kworker/0:2", pid 3809, jiffies 4295453055 (age 13.784s) hex dump (first 32 bytes): 00 40 58 0d 80 88 ff ff 00 40 58 0d 80 88 ff ff .@X......@X..... 00 00 00 00 00 00 00 00 00 00 00 00 ad 4e ad de .............N.. backtrace: [<000000000d47f947>] kmalloc_order_trace+0x19/0x110 mm/slab_common.c:960 [<000000008548ac68>] ftdi_elan_probe+0x8c/0x880 drivers/usb/misc/ftdi-e= lan.c:2647 [<000000007f73e422>] usb_probe_interface+0x31b/0x800 drivers/usb/core/d= river.c:396 [<00000000fe8d07fc>] really_probe+0x299/0xc30 drivers/base/dd.c:517 [<0000000005da7d32>] __driver_probe_device+0x357/0x500 drivers/base/dd.= c:751 [<000000003c2c9579>] driver_probe_device+0x4e/0x140 drivers/base/dd.c:7= 81 Fix it by freeing 'ftdi' after nobody use it. Fixes: a5c66e4b2418 ("USB: ftdi-elan: client driver for ELAN Uxxx adapters") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun Link: https://lore.kernel.org/r/20211217083428.2441-1-weiyongjun1@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/usb/misc/ftdi-elan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index cdee3af33ad7b..684800c66bb4d 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c @@ -202,6 +202,7 @@ static void ftdi_elan_delete(struct kref *kref) mutex_unlock(&ftdi_module_lock); kfree(ftdi->bulk_in_buffer); ftdi->bulk_in_buffer =3D NULL; + kfree(ftdi); } =20 static void ftdi_elan_put_kref(struct usb_ftdi *ftdi) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48960C433FE for ; Mon, 24 Jan 2022 20:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382391AbiAXUZf (ORCPT ); Mon, 24 Jan 2022 15:25:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354527AbiAXUDK (ORCPT ); Mon, 24 Jan 2022 15:03:10 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B5D4C068098; Mon, 24 Jan 2022 11:29:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 42C35B81232; Mon, 24 Jan 2022 19:29:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74144C340E5; Mon, 24 Jan 2022 19:29:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052546; bh=Ab/3iDNHxZRqQSLs0ojA81yYVcri+4MHDhaYvBIFcPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ReW0rJOOZ+IC+dnTC0cC2GeNgqkbbzVChLhBPy+qpYxj9uE4skLQmMgwl5RIlDbdR RHc3Qq4tFyLbA81xourG8WvKqFwcPnndIZfBiD96r36pasG6OG2yQL0bebStlRpD6A qylWepPtZKlXW2ynXozsSXm50t41Fs/oytSrc9Vk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Gregory CLEMENT , Sasha Levin Subject: [PATCH 5.4 093/320] ARM: dts: armada-38x: Add generic compatible to UART nodes Date: Mon, 24 Jan 2022 19:41:17 +0100 Message-Id: <20220124183956.902450176@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Marek Beh=C3=BAn [ Upstream commit 62480772263ab6b52e758f2346c70a526abd1d28 ] Add generic compatible string "ns16550a" to serial port nodes of Armada 38x. This makes it possible to use earlycon. Fixes: 0d3d96ab0059 ("ARM: mvebu: add Device Tree description of the Armada= 380/385 SoCs") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Marek Beh=C3=BAn Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm/boot/dts/armada-38x.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-3= 8x.dtsi index 669da3a33d82c..5b82e58a1cf06 100644 --- a/arch/arm/boot/dts/armada-38x.dtsi +++ b/arch/arm/boot/dts/armada-38x.dtsi @@ -165,7 +165,7 @@ }; =20 uart0: serial@12000 { - compatible =3D "marvell,armada-38x-uart"; + compatible =3D "marvell,armada-38x-uart", "ns16550a"; reg =3D <0x12000 0x100>; reg-shift =3D <2>; interrupts =3D ; @@ -175,7 +175,7 @@ }; =20 uart1: serial@12100 { - compatible =3D "marvell,armada-38x-uart"; + compatible =3D "marvell,armada-38x-uart", "ns16550a"; reg =3D <0x12100 0x100>; reg-shift =3D <2>; interrupts =3D ; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CE91C433F5 for ; Mon, 24 Jan 2022 19:43:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351023AbiAXTny (ORCPT ); Mon, 24 Jan 2022 14:43:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58052 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352897AbiAXTbO (ORCPT ); Mon, 24 Jan 2022 14:31:14 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 09DC561482; Mon, 24 Jan 2022 19:31:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E29BEC340E5; Mon, 24 Jan 2022 19:31:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052673; bh=Yfx4afU5U/SUeFI8vDC9AXyMNEsK7W7v+iXmHZLdwWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RtaD40NqMM8WNjQRWTmcJwab5y3NB7/EFJP9vj4GWdxt8RbKKZKUU6fjHzl7K9/Mv z7DvYPZLL86ipa6ju552f0YJfePmGzTtJrbMRpcu7dfORgkAqVA5WnpycXoFel8zIt JU4hx8tHNNJ987E6NR4npcFelJ50B3UDg0Etj2k0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Martin Blumenstingl , Ulf Hansson , Sasha Levin Subject: [PATCH 5.4 094/320] mmc: meson-mx-sdio: add IRQ check Date: Mon, 24 Jan 2022 19:41:18 +0100 Message-Id: <20220124183956.933670845@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergey Shtylyov [ Upstream commit 8fc9a77bc64e1f23d07953439817d8402ac9706f ] The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_threaded_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_threaded_irq() with the invalid IRQ #s. Fixes: ed80a13bb4c4 ("mmc: meson-mx-sdio: Add a driver for the Amlogic Meso= n8 and Meson8b SoC") Signed-off-by: Sergey Shtylyov Reviewed-by: Martin Blumenstingl Link: https://lore.kernel.org/r/20211217202717.10041-3-s.shtylyov@omp.ru Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/mmc/host/meson-mx-sdio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-s= dio.c index 360d523132bd5..780552a86ec08 100644 --- a/drivers/mmc/host/meson-mx-sdio.c +++ b/drivers/mmc/host/meson-mx-sdio.c @@ -665,6 +665,11 @@ static int meson_mx_mmc_probe(struct platform_device *= pdev) } =20 irq =3D platform_get_irq(pdev, 0); + if (irq < 0) { + ret =3D irq; + goto error_free_mmc; + } + ret =3D devm_request_threaded_irq(host->controller_dev, irq, meson_mx_mmc_irq, meson_mx_mmc_irq_thread, IRQF_ONESHOT, --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 190C4C433F5 for ; Mon, 24 Jan 2022 19:37:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354091AbiAXTf6 (ORCPT ); Mon, 24 Jan 2022 14:35:58 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52262 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352052AbiAXT3c (ORCPT ); Mon, 24 Jan 2022 14:29:32 -0500 Received: from smtp.kernel.org (relay.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 0FAB6B811F9; Mon, 24 Jan 2022 19:29:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 332FBC340E7; Mon, 24 Jan 2022 19:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052569; bh=8PyNwfE8AMHt87zLF1fUP0V9ClhrAz8U/sYGHvaLTDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zEqqt95hBf65fslQ9P2FuQxpB6Uhm68vHPp0gFAC5diZvh9+xUQ1EupCeiCgF7A3d LZ51b9Q5yTvAgz/IRRPl6Wa4baxmxsbzbuHBr2lOFbqmDScX1OF5VmQ2QNEjuKlLvm GxPRF6AxP8Y5sEYRyYdjiTSE038LeNh+fntSHAVY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bernard Zhao , Paul Moore , Sasha Levin Subject: [PATCH 5.4 095/320] selinux: fix potential memleak in selinux_add_opt() Date: Mon, 24 Jan 2022 19:41:19 +0100 Message-Id: <20220124183956.964553715@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bernard Zhao [ Upstream commit 2e08df3c7c4e4e74e3dd5104c100f0bf6288aaa8 ] This patch try to fix potential memleak in error branch. Fixes: ba6418623385 ("selinux: new helper - selinux_add_opt()") Signed-off-by: Bernard Zhao [PM: tweak the subject line, add Fixes tag] Signed-off-by: Paul Moore Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- security/selinux/hooks.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 91f2ba0b225b7..56418cf72069d 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -995,18 +995,22 @@ out: static int selinux_add_opt(int token, const char *s, void **mnt_opts) { struct selinux_mnt_opts *opts =3D *mnt_opts; + bool is_alloc_opts =3D false; =20 if (token =3D=3D Opt_seclabel) /* eaten and completely ignored */ return 0; =20 + if (!s) + return -ENOMEM; + if (!opts) { opts =3D kzalloc(sizeof(struct selinux_mnt_opts), GFP_KERNEL); if (!opts) return -ENOMEM; *mnt_opts =3D opts; + is_alloc_opts =3D true; } - if (!s) - return -ENOMEM; + switch (token) { case Opt_context: if (opts->context || opts->defcontext) @@ -1031,6 +1035,10 @@ static int selinux_add_opt(int token, const char *s,= void **mnt_opts) } return 0; Einval: + if (is_alloc_opts) { + kfree(opts); + *mnt_opts =3D NULL; + } pr_warn(SEL_MOUNT_FAIL_MSG); return -EINVAL; } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB466C433F5 for ; Mon, 24 Jan 2022 20:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382446AbiAXUZp (ORCPT ); Mon, 24 Jan 2022 15:25:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376681AbiAXUDd (ORCPT ); Mon, 24 Jan 2022 15:03:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F41AEC0619D2; Mon, 24 Jan 2022 11:30:02 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 91C2B614BE; Mon, 24 Jan 2022 19:30:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9390FC340E5; Mon, 24 Jan 2022 19:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052602; bh=tZrs0Jt+SIkesNUNBAwCsJLLP2xGRVcbKR9NellZksk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jCe0lorceJvyg1mu7IGsBu+evQQ9TOpSQesfxk1od7oUO+TaUSqrywAUs5s1ti6zO DCH1Ns3dbBKaypQtk7WIETIRSvt4uqvKyZTw/M5SGCIJI6mFNWt13ZLjwirlxei2k3 eOqjQU4jVov8R7vXkh/C/Iiep9WJS2Y3LmNZpao0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quentin Monnet , Paul Chaignon , Andrii Nakryiko , Yonghong Song , Sasha Levin Subject: [PATCH 5.4 096/320] bpftool: Enable line buffering for stdout Date: Mon, 24 Jan 2022 19:41:20 +0100 Message-Id: <20220124183956.994730693@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Chaignon [ Upstream commit 1a1a0b0364ad291bd8e509da104ac8b5b1afec5d ] The output of bpftool prog tracelog is currently buffered, which is inconvenient when piping the output into other commands. A simple tracelog | grep will typically not display anything. This patch fixes it by enabling line buffering on stdout for the whole bpftool binary. Fixes: 30da46b5dc3a ("tools: bpftool: add a command to dump the trace pipe") Signed-off-by: Quentin Monnet Signed-off-by: Paul Chaignon Signed-off-by: Andrii Nakryiko Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20211220214528.GA11706@Mem Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- tools/bpf/bpftool/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c index 7d3cfb0ccbe61..4b03983acbefe 100644 --- a/tools/bpf/bpftool/main.c +++ b/tools/bpf/bpftool/main.c @@ -362,6 +362,8 @@ int main(int argc, char **argv) }; int opt, ret; =20 + setlinebuf(stdout); + last_do_help =3D do_help; pretty_output =3D false; json_output =3D false; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79711C433EF for ; Mon, 24 Jan 2022 19:37:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354270AbiAXTgZ (ORCPT ); Mon, 24 Jan 2022 14:36:25 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57640 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352504AbiAXTaf (ORCPT ); Mon, 24 Jan 2022 14:30:35 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 326B3612A5; Mon, 24 Jan 2022 19:30:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0ABE3C340E7; Mon, 24 Jan 2022 19:30:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052634; bh=CRtmMYSLfsM5EdcONKC8ytJivi6XgTG8sj7QVf4Qt/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0f5jruICbqhZPQYCBCyxh2YfP41HbSVy5zsf64+GFoINaFj1mo9xltXbXz1Y2RB6i w8cpP8whKXcZlvbZfon1DQe2BPlsz8XytzIfWxJeCvgdxlo7frfnFFp+39TViBXD+g D1Aqp7Ps0ZGfoRwqwQx9DszsrRqxpVs31YC6+h7o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Zixun , Borislav Petkov , Sasha Levin Subject: [PATCH 5.4 097/320] x86/mce/inject: Avoid out-of-bounds write when setting flags Date: Mon, 24 Jan 2022 19:41:21 +0100 Message-Id: <20220124183957.027398739@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhang Zixun [ Upstream commit de768416b203ac84e02a757b782a32efb388476f ] A contrived zero-length write, for example, by using write(2): ... ret =3D write(fd, str, 0); ... to the "flags" file causes: BUG: KASAN: stack-out-of-bounds in flags_write Write of size 1 at addr ffff888019be7ddf by task writefile/3787 CPU: 4 PID: 3787 Comm: writefile Not tainted 5.16.0-rc7+ #12 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/0= 1/2014 due to accessing buf one char before its start. Prevent such out-of-bounds access. [ bp: Productize into a proper patch. Link below is the next best thing because the original mail didn't get archived on lore. ] Fixes: 0451d14d0561 ("EDAC, mce_amd_inj: Modify flags attribute to use stri= ng arguments") Signed-off-by: Zhang Zixun Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/linux-edac/YcnePfF1OOqoQwrX@zn.tnic/ Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/x86/kernel/cpu/mce/inject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inj= ect.c index eb2d41c1816d6..e1fda5b19b6f6 100644 --- a/arch/x86/kernel/cpu/mce/inject.c +++ b/arch/x86/kernel/cpu/mce/inject.c @@ -347,7 +347,7 @@ static ssize_t flags_write(struct file *filp, const cha= r __user *ubuf, char buf[MAX_FLAG_OPT_SIZE], *__buf; int err; =20 - if (cnt > MAX_FLAG_OPT_SIZE) + if (!cnt || cnt > MAX_FLAG_OPT_SIZE) return -EINVAL; =20 if (copy_from_user(&buf, ubuf, cnt)) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E88C9C4321E for ; Mon, 24 Jan 2022 20:29:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382162AbiAXUZQ (ORCPT ); Mon, 24 Jan 2022 15:25:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377246AbiAXUFL (ORCPT ); Mon, 24 Jan 2022 15:05:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DA4BC08E81D; Mon, 24 Jan 2022 11:30:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D8F63B810BD; Mon, 24 Jan 2022 19:30:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2398C340E5; Mon, 24 Jan 2022 19:30:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052655; bh=5zh1rubP8abvPORWa1hoNnaR/LUIf5kg/5MAFni13VQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s5zg3uTBrXJ7MEAvB8caQ1TKK2ZeqKpfz3CY7ZfwmZmGFBlPLr+kPJSntLlkT3v2q aY0OC2zIi+xOKcK8YwOaVNpFbx/EAKC+qjwIin4IFWKKWRoSLedLzT8qpTA8yQqMvj vhz6IZBJM9ju2qaIHg4d/rH7DollekxnQ/dp942g= 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 Subject: [PATCH 5.4 098/320] ACPI: scan: Create platform device for BCM4752 and LNV4752 ACPI nodes Date: Mon, 24 Jan 2022 19:41:22 +0100 Message-Id: <20220124183957.057409767@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 f85196bdd5a50da74670250564740fc852b3c239 ] BCM4752 and LNV4752 ACPI nodes describe a Broadcom 4752 GPS module attached to an UART of the system. The GPS modules talk a custom protocol which only works with a closed- source Android gpsd daemon which knows this protocol. The ACPI nodes also describe GPIOs to turn the GPS on/off these are handled by the net/rfkill/rfkill-gpio.c code. This handling predates the addition of enumeration of ACPI instantiated serdevs to the kernel and was broken by that addition, because the ACPI scan code now no longer instantiates platform_device-s for these nodes. Rename the i2c_multi_instantiate_ids HID list to ignore_serial_bus_ids and add the BCM4752 and LNV4752 HIDs, so that rfkill-gpio gets a platform_device to bind to again; and so that a tty cdev for gpsd gets created for these. Fixes: e361d1f85855 ("ACPI / scan: Fix enumeration for special UART devices= ") Signed-off-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/acpi/scan.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 95d119ff76b65..5d4be80ee6cb4 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1577,6 +1577,7 @@ static bool acpi_device_enumeration_by_parent(struct = acpi_device *device) { struct list_head resource_list; bool is_serial_bus_slave =3D false; + static const struct acpi_device_id ignore_serial_bus_ids[] =3D { /* * These devices have multiple I2cSerialBus resources and an i2c-client * must be instantiated for each, each with its own i2c_device_id. @@ -1585,11 +1586,18 @@ static bool acpi_device_enumeration_by_parent(struc= t acpi_device *device) * drivers/platform/x86/i2c-multi-instantiate.c driver, which knows * which i2c_device_id to use for each resource. */ - static const struct acpi_device_id i2c_multi_instantiate_ids[] =3D { {"BSG1160", }, {"BSG2150", }, {"INT33FE", }, {"INT3515", }, + /* + * HIDs of device with an UartSerialBusV2 resource for which userspace + * expects a regular tty cdev to be created (instead of the in kernel + * serdev) and which have a kernel driver which expects a platform_dev + * such as the rfkill-gpio driver. + */ + {"BCM4752", }, + {"LNV4752", }, {} }; =20 @@ -1603,8 +1611,7 @@ static bool acpi_device_enumeration_by_parent(struct = acpi_device *device) fwnode_property_present(&device->fwnode, "baud"))) return true; =20 - /* Instantiate a pdev for the i2c-multi-instantiate drv to bind to */ - if (!acpi_match_device_ids(device, i2c_multi_instantiate_ids)) + if (!acpi_match_device_ids(device, ignore_serial_bus_ids)) return false; =20 INIT_LIST_HEAD(&resource_list); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E366FC4321E for ; Mon, 24 Jan 2022 19:37:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354339AbiAXTgb (ORCPT ); Mon, 24 Jan 2022 14:36:31 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57822 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352737AbiAXTa7 (ORCPT ); Mon, 24 Jan 2022 14:30:59 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1B29E61451; Mon, 24 Jan 2022 19:30:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0AECC340E5; Mon, 24 Jan 2022 19:30:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052658; bh=VH00fZM9pyIofkfidA394IRA/tvTVzVfdo6kQGUBlR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qh9JH5MIwkZymtv/x2RWoVzxzntiO9J590bQ8OwuN/NQE8nNgTt/IAM6IkoXJuAqr Ov34oI3i9ahbNKuf36XrC5bZTLR4KmaCL6jiR6OAbOsi7HEa0DRagvAK5ejM7PALwN NS5puPIAGq1SWeO9ki/LDmQkoS4Rmc1npFCbi7eM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Dominik Brodowski , Sasha Levin Subject: [PATCH 5.4 099/320] pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in __nonstatic_find_io_region() Date: Mon, 24 Jan 2022 19:41:23 +0100 Message-Id: <20220124183957.089588188@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit ca0fe0d7c35c97528bdf621fdca75f13157c27af ] In __nonstatic_find_io_region(), pcmcia_make_resource() is assigned to res and used in pci_bus_alloc_resource(). There is a dereference of res in pci_bus_alloc_resource(), which could lead to a NULL pointer dereference on failure of pcmcia_make_resource(). Fix this bug by adding a check of res. This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_PCCARD_NONSTATIC=3Dy show no new warnings, and our static analyzer no longer warns about this code. Fixes: 49b1153adfe1 ("pcmcia: move all pcmcia_resource_ops providers into o= ne module") Signed-off-by: Zhou Qingyang [linux@dominikbrodowski.net: Fix typo in commit message] Signed-off-by: Dominik Brodowski Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/pcmcia/rsrc_nonstatic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstati= c.c index 9e6922c08ef62..03ae998675e87 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -690,6 +690,9 @@ static struct resource *__nonstatic_find_io_region(stru= ct pcmcia_socket *s, unsigned long min =3D base; int ret; =20 + if (!res) + return NULL; + data.mask =3D align - 1; data.offset =3D base & data.mask; data.map =3D &s_data->io_db; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94827C4321E for ; Mon, 24 Jan 2022 20:28:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382094AbiAXUZL (ORCPT ); Mon, 24 Jan 2022 15:25:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377247AbiAXUFL (ORCPT ); Mon, 24 Jan 2022 15:05:11 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75D2CC06135D; Mon, 24 Jan 2022 11:31:02 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1443260917; Mon, 24 Jan 2022 19:31:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE52FC340E5; Mon, 24 Jan 2022 19:31:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052661; bh=QIyd7AmQlyQIzFlmmWqrWVw2aKTPMcJgj11z4fSzelI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WV2V45wl4kRDANKFjenzAB8hocD8El1rmI/BMFpN8YukKGhGIRoSsnKgTOpAEYciU agLcExrFdk4e4mMQ6DxbSGztr5FxbVR7/ExnasXssqFCE5ZfcV0nDVDy5XsQc1Zbys sgoIsURtvJjVVVCUK5q9hFxnOTQP3ZM9O63+bc7Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Dominik Brodowski , Sasha Levin Subject: [PATCH 5.4 100/320] pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in nonstatic_find_mem_region() Date: Mon, 24 Jan 2022 19:41:24 +0100 Message-Id: <20220124183957.128914925@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit 977d2e7c63c3d04d07ba340b39987742e3241554 ] In nonstatic_find_mem_region(), pcmcia_make_resource() is assigned to res and used in pci_bus_alloc_resource(). There a dereference of res in pci_bus_alloc_resource(), which could lead to a NULL pointer dereference on failure of pcmcia_make_resource(). Fix this bug by adding a check of res. This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_PCCARD_NONSTATIC=3Dy show no new warnings, and our static analyzer no longer warns about this code. Fixes: 49b1153adfe1 ("pcmcia: move all pcmcia_resource_ops providers into o= ne module") Signed-off-by: Zhou Qingyang Signed-off-by: Dominik Brodowski Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/pcmcia/rsrc_nonstatic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstati= c.c index 03ae998675e87..3a512513cb32f 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -812,6 +812,9 @@ static struct resource *nonstatic_find_mem_region(u_lon= g base, u_long num, unsigned long min, max; int ret, i, j; =20 + if (!res) + return NULL; + low =3D low || !(s->features & SS_CAP_PAGE_REGS); =20 data.mask =3D align - 1; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03216C4167B for ; Mon, 24 Jan 2022 19:37:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354356AbiAXTgd (ORCPT ); Mon, 24 Jan 2022 14:36:33 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54102 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352812AbiAXTbG (ORCPT ); Mon, 24 Jan 2022 14:31:06 -0500 Received: from smtp.kernel.org (relay.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 AE9E6B8121B; Mon, 24 Jan 2022 19:31:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD8CEC340E5; Mon, 24 Jan 2022 19:31:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052664; bh=ojLv2A8YiZqQBiDKnhqmW0NP9PBK7G+zSluVkxtI0IA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lfyu98jfTxtiuJfCC18FGhkwArO/yLNz7l1027LZgoFume2GuYJSRiDsuR61dUT7z gl14gsUjCXLZuII55rR/+lVe3wn4wm+zRTJkLQ6L3zZtYcBm9yxLHB9CkPY7cadiiA qixTcQ4lZt6AwaboNPTnndYLIBc1Q/lXITS51uVo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Xiong , Xiyu Yang , Xin Tan , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.4 101/320] netfilter: ipt_CLUSTERIP: fix refcount leak in clusterip_tg_check() Date: Mon, 24 Jan 2022 19:41:25 +0100 Message-Id: <20220124183957.161789148@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xin Xiong [ Upstream commit d94a69cb2cfa77294921aae9afcfb866e723a2da ] The issue takes place in one error path of clusterip_tg_check(). When memcmp() returns nonzero, the function simply returns the error code, forgetting to decrease the reference count of a clusterip_config object, which is bumped earlier by clusterip_config_find_get(). This may incur reference count leak. Fix this issue by decrementing the refcount of the object in specific error path. Fixes: 06aa151ad1fc74 ("netfilter: ipt_CLUSTERIP: check MAC address when du= plicate config is set") Signed-off-by: Xin Xiong Signed-off-by: Xiyu Yang Signed-off-by: Xin Tan Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/ipv4/netfilter/ipt_CLUSTERIP.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CL= USTERIP.c index 6bdb1ab8af617..63ebb87d85331 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c @@ -505,8 +505,11 @@ static int clusterip_tg_check(const struct xt_tgchk_pa= ram *par) if (IS_ERR(config)) return PTR_ERR(config); } - } else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN)) + } else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN)) { + clusterip_config_entry_put(config); + clusterip_config_put(config); return -EINVAL; + } =20 ret =3D nf_ct_netns_get(par->net, par->family); if (ret < 0) { --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7017C433FE for ; Mon, 24 Jan 2022 20:28:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381868AbiAXUYs (ORCPT ); Mon, 24 Jan 2022 15:24:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377243AbiAXUFL (ORCPT ); Mon, 24 Jan 2022 15:05:11 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 692F6C06135F; Mon, 24 Jan 2022 11:31:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 08EE660917; Mon, 24 Jan 2022 19:31:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B63CAC340E5; Mon, 24 Jan 2022 19:31:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052667; bh=ZziZE/q/QGnmo1EOHF/uyk7XIzDk+wvPA8vIawa5iH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yhSC8EDPeNaVbSrzCOAErNUIbDpIDkdKKvgefV9Npm3FaM6TtPY3StyCAFQxSmeGN DJMBjhaqa0nmgZg/yfw0dfrTlh4CgolWc9vpPmvuUVnivCqcXwS+OkcThFhZAr/9hw QwE6sjLaFv0G9Fg3y9qpRx71Mpz1871TcqhOR0D8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.4 102/320] bpf: Fix SO_RCVBUF/SO_SNDBUF handling in _bpf_setsockopt(). Date: Mon, 24 Jan 2022 19:41:26 +0100 Message-Id: <20220124183957.191563339@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 04c350b1ae6bdb12b84009a4d0bf5ab4e621c47b ] The commit 4057765f2dee ("sock: consistent handling of extreme SO_SNDBUF/SO_RCVBUF values") added a change to prevent underflow in setsockopt() around SO_SNDBUF/SO_RCVBUF. This patch adds the same change to _bpf_setsockopt(). Fixes: 4057765f2dee ("sock: consistent handling of extreme SO_SNDBUF/SO_RCV= BUF values") Signed-off-by: Kuniyuki Iwashima Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20220104013153.97906-2-kuniyu@amazon.co.jp Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/core/filter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index 5ebc973ed4c50..b90c0b5a10112 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4248,12 +4248,14 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern= *, bpf_sock, switch (optname) { case SO_RCVBUF: val =3D min_t(u32, val, sysctl_rmem_max); + val =3D min_t(int, val, INT_MAX / 2); sk->sk_userlocks |=3D SOCK_RCVBUF_LOCK; WRITE_ONCE(sk->sk_rcvbuf, max_t(int, val * 2, SOCK_MIN_RCVBUF)); break; case SO_SNDBUF: val =3D min_t(u32, val, sysctl_wmem_max); + val =3D min_t(int, val, INT_MAX / 2); sk->sk_userlocks |=3D SOCK_SNDBUF_LOCK; WRITE_ONCE(sk->sk_sndbuf, max_t(int, val * 2, SOCK_MIN_SNDBUF)); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C19AC4167D for ; Mon, 24 Jan 2022 19:37:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354421AbiAXTgg (ORCPT ); Mon, 24 Jan 2022 14:36:36 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54226 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352872AbiAXTbN (ORCPT ); Mon, 24 Jan 2022 14:31:13 -0500 Received: from smtp.kernel.org (relay.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 C205DB810AF; Mon, 24 Jan 2022 19:31:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D93D3C340E5; Mon, 24 Jan 2022 19:31:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052670; bh=Sk9A/4JkAGKM92L/GmL40lQafKcgq0e2rnxGxsxYeoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=agDew632/Z7VCT2478pPbK5rDfcvW4nMuHOs6dKPO+0rLlOGX7gyiB/gWJej8SSo1 VMQTdiyA7QITZvL/CX48pTCsqW528zzDlNxZ/gWNBhfE2E4OakVU//JrVMOkWCInDS MSYEAquqaEybzUc0Ms8QFuIi3D8wNaCGr1Ml98ng= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Paul Mackerras , linux-ppp@vger.kernel.org, syzbot , Guillaume Nault , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 103/320] ppp: ensure minimum packet size in ppp_write() Date: Mon, 24 Jan 2022 19:41:27 +0100 Message-Id: <20220124183957.223371972@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 44073187990d5629804ce0627525f6ea5cfef171 ] It seems pretty clear ppp layer assumed user space would always be kind to provide enough data in their write() to a ppp device. This patch makes sure user provides at least 2 bytes. It adds PPP_PROTO_LEN macro that could replace in net-next many occurrences of hard-coded 2 value. I replaced only one occurrence to ease backports to stable kernels. The bug manifests in the following report: BUG: KMSAN: uninit-value in ppp_send_frame+0x28d/0x27c0 drivers/net/ppp/ppp= _generic.c:1740 ppp_send_frame+0x28d/0x27c0 drivers/net/ppp/ppp_generic.c:1740 __ppp_xmit_process+0x23e/0x4b0 drivers/net/ppp/ppp_generic.c:1640 ppp_xmit_process+0x1fe/0x480 drivers/net/ppp/ppp_generic.c:1661 ppp_write+0x5cb/0x5e0 drivers/net/ppp/ppp_generic.c:513 do_iter_write+0xb0c/0x1500 fs/read_write.c:853 vfs_writev fs/read_write.c:924 [inline] do_writev+0x645/0xe00 fs/read_write.c:967 __do_sys_writev fs/read_write.c:1040 [inline] __se_sys_writev fs/read_write.c:1037 [inline] __x64_sys_writev+0xe5/0x120 fs/read_write.c:1037 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x44/0xae Uninit was created at: slab_post_alloc_hook mm/slab.h:524 [inline] slab_alloc_node mm/slub.c:3251 [inline] __kmalloc_node_track_caller+0xe0c/0x1510 mm/slub.c:4974 kmalloc_reserve net/core/skbuff.c:354 [inline] __alloc_skb+0x545/0xf90 net/core/skbuff.c:426 alloc_skb include/linux/skbuff.h:1126 [inline] ppp_write+0x11d/0x5e0 drivers/net/ppp/ppp_generic.c:501 do_iter_write+0xb0c/0x1500 fs/read_write.c:853 vfs_writev fs/read_write.c:924 [inline] do_writev+0x645/0xe00 fs/read_write.c:967 __do_sys_writev fs/read_write.c:1040 [inline] __se_sys_writev fs/read_write.c:1037 [inline] __x64_sys_writev+0xe5/0x120 fs/read_write.c:1037 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x44/0xae Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Eric Dumazet Cc: Paul Mackerras Cc: linux-ppp@vger.kernel.org Reported-by: syzbot Acked-by: Guillaume Nault Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ppp/ppp_generic.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index c6c41a7836c93..a085213dc2eaa 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -69,6 +69,8 @@ #define MPHDRLEN 6 /* multilink protocol header length */ #define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */ =20 +#define PPP_PROTO_LEN 2 + /* * An instance of /dev/ppp can be associated with either a ppp * interface unit or a ppp channel. In both cases, file->private_data @@ -498,6 +500,9 @@ static ssize_t ppp_write(struct file *file, const char = __user *buf, =20 if (!pf) return -ENXIO; + /* All PPP packets should start with the 2-byte protocol */ + if (count < PPP_PROTO_LEN) + return -EINVAL; ret =3D -ENOMEM; skb =3D alloc_skb(count + pf->hdrlen, GFP_KERNEL); if (!skb) @@ -1544,7 +1549,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) } =20 ++ppp->stats64.tx_packets; - ppp->stats64.tx_bytes +=3D skb->len - 2; + ppp->stats64.tx_bytes +=3D skb->len - PPP_PROTO_LEN; =20 switch (proto) { case PPP_IP: --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59E6AC433F5 for ; Mon, 24 Jan 2022 19:37:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354115AbiAXTgB (ORCPT ); Mon, 24 Jan 2022 14:36:01 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57036 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352064AbiAXT3d (ORCPT ); Mon, 24 Jan 2022 14:29:33 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3FF356135E; Mon, 24 Jan 2022 19:29:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A3EDC340E5; Mon, 24 Jan 2022 19:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052572; bh=ETqpcHCICc1tUB+WtR27CydYwT/UiM3pGK7XK2NBSNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aFvpbW7wDgl/qFmbFcFK83tze/6thQYC5IyZ3jUj19NO7TcbpnxVXBx0dev5HjZ1P 5FhDzMbXJ6qcX87J4RoKH7c6nvGOHoPJmgubpeNLYnzaXQKZV9JMnYHkfOcKy2qeNq DEa79Gyy9z/w+UW4dsDcFbGeaZaRm+RbTFziEWYw= 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.4 104/320] rocker: fix a sleeping in atomic bug Date: Mon, 24 Jan 2022 19:41:28 +0100 Message-Id: <20220124183957.261941057@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 43d012123122cc69feacab55b71369f386c19566 ] This code is holding the &ofdpa->flow_tbl_lock spinlock so it is not allowed to sleep. That means we have to pass the OFDPA_OP_FLAG_NOWAIT flag to ofdpa_flow_tbl_del(). Fixes: 936bd486564a ("rocker: use FIB notifications instead of switchdev ca= lls") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/rocker/rocker_ofdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/rocker/rocker_ofdpa.c b/drivers/net/ether= net/rocker/rocker_ofdpa.c index 7072b249c8bd6..8157666209798 100644 --- a/drivers/net/ethernet/rocker/rocker_ofdpa.c +++ b/drivers/net/ethernet/rocker/rocker_ofdpa.c @@ -2795,7 +2795,8 @@ static void ofdpa_fib4_abort(struct rocker *rocker) if (!ofdpa_port) continue; nh->fib_nh_flags &=3D ~RTNH_F_OFFLOAD; - ofdpa_flow_tbl_del(ofdpa_port, OFDPA_OP_FLAG_REMOVE, + ofdpa_flow_tbl_del(ofdpa_port, + OFDPA_OP_FLAG_REMOVE | OFDPA_OP_FLAG_NOWAIT, flow_entry); } spin_unlock_irqrestore(&ofdpa->flow_tbl_lock, flags); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36D46C433F5 for ; Mon, 24 Jan 2022 20:22:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350371AbiAXUV4 (ORCPT ); Mon, 24 Jan 2022 15:21:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354685AbiAXUDc (ORCPT ); Mon, 24 Jan 2022 15:03:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88346C0680BF; Mon, 24 Jan 2022 11:29:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2A0706142C; Mon, 24 Jan 2022 19:29:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EE01C340E5; Mon, 24 Jan 2022 19:29:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052575; bh=Dv2PrsEKWm7VT9rQNz9Uu+sSGVoXUWQfD7FuoCeluW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e0WSezQLONzQtkV68x7SZZPfDhc/AdRECO02CNiz2cmIlcpHYlv8IZIK0jyDS64v+ 7vDen61Sabe69nS3rCWQbJMFWAOPgRK+H/YfoWMuOQqGwee6LOdOPovI4oE7lX4SmU 5ghzBtnjO+iujZKgZhEmCa3xnOzGv0sdUwv8I6HU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Elder , Jiasheng Jiang , Sasha Levin Subject: [PATCH 5.4 105/320] staging: greybus: audio: Check null pointer Date: Mon, 24 Jan 2022 19:41:29 +0100 Message-Id: <20220124183957.297874723@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 2e81948177d769106754085c3e03534e6cc1f623 ] As the possible alloc failure of devm_kcalloc(), it could return null pointer. Therefore, 'strings' should be checked and return NULL if alloc fails to prevent the dereference of the NULL pointer. Also, the caller should also deal with the return value of the gb_generate_enum_strings() and return -ENOMEM if returns NULL. Moreover, because the memory allocated with devm_kzalloc() will be freed automatically when the last reference to the device is dropped, the 'gbe' in gbaudio_tplg_create_enum_kctl() and gbaudio_tplg_create_enum_ctl() do not need to free manually. But the 'control' in gbaudio_tplg_create_widget() and gbaudio_tplg_process_kcontrols() has a specially error handle to cleanup. So it should be better to cleanup 'control' when fails. Fixes: e65579e335da ("greybus: audio: topology: Enable enumerated control s= upport") Reviewed-by: Alex Elder Signed-off-by: Jiasheng Jiang Link: https://lore.kernel.org/r/20220104150628.1987906-1-jiasheng@iscas.ac.= cn Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/staging/greybus/audio_topology.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/gre= ybus/audio_topology.c index a8cfea957868a..3e2fbcd20598a 100644 --- a/drivers/staging/greybus/audio_topology.c +++ b/drivers/staging/greybus/audio_topology.c @@ -145,6 +145,9 @@ static const char **gb_generate_enum_strings(struct gba= udio_module_info *gb, =20 items =3D le32_to_cpu(gbenum->items); strings =3D devm_kcalloc(gb->dev, items, sizeof(char *), GFP_KERNEL); + if (!strings) + return NULL; + data =3D gbenum->names; =20 for (i =3D 0; i < items; i++) { @@ -662,6 +665,8 @@ static int gbaudio_tplg_create_enum_kctl(struct gbaudio= _module_info *gb, /* since count=3D1, and reg is dummy */ gbe->max =3D le32_to_cpu(gb_enum->items); gbe->texts =3D gb_generate_enum_strings(gb, gb_enum); + if (!gbe->texts) + return -ENOMEM; =20 /* debug enum info */ dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->max, @@ -871,6 +876,8 @@ static int gbaudio_tplg_create_enum_ctl(struct gbaudio_= module_info *gb, /* since count=3D1, and reg is dummy */ gbe->max =3D le32_to_cpu(gb_enum->items); gbe->texts =3D gb_generate_enum_strings(gb, gb_enum); + if (!gbe->texts) + return -ENOMEM; =20 /* debug enum info */ dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->max, @@ -1081,6 +1088,10 @@ static int gbaudio_tplg_create_widget(struct gbaudio= _module_info *module, csize +=3D le16_to_cpu(gbenum->names_length); control->texts =3D (const char * const *) gb_generate_enum_strings(module, gbenum); + if (!control->texts) { + ret =3D -ENOMEM; + goto error; + } control->items =3D le32_to_cpu(gbenum->items); } else { csize =3D sizeof(struct gb_audio_control); @@ -1190,6 +1201,10 @@ static int gbaudio_tplg_process_kcontrols(struct gba= udio_module_info *module, csize +=3D le16_to_cpu(gbenum->names_length); control->texts =3D (const char * const *) gb_generate_enum_strings(module, gbenum); + if (!control->texts) { + ret =3D -ENOMEM; + goto error; + } control->items =3D le32_to_cpu(gbenum->items); } else { csize =3D sizeof(struct gb_audio_control); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33D45C4167D for ; Mon, 24 Jan 2022 20:29:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382465AbiAXUZr (ORCPT ); Mon, 24 Jan 2022 15:25:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376677AbiAXUDd (ORCPT ); Mon, 24 Jan 2022 15:03:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BC58C03463F; Mon, 24 Jan 2022 11:29:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2DDDA60917; Mon, 24 Jan 2022 19:29:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1209EC340E5; Mon, 24 Jan 2022 19:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052578; bh=rntYQlCVPisB/5zHJxmM6EaBvY6oz+EzaTcSMqEAHt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Euo8RtWl8H13dS/S1naGHRv2+aM6/h3sn3gV6LDojOSHkiFvt5cfSGK6ZsocWo+of rzm43TPG3NO8TXMZDaRtOA4bOZNuC8rhfFkooxRFfCDRLI5ReLGDTYQJdkKD7gIHqn oRqJ2ik/ZMvk/Yr3WJdpzBPmsDtVAA+dhJlxvHRc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 106/320] fsl/fman: Check for null pointer after calling devm_ioremap Date: Mon, 24 Jan 2022 19:41:30 +0100 Message-Id: <20220124183957.330849637@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit d5a73ec96cc57cf67e51b12820fc2354e7ca46f8 ] As the possible failure of the allocation, the devm_ioremap() may return NULL pointer. Take tgec_initialization() as an example. If allocation fails, the params->base_addr will be NULL pointer and will be assigned to tgec->regs in tgec_config(). Then it will cause the dereference of NULL pointer in set_mac_address(), which is called by tgec_init(). Therefore, it should be better to add the sanity check after the calling of the devm_ioremap(). Fixes: 3933961682a3 ("fsl/fman: Add FMan MAC driver") Signed-off-by: Jiasheng Jiang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/freescale/fman/mac.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethern= et/freescale/fman/mac.c index 7ab8095db1928..147126e79986c 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -94,14 +94,17 @@ static void mac_exception(void *handle, enum fman_mac_e= xceptions ex) __func__, ex); } =20 -static void set_fman_mac_params(struct mac_device *mac_dev, - struct fman_mac_params *params) +static int set_fman_mac_params(struct mac_device *mac_dev, + struct fman_mac_params *params) { struct mac_priv_s *priv =3D mac_dev->priv; =20 params->base_addr =3D (typeof(params->base_addr)) devm_ioremap(priv->dev, mac_dev->res->start, resource_size(mac_dev->res)); + if (!params->base_addr) + return -ENOMEM; + memcpy(¶ms->addr, mac_dev->addr, sizeof(mac_dev->addr)); params->max_speed =3D priv->max_speed; params->phy_if =3D mac_dev->phy_if; @@ -112,6 +115,8 @@ static void set_fman_mac_params(struct mac_device *mac_= dev, params->event_cb =3D mac_exception; params->dev_id =3D mac_dev; params->internal_phy_node =3D priv->internal_phy_node; + + return 0; } =20 static int tgec_initialization(struct mac_device *mac_dev) @@ -123,7 +128,9 @@ static int tgec_initialization(struct mac_device *mac_d= ev) =20 priv =3D mac_dev->priv; =20 - set_fman_mac_params(mac_dev, ¶ms); + err =3D set_fman_mac_params(mac_dev, ¶ms); + if (err) + goto _return; =20 mac_dev->fman_mac =3D tgec_config(¶ms); if (!mac_dev->fman_mac) { @@ -169,7 +176,9 @@ static int dtsec_initialization(struct mac_device *mac_= dev) =20 priv =3D mac_dev->priv; =20 - set_fman_mac_params(mac_dev, ¶ms); + err =3D set_fman_mac_params(mac_dev, ¶ms); + if (err) + goto _return; =20 mac_dev->fman_mac =3D dtsec_config(¶ms); if (!mac_dev->fman_mac) { @@ -218,7 +227,9 @@ static int memac_initialization(struct mac_device *mac_= dev) =20 priv =3D mac_dev->priv; =20 - set_fman_mac_params(mac_dev, ¶ms); + err =3D set_fman_mac_params(mac_dev, ¶ms); + if (err) + goto _return; =20 if (priv->max_speed =3D=3D SPEED_10000) params.phy_if =3D PHY_INTERFACE_MODE_XGMII; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E1BFC4332F for ; Mon, 24 Jan 2022 20:21:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381660AbiAXUVm (ORCPT ); Mon, 24 Jan 2022 15:21:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376679AbiAXUDd (ORCPT ); Mon, 24 Jan 2022 15:03:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 055D2C08E6DC; Mon, 24 Jan 2022 11:29:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B7B28B81238; Mon, 24 Jan 2022 19:29:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4820C340E5; Mon, 24 Jan 2022 19:29:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052581; bh=J8duQaotuAl4FUUuOIClzvWBYiFdiRFM92W/pHtQcoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SJmM+oGcqZ0BG+Ym7hvZlF3eRAAxm9HG+6F+1DxrFKAFbLab2lljYwjPoWhzc6PPv pRExZGqps2tmTp3tzPNZ15RUAluIzj5v8PvqEA15qZwldYbCU5DzHu6PtZwmvUFP9I gQVUznnK8H6FsxYsebs5yAhAWd5zp/iErJnG5iAQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.4 107/320] Bluetooth: hci_bcm: Check for error irq Date: Mon, 24 Jan 2022 19:41:31 +0100 Message-Id: <20220124183957.360997824@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit b38cd3b42fba66cc538edb9cf77e07881f43f8e2 ] For the possible failure of the platform_get_irq(), the returned irq could be error number and will finally cause the failure of the request_irq(). Consider that platform_get_irq() can now in certain cases return -EPROBE_DEFER, and the consequences of letting request_irq() effectively convert that into -EINVAL, even at probe time rather than later on. So it might be better to check just now. Fixes: 0395ffc1ee05 ("Bluetooth: hci_bcm: Add PM for BCM devices") Signed-off-by: Jiasheng Jiang Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/bluetooth/hci_bcm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index 94ed734c1d7eb..c6bb380806f9b 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -1127,7 +1127,12 @@ static int bcm_probe(struct platform_device *pdev) return -ENOMEM; =20 dev->dev =3D &pdev->dev; - dev->irq =3D platform_get_irq(pdev, 0); + + ret =3D platform_get_irq(pdev, 0); + if (ret < 0) + return ret; + + dev->irq =3D ret; =20 if (has_acpi_companion(&pdev->dev)) { ret =3D bcm_acpi_probe(dev); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AE61C43219 for ; Mon, 24 Jan 2022 20:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382531AbiAXUZv (ORCPT ); Mon, 24 Jan 2022 15:25:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352099AbiAXUDd (ORCPT ); Mon, 24 Jan 2022 15:03:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B71AFC08E6E8; Mon, 24 Jan 2022 11:29:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5D1CBB81233; Mon, 24 Jan 2022 19:29:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFF3CC340E5; Mon, 24 Jan 2022 19:29:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052584; bh=xvzL5yn66KLTBpJ5XX8WNNkm2PGPKRLw75f8LAXvbiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eTcCj+afUS6IwDh8lyM20NscVo6f8OqI2YYw04c9HIHJk5eI/8N2a1P0E0fb1tnCa 48ZwfOJy/6bENfcU7q+sDOAf2zeo5YQ1e5FXtijm7hpLMonhfSr6a/FibwJgEbALgi 8irhon6atq9AywiZPQx4GsCrbGtSTIGxBOKlhVYI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Jiri Kosina , Sasha Levin Subject: [PATCH 5.4 108/320] HID: hid-uclogic-params: Invalid parameter check in uclogic_params_init Date: Mon, 24 Jan 2022 19:41:32 +0100 Message-Id: <20220124183957.389981862@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Jos=C3=A9 Exp=C3=B3sito [ Upstream commit f364c571a5c77e96de2d32062ff019d6b8d2e2bc ] The function performs a check on its input parameters, however, the hdev parameter is used before the check. Initialize the stack variables after checking the input parameters to avoid a possible NULL pointer dereference. Fixes: 9614219e9310e ("HID: uclogic: Extract tablet parameter discovery int= o a module") Addresses-Coverity-ID: 1443831 ("Null pointer dereference") Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/hid/hid-uclogic-params.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-par= ams.c index ed4ede52b017f..0afd368115891 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -832,10 +832,10 @@ int uclogic_params_init(struct uclogic_params *params, struct hid_device *hdev) { int rc; - struct usb_device *udev =3D hid_to_usb_dev(hdev); - __u8 bNumInterfaces =3D udev->config->desc.bNumInterfaces; - struct usb_interface *iface =3D to_usb_interface(hdev->dev.parent); - __u8 bInterfaceNumber =3D iface->cur_altsetting->desc.bInterfaceNumber; + struct usb_device *udev; + __u8 bNumInterfaces; + struct usb_interface *iface; + __u8 bInterfaceNumber; bool found; /* The resulting parameters (noop) */ struct uclogic_params p =3D {0, }; @@ -846,6 +846,11 @@ int uclogic_params_init(struct uclogic_params *params, goto cleanup; } =20 + udev =3D hid_to_usb_dev(hdev); + bNumInterfaces =3D udev->config->desc.bNumInterfaces; + iface =3D to_usb_interface(hdev->dev.parent); + bInterfaceNumber =3D iface->cur_altsetting->desc.bInterfaceNumber; + /* * Set replacement report descriptor if the original matches the * specified size. Otherwise keep interface unchanged. --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C93EC433EF for ; Mon, 24 Jan 2022 19:37:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354132AbiAXTgE (ORCPT ); Mon, 24 Jan 2022 14:36:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57134 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352185AbiAXT3t (ORCPT ); Mon, 24 Jan 2022 14:29:49 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 96CEA6121F; Mon, 24 Jan 2022 19:29:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BC21C340E5; Mon, 24 Jan 2022 19:29:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052587; bh=/VPIGVCi6Rg+PZ+mSK3jbNzMWjhnDYX74Ty8HuWxxy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jY3AImKH2uiS5AriRHJkGLj7fpjOlpAipEUyvy3lg1ShZ088Bfs/oHqhB0gvXUtLj iQwTZXPjmdghWPxRZWFiG7uJlXtZV+4OXu4YpNovgBniWqdcobesnCP6ZfpHbqUreG 0Vsv7gk9Bwf9NkHatGwV7MN8inru+7y8jDzTlYh8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Jiri Kosina , Sasha Levin Subject: [PATCH 5.4 109/320] HID: hid-uclogic-params: Invalid parameter check in uclogic_params_get_str_desc Date: Mon, 24 Jan 2022 19:41:33 +0100 Message-Id: <20220124183957.423180733@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Jos=C3=A9 Exp=C3=B3sito [ Upstream commit 0a94131d6920916ccb6a357037c535533af08819 ] The function performs a check on the hdev input parameters, however, it is used before the check. Initialize the udev variable after the sanity check to avoid a possible NULL pointer dereference. Fixes: 9614219e9310e ("HID: uclogic: Extract tablet parameter discovery int= o a module") Addresses-Coverity-ID: 1443827 ("Null pointer dereference") Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/hid/hid-uclogic-params.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-par= ams.c index 0afd368115891..1f3ea6c93ef44 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -65,7 +65,7 @@ static int uclogic_params_get_str_desc(__u8 **pbuf, struc= t hid_device *hdev, __u8 idx, size_t len) { int rc; - struct usb_device *udev =3D hid_to_usb_dev(hdev); + struct usb_device *udev; __u8 *buf =3D NULL; =20 /* Check arguments */ @@ -74,6 +74,8 @@ static int uclogic_params_get_str_desc(__u8 **pbuf, struc= t hid_device *hdev, goto cleanup; } =20 + udev =3D hid_to_usb_dev(hdev); + buf =3D kmalloc(len, GFP_KERNEL); if (buf =3D=3D NULL) { rc =3D -ENOMEM; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3B62C4167E for ; Mon, 24 Jan 2022 20:29:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382504AbiAXUZu (ORCPT ); Mon, 24 Jan 2022 15:25:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352283AbiAXUDd (ORCPT ); Mon, 24 Jan 2022 15:03:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5B66C02B87E; Mon, 24 Jan 2022 11:29:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 52DC16148B; Mon, 24 Jan 2022 19:29:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A3DEC340E5; Mon, 24 Jan 2022 19:29:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052589; bh=Qyt+cjc79L+3v4LC0sQJwm5VCbZP3ks6OIZ5fJEIcQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qm9sQoGNAA+qyElgYPwKy8qjLWpbOvdCtssHS7sIticpifSfhMzmwRQy/+bNi5q9m Trrsz1jkpTm/atdi2QP2GRFIdsZkdAry+S1gwWUZLPGY3j//xmdstVolP0SGcXChUo 2LVFKwVT3brQrwNhRKA5fkyKtYWoMKAuLQeSzQ+E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Jiri Kosina , Sasha Levin Subject: [PATCH 5.4 110/320] HID: hid-uclogic-params: Invalid parameter check in uclogic_params_huion_init Date: Mon, 24 Jan 2022 19:41:34 +0100 Message-Id: <20220124183957.463099825@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Jos=C3=A9 Exp=C3=B3sito [ Upstream commit ff6b548afe4d9d1ff3a0f6ef79e8cbca25d8f905 ] The function performs a check on its input parameters, however, the hdev parameter is used before the check. Initialize the stack variables after checking the input parameters to avoid a possible NULL pointer dereference. Fixes: 9614219e9310e ("HID: uclogic: Extract tablet parameter discovery int= o a module") Addresses-Coverity-ID: 1443804 ("Null pointer dereference") Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/hid/hid-uclogic-params.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-par= ams.c index 1f3ea6c93ef44..0fdac91c5f510 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -707,9 +707,9 @@ static int uclogic_params_huion_init(struct uclogic_par= ams *params, struct hid_device *hdev) { int rc; - struct usb_device *udev =3D hid_to_usb_dev(hdev); - struct usb_interface *iface =3D to_usb_interface(hdev->dev.parent); - __u8 bInterfaceNumber =3D iface->cur_altsetting->desc.bInterfaceNumber; + struct usb_device *udev; + struct usb_interface *iface; + __u8 bInterfaceNumber; bool found; /* The resulting parameters (noop) */ struct uclogic_params p =3D {0, }; @@ -723,6 +723,10 @@ static int uclogic_params_huion_init(struct uclogic_pa= rams *params, goto cleanup; } =20 + udev =3D hid_to_usb_dev(hdev); + iface =3D to_usb_interface(hdev->dev.parent); + bInterfaceNumber =3D iface->cur_altsetting->desc.bInterfaceNumber; + /* If it's not a pen interface */ if (bInterfaceNumber !=3D 0) { /* TODO: Consider marking the interface invalid */ --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEA9BC43219 for ; Mon, 24 Jan 2022 19:38:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354155AbiAXTgH (ORCPT ); Mon, 24 Jan 2022 14:36:07 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57208 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352209AbiAXT3x (ORCPT ); Mon, 24 Jan 2022 14:29:53 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5F3E1614BB; Mon, 24 Jan 2022 19:29:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2019DC340E7; Mon, 24 Jan 2022 19:29:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052592; bh=y4gopLlU9cEaDX+IdBrDk0YyHq4orGkuszg4cJuHrPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iC9z/snKrDgtDIrH7t7hUxIPeIgV2U8ahUVCP89JcnAEKNYngE382iSZNQdH64D3i j7Zjp0NYoXi97dBCbc383JAMYnqsXJ6+NfJuisNL0rxLIwgrWUhWPGrwdVs2r7L5RU SYxmRe6YpJUijhGlpcVc6OPR8Rp42gtlXqDc89NA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Jiri Kosina , Sasha Levin Subject: [PATCH 5.4 111/320] HID: hid-uclogic-params: Invalid parameter check in uclogic_params_frame_init_v1_buttonpad Date: Mon, 24 Jan 2022 19:41:35 +0100 Message-Id: <20220124183957.494825008@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Jos=C3=A9 Exp=C3=B3sito [ Upstream commit aa320fdbbbb482c19100f51461bd0069753ce3d7 ] The function performs a check on the hdev input parameters, however, it is used before the check. Initialize the udev variable after the sanity check to avoid a possible NULL pointer dereference. Fixes: 9614219e9310e ("HID: uclogic: Extract tablet parameter discovery int= o a module") Addresses-Coverity-ID: 1443763 ("Null pointer dereference") Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/hid/hid-uclogic-params.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-par= ams.c index 0fdac91c5f510..191aba9f6b497 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -451,7 +451,7 @@ static int uclogic_params_frame_init_v1_buttonpad( { int rc; bool found =3D false; - struct usb_device *usb_dev =3D hid_to_usb_dev(hdev); + struct usb_device *usb_dev; char *str_buf =3D NULL; const size_t str_len =3D 16; =20 @@ -461,6 +461,8 @@ static int uclogic_params_frame_init_v1_buttonpad( goto cleanup; } =20 + usb_dev =3D hid_to_usb_dev(hdev); + /* * Enable generic button mode */ --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DED9C433FE for ; Mon, 24 Jan 2022 19:37:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354172AbiAXTgJ (ORCPT ); Mon, 24 Jan 2022 14:36:09 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57230 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352248AbiAXT34 (ORCPT ); Mon, 24 Jan 2022 14:29:56 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 766B1614A8; Mon, 24 Jan 2022 19:29:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4ADC1C340E5; Mon, 24 Jan 2022 19:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052595; bh=O/qVZZaNBQiKTU8XF9hX2SxNcvEqCW1/ktGfMh8W1do=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u7t4615pcgK+kytOpfJzkyLgirFBjQDV43Up3KDH74iONvFq8YDNLUzoxzX/oHZQV +Qp5WfdcI0tsgx6uSTcfu8lDswwzVoHyY3DZN5MXz1QEHS6VL34mvWWAeBv47xN7f4 ceJ2KO9t+6B0tGcPm5BlVQjptVwsHicKu0+DhoMc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Suchanek , Sasha Levin Subject: [PATCH 5.4 112/320] debugfs: lockdown: Allow reading debugfs files that are not world readable Date: Mon, 24 Jan 2022 19:41:36 +0100 Message-Id: <20220124183957.523671417@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 358fcf5ddbec4e6706405847d6a666f5933a6c25 ] When the kernel is locked down the kernel allows reading only debugfs files with mode 444. Mode 400 is also valid but is not allowed. Make the 444 into a mask. Fixes: 5496197f9b08 ("debugfs: Restrict debugfs when the kernel is locked d= own") Signed-off-by: Michal Suchanek Link: https://lore.kernel.org/r/20220104170505.10248-1-msuchanek@suse.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/debugfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index a32c5c7dcfd89..da87615ad69a7 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -146,7 +146,7 @@ static int debugfs_locked_down(struct inode *inode, struct file *filp, const struct file_operations *real_fops) { - if ((inode->i_mode & 07777) =3D=3D 0444 && + if ((inode->i_mode & 07777 & ~0444) =3D=3D 0 && !(filp->f_mode & FMODE_WRITE) && !real_fops->unlocked_ioctl && !real_fops->compat_ioctl && --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F9ACC433F5 for ; Mon, 24 Jan 2022 19:44:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343611AbiAXToW (ORCPT ); Mon, 24 Jan 2022 14:44:22 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52872 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352276AbiAXTaD (ORCPT ); Mon, 24 Jan 2022 14:30:03 -0500 Received: from smtp.kernel.org (relay.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 4E699B8122C; Mon, 24 Jan 2022 19:30:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64AF8C340E5; Mon, 24 Jan 2022 19:29:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052599; bh=4S2dYCqoHBKcD8cOK9/6OdcbmPKRa6oX9Z0TpfEVuIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJJm1PsyQxTpVWO9TeY+dabjxnCC6uHIGPQaTLUOWYNsYaJOHUjrkYY7u6L+qbqqh gNkux9HEmEq91nvpyHdvQI1MDG0odBgRLbswctZU3E9um+Cb6xENw+6DlJnJqxS86H sAfYHibQMAf8XBKTlzwfhqJP0KHlUSqkAKmROsPw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maor Dickman , Roi Dayan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.4 113/320] net/mlx5e: Dont block routes with nexthop objects in SW Date: Mon, 24 Jan 2022 19:41:37 +0100 Message-Id: <20220124183957.554448069@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maor Dickman [ Upstream commit 9e72a55a3c9d54b38a704bb7292d984574a81d9d ] Routes with nexthop objects is currently not supported by multipath offload and any attempts to use it is blocked, however this also block adding SW routes with nexthop. Resolve this by returning NOTIFY_DONE instead of an error which will allow = such a route to be created in SW but not offloaded. This fix also solve an issue which block adding such routes on different de= vices due to missing check if the route FIB device is one of multipath devices. Fixes: 6a87afc072c3 ("mlx5: Fail attempts to use routes with nexthop object= s") Signed-off-by: Maor Dickman Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c b/drivers/net= /ethernet/mellanox/mlx5/core/lag_mp.c index bdc7f915d80e3..101667c6b5843 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c @@ -265,10 +265,8 @@ static int mlx5_lag_fib_event(struct notifier_block *n= b, fen_info =3D container_of(info, struct fib_entry_notifier_info, info); fi =3D fen_info->fi; - if (fi->nh) { - NL_SET_ERR_MSG_MOD(info->extack, "IPv4 route with nexthop objects is no= t supported"); - return notifier_from_errno(-EINVAL); - } + if (fi->nh) + return NOTIFY_DONE; fib_dev =3D fib_info_nh(fen_info->fi, 0)->fib_nh_dev; if (fib_dev !=3D ldev->pf[0].netdev && fib_dev !=3D ldev->pf[1].netdev) { --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B397BC433EF for ; Mon, 24 Jan 2022 20:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382593AbiAXUZ5 (ORCPT ); Mon, 24 Jan 2022 15:25:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376711AbiAXUDm (ORCPT ); Mon, 24 Jan 2022 15:03:42 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7002AC02B87F; Mon, 24 Jan 2022 11:30:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 278BBB81235; Mon, 24 Jan 2022 19:30:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B927C340E5; Mon, 24 Jan 2022 19:30:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052604; bh=nc8gMN6FupTObSdJAM/kKjoEdDwv+BPG9AeILVfjHF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SVJYND4NJCtTOSJlHKveAw+MAU2g2oAkz/wtwnCzxxIn04LORxdUyaw4JDPIwnoz9 ENcq51ObiR9B9I/Oy1uCWWyb6XIXl+PrQ8roXV/IYZrpBGeKINgrVWeh6HPENAgYUs Ja7kTEH0CUAfGZv9RjjVcG33ii1oUp59aTmRIhBw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Gal Pressman , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.4 114/320] Revert "net/mlx5e: Block offload of outer header csum for UDP tunnels" Date: Mon, 24 Jan 2022 19:41:38 +0100 Message-Id: <20220124183957.584887635@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Aya Levin [ Upstream commit 64050cdad0983ad8060e33c3f4b5aee2366bcebd ] This reverts commit 6d6727dddc7f93fcc155cb8d0c49c29ae0e71122. Although the NIC doesn't support offload of outer header CSUM, using gso_partial_features allows offloading the tunnel's segmentation. The driver relies on the stack CSUM calculation of the outer header. For this, NETIF_F_GSO_UDP_TUNNEL_CSUM must be a member of the device's features. Fixes: 6d6727dddc7f ("net/mlx5e: Block offload of outer header csum for UDP= tunnels") Signed-off-by: Aya Levin Reviewed-by: Gal Pressman Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/ne= t/ethernet/mellanox/mlx5/core/en_main.c index dea884c94568c..2465165cbea73 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -5053,9 +5053,13 @@ static void mlx5e_build_nic_netdev(struct net_device= *netdev) } =20 if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev)) { - netdev->hw_features |=3D NETIF_F_GSO_UDP_TUNNEL; - netdev->hw_enc_features |=3D NETIF_F_GSO_UDP_TUNNEL; - netdev->vlan_features |=3D NETIF_F_GSO_UDP_TUNNEL; + netdev->hw_features |=3D NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev->hw_enc_features |=3D NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev->gso_partial_features =3D NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev->vlan_features |=3D NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM; } =20 if (mlx5e_tunnel_proto_supported(mdev, IPPROTO_GRE)) { --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68466C46467 for ; Mon, 24 Jan 2022 20:29:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382652AbiAXU0E (ORCPT ); Mon, 24 Jan 2022 15:26:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344220AbiAXUDp (ORCPT ); Mon, 24 Jan 2022 15:03:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63074C02B740; Mon, 24 Jan 2022 11:30:10 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2057BB8122F; Mon, 24 Jan 2022 19:30:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DDD4C340E5; Mon, 24 Jan 2022 19:30:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052607; bh=wMh5zDc0gL+V8vlUgdXNvVyQzuDbs091M1h//hPJaC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QOEnNnjpJw9JAm56pXZzh9Ujz7qGk7vsKCkdkrjrnT1RlO18dFZ7enO9HtZdtz3kl Th4WCq3Y7If0vdKPYRHAQ3pa/SC7uSFftTwybe1bVEJZDUsGCYbE7jRzb4sNFsPQGM xRlvqMa+bNSSHLYrONBklkSzKNysX5MfNKaVyuY8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Moshe Shemesh , Eran Ben Elisha , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.4 115/320] net/mlx5: Set command entry semaphore up once got index free Date: Mon, 24 Jan 2022 19:41:39 +0100 Message-Id: <20220124183957.614213488@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Moshe Shemesh [ Upstream commit 8e715cd613a1e872b9d918e912d90b399785761a ] Avoid a race where command work handler may fail to allocate command entry index, by holding the command semaphore down till command entry index is being freed. Fixes: 410bd754cd73 ("net/mlx5: Add retry mechanism to the command entry in= dex allocation") Signed-off-by: Moshe Shemesh Reviewed-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/et= hernet/mellanox/mlx5/core/cmd.c index bf091a6c0cd2d..cedb102ce8d2f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -147,8 +147,12 @@ static void cmd_ent_put(struct mlx5_cmd_work_ent *ent) if (!refcount_dec_and_test(&ent->refcnt)) return; =20 - if (ent->idx >=3D 0) - cmd_free_index(ent->cmd, ent->idx); + if (ent->idx >=3D 0) { + struct mlx5_cmd *cmd =3D ent->cmd; + + cmd_free_index(cmd, ent->idx); + up(ent->page_queue ? &cmd->pages_sem : &cmd->sem); + } =20 cmd_free_ent(ent); } @@ -1577,8 +1581,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_de= v *dev, u64 vec, bool force vector =3D vec & 0xffffffff; for (i =3D 0; i < (1 << cmd->log_sz); i++) { if (test_bit(i, &vector)) { - struct semaphore *sem; - ent =3D cmd->ent_arr[i]; =20 /* if we already completed the command, ignore it */ @@ -1601,10 +1603,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_d= ev *dev, u64 vec, bool force dev->state =3D=3D MLX5_DEVICE_STATE_INTERNAL_ERROR) cmd_ent_put(ent); =20 - if (ent->page_queue) - sem =3D &cmd->pages_sem; - else - sem =3D &cmd->sem; ent->ts2 =3D ktime_get_ns(); memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); dump_command(dev, ent, 0); @@ -1658,7 +1656,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_de= v *dev, u64 vec, bool force */ complete(&ent->done); } - up(sem); } } } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BA2DC433FE for ; Mon, 24 Jan 2022 20:22:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344485AbiAXUWL (ORCPT ); Mon, 24 Jan 2022 15:22:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352005AbiAXUDp (ORCPT ); Mon, 24 Jan 2022 15:03:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5ADEC02B741; Mon, 24 Jan 2022 11:30:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 84DBC6141C; Mon, 24 Jan 2022 19:30:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ED92C340E5; Mon, 24 Jan 2022 19:30:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052611; bh=c6i7yFigN2t01KG7YjhkDdo+ReBZxnz7ZJ4IMHqvdyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WlucolxbTUIGmxqvTsiI2/n/u5MsQJeA08Ts0zfOmmBhq8kFwGCj/yF+F7SNSssOh uov4HuhI8rOG/CzqU1cWG0KNcYH2OyJZb8lwqi2OoKTanXcWp8DYYUettqXHBBQ4VA 18cTP+sglKfBLGfRzK6uB3u1bRbODH4SwFUctbQc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mark Brown , Sasha Levin Subject: [PATCH 5.4 116/320] spi: spi-meson-spifc: Add missing pm_runtime_disable() in meson_spifc_probe Date: Mon, 24 Jan 2022 19:41:40 +0100 Message-Id: <20220124183957.644099719@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 69c1b87516e327a60b39f96b778fe683259408bf ] If the probe fails, we should use pm_runtime_disable() to balance pm_runtime_enable(). Add missing pm_runtime_disable() for meson_spifc_probe. Fixes: c3e4bc5434d2 ("spi: meson: Add support for Amlogic Meson SPIFC") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220107075424.7774-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/spi/spi-meson-spifc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi-meson-spifc.c b/drivers/spi/spi-meson-spifc.c index c7b0399802913..cae934464f3dd 100644 --- a/drivers/spi/spi-meson-spifc.c +++ b/drivers/spi/spi-meson-spifc.c @@ -349,6 +349,7 @@ static int meson_spifc_probe(struct platform_device *pd= ev) return 0; out_clk: clk_disable_unprepare(spifc->clk); + pm_runtime_disable(spifc->dev); out_err: spi_master_put(master); return ret; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC2C7C433EF for ; Mon, 24 Jan 2022 19:37:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354196AbiAXTgL (ORCPT ); Mon, 24 Jan 2022 14:36:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:53044 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352382AbiAXTaQ (ORCPT ); Mon, 24 Jan 2022 14:30:16 -0500 Received: from smtp.kernel.org (relay.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 42514B8122F; Mon, 24 Jan 2022 19:30:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65B42C340E7; Mon, 24 Jan 2022 19:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052614; bh=PFeTHSrNpzz1bgPoR2Teyu2aWXU6Hm+6TN+LgWwf3lk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jrBITipzEvpw0KcRjL6d/VnQnoa+TEjGC4j/XmH/NNCmhOh0BBReI7nJqv/AO8PYc 9jnpxB8iZ2ahVe29VVAG7X0wfqD9goAZrhmcMgeZzzOA0n7raMJoGoSlYtUKs0sljM bkO5qUhcSBhJw+SyIyBi8gozg7TbLARYGsMb0wvU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Jun , Jarkko Sakkinen , Sasha Levin Subject: [PATCH 5.4 117/320] tpm: add request_locality before write TPM_INT_ENABLE Date: Mon, 24 Jan 2022 19:41:41 +0100 Message-Id: <20220124183957.676049670@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chen Jun [ Upstream commit 0ef333f5ba7f24f5d8478425c163d3097f1c7afd ] Locality is not appropriately requested before writing the int mask. Add the missing boilerplate. Fixes: e6aef069b6e9 ("tpm_tis: convert to using locality callbacks") Signed-off-by: Chen Jun Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/char/tpm/tpm_tis_core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_cor= e.c index 2fe26ec03552b..70f7859942287 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -877,7 +877,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_t= is_data *priv, int irq, intmask |=3D TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; intmask &=3D ~TPM_GLOBAL_INT_ENABLE; + + rc =3D request_locality(chip, 0); + if (rc < 0) { + rc =3D -ENODEV; + goto out_err; + } + tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask); + release_locality(chip, 0); =20 rc =3D tpm_chip_start(chip); if (rc) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F0E1C4332F for ; Mon, 24 Jan 2022 20:28:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382630AbiAXU0A (ORCPT ); Mon, 24 Jan 2022 15:26:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352002AbiAXUDp (ORCPT ); Mon, 24 Jan 2022 15:03:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6307C02B742; Mon, 24 Jan 2022 11:30:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 651A260917; Mon, 24 Jan 2022 19:30:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A002C340E5; Mon, 24 Jan 2022 19:30:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052616; bh=/lpNPmWX5dfLrKHdBpEYNnkutGKFPRmgQYn9v2IX4JM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VWzI3hiIshJ9UmK0pIE8QXoMttJDuNtPd6oJlef0mOHKNb1K5kqBb+CkGIje8iH0q e5/ODueCEwdjn4qqszBLK9kQF7IcUmN3AwSZLrftlhNUmM9F36vp72s9f478J1/8Vm KbMD4LgvBSKZKUK8u3jKQriDTriN2L5Os5BfnPVo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kurt Van Dijck , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.4 118/320] can: softing: softing_startstop(): fix set but not used variable warning Date: Mon, 24 Jan 2022 19:41:42 +0100 Message-Id: <20220124183957.707029762@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 370d988cc529598ebaec6487d4f84c2115dc696b ] In the function softing_startstop() the variable error_reporting is assigned but not used. The code that uses this variable is commented out. Its stated that the functionality is not finally verified. To fix the warning: | drivers/net/can/softing/softing_fw.c:424:9: error: variable 'error_report= ing' set but not used [-Werror,-Wunused-but-set-variable] remove the comment, activate the code, but add a "0 &&" to the if expression and rely on the optimizer rather than the preprocessor to remove the code. Link: https://lore.kernel.org/all/20220109103126.1872833-1-mkl@pengutronix.= de Fixes: 03fd3cf5a179 ("can: add driver for Softing card") Cc: Kurt Van Dijck Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/can/softing/softing_fw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/can/softing/softing_fw.c b/drivers/net/can/softing= /softing_fw.c index 8f44fdd8804bf..1c2afa17c26d1 100644 --- a/drivers/net/can/softing/softing_fw.c +++ b/drivers/net/can/softing/softing_fw.c @@ -565,18 +565,19 @@ int softing_startstop(struct net_device *dev, int up) if (ret < 0) goto failed; } - /* enable_error_frame */ - /* + + /* enable_error_frame + * * Error reporting is switched off at the moment since * the receiving of them is not yet 100% verified * This should be enabled sooner or later - * - if (error_reporting) { + */ + if (0 && error_reporting) { ret =3D softing_fct_cmd(card, 51, "enable_error_frame"); if (ret < 0) goto failed; } - */ + /* initialize interface */ iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 2]); iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 4]); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33FB8C433F5 for ; Mon, 24 Jan 2022 20:22:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233709AbiAXUWQ (ORCPT ); Mon, 24 Jan 2022 15:22:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353729AbiAXUDq (ORCPT ); Mon, 24 Jan 2022 15:03:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A915BC02B743; Mon, 24 Jan 2022 11:30:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4932460917; Mon, 24 Jan 2022 19:30:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C659C340E7; Mon, 24 Jan 2022 19:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052619; bh=n24qRYqs69SLP+bZsZjrTUPpasACZLw6mwuMP9L7Yno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sehUvhyNmnJBRAuiD3MvP3HlrE2MViKpjG+v8LdS0MvBP272xuI08X1zD4T1xsWrk EEu8n9GFVcHG9UtRfEb2iyTE8CbJR/v1QglWVaT82kWivMrgnEGniCi+xlIkV2JNWR N76xYKlpjKXmA1B5QYGskwV/5A/VfmJCZvTTuCuM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.4 119/320] can: xilinx_can: xcan_probe(): check for error irq Date: Mon, 24 Jan 2022 19:41:43 +0100 Message-Id: <20220124183957.736043608@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit c6564c13dae25cd7f8e1de5127b4da4500ee5844 ] For the possible failure of the platform_get_irq(), the returned irq could be error number and will finally cause the failure of the request_irq(). Consider that platform_get_irq() can now in certain cases return -EPROBE_DEFER, and the consequences of letting request_irq() effectively convert that into -EINVAL, even at probe time rather than later on. So it might be better to check just now. Fixes: b1201e44f50b ("can: xilinx CAN controller support") Link: https://lore.kernel.org/all/20211224021324.1447494-1-jiasheng@iscas.a= c.cn Signed-off-by: Jiasheng Jiang Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/can/xilinx_can.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 0de39ebb35662..008d3d492bd1c 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -1753,7 +1753,12 @@ static int xcan_probe(struct platform_device *pdev) spin_lock_init(&priv->tx_lock); =20 /* Get IRQ for the device */ - ndev->irq =3D platform_get_irq(pdev, 0); + ret =3D platform_get_irq(pdev, 0); + if (ret < 0) + goto err_free; + + ndev->irq =3D ret; + ndev->flags |=3D IFF_ECHO; /* We support local echo */ =20 platform_set_drvdata(pdev, ndev); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1595C433F5 for ; Mon, 24 Jan 2022 19:37:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354230AbiAXTgP (ORCPT ); Mon, 24 Jan 2022 14:36:15 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57524 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352416AbiAXTaX (ORCPT ); Mon, 24 Jan 2022 14:30:23 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 541336141C; Mon, 24 Jan 2022 19:30:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FB22C340E5; Mon, 24 Jan 2022 19:30:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052622; bh=g6pSpn2i0X05d9/e/pvWbJQ995pdOEPCyDaWB64n2Dw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XlcS/rNx5fPFfurIxYotnFNZ9SMPOxivxLk/3b/QdqDs34kSG4qgCqRspnH8RG1v+ b/LO7kCyyTNoKtI7RSpHoQqmWDW/OoL6P+f3RE7XSoyW1keqPDqi/5JogGHd08Y63U pZdXoU4IgUUJCqm7iwRdTDEtosRjnjJXQUCaeORc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , "Matthew Wilcox (Oracle)" , Dominik Brodowski , Sasha Levin Subject: [PATCH 5.4 120/320] pcmcia: fix setting of kthread task states Date: Mon, 24 Jan 2022 19:41:44 +0100 Message-Id: <20220124183957.767107188@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dominik Brodowski [ Upstream commit fbb3485f1f931102d8ba606f1c28123f5b48afa3 ] We need to set TASK_INTERRUPTIBLE before calling kthread_should_stop(). Otherwise, kthread_stop() might see that the pccardd thread is still in TASK_RUNNING state and fail to wake it up. Additionally, we only need to set the state back to TASK_RUNNING if kthread_should_stop() breaks the loop. Cc: Greg Kroah-Hartman Reported-by: Al Viro Reviewed-by: Matthew Wilcox (Oracle) Fixes: d3046ba809ce ("pcmcia: fix a boot time warning in pcmcia cs code") Signed-off-by: Dominik Brodowski Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/pcmcia/cs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index e211e2619680c..f70197154a362 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -666,18 +666,16 @@ static int pccardd(void *__skt) if (events || sysfs_events) continue; =20 + set_current_state(TASK_INTERRUPTIBLE); if (kthread_should_stop()) break; =20 - set_current_state(TASK_INTERRUPTIBLE); - schedule(); =20 - /* make sure we are running */ - __set_current_state(TASK_RUNNING); - try_to_freeze(); } + /* make sure we are running before we exit */ + __set_current_state(TASK_RUNNING); =20 /* shut down socket, if a device is still present */ if (skt->state & SOCKET_PRESENT) { --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2908EC4332F for ; Mon, 24 Jan 2022 20:22:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381421AbiAXUWl (ORCPT ); Mon, 24 Jan 2022 15:22:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359502AbiAXUEB (ORCPT ); Mon, 24 Jan 2022 15:04:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB183C02B745; Mon, 24 Jan 2022 11:30:26 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 78651612A5; Mon, 24 Jan 2022 19:30:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 270B9C340E5; Mon, 24 Jan 2022 19:30:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052625; bh=Otfz0U8maTLEn+Irs0y44lE82ilMaXIVy8OqHKRQp7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x8j55t85zem42R5ZQP7MP6I84aIQmNy7oLgvmPMN6MRVLjLiBri5feAnPtB2IvkAe LK7D9VUjaiygkN8TG0SJFbL23hI0XyDW16WsL/SlluSD8K88sR+79QzbrN9U3O1p+Y SjmS9z9Qodpc84YgBKZBRblvfA2lfzD3J1u4Yye8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Arnd Bergmann , Jakub Kicinski , Sasha Levin , syzbot+003c0a286b9af5412510@syzkaller.appspotmail.com Subject: [PATCH 5.4 121/320] net: mcs7830: handle usb read errors properly Date: Mon, 24 Jan 2022 19:41:45 +0100 Message-Id: <20220124183957.797813600@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 d668769eb9c52b150753f1653f7f5a0aeb8239d2 ] Syzbot reported uninit value in mcs7830_bind(). The problem was in missing validation check for bytes read via usbnet_read_cmd(). usbnet_read_cmd() internally calls usb_control_msg(), that returns number of bytes read. Code should validate that requested number of bytes was actually read. So, this patch adds missing size validation check inside mcs7830_get_reg() to prevent uninit value bugs Reported-and-tested-by: syzbot+003c0a286b9af5412510@syzkaller.appspotmail.c= om Fixes: 2a36d7083438 ("USB: driver for mcs7830 (aka DeLOCK) USB ethernet ada= pter") Signed-off-by: Pavel Skripkin Reviewed-by: Arnd Bergmann Link: https://lore.kernel.org/r/20220106225716.7425-1-paskripkin@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/usb/mcs7830.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c index 09bfa6a4dfbc1..7e40e2e2f3723 100644 --- a/drivers/net/usb/mcs7830.c +++ b/drivers/net/usb/mcs7830.c @@ -108,8 +108,16 @@ static const char driver_name[] =3D "MOSCHIP usb-ether= net driver"; =20 static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *= data) { - return usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, - 0x0000, index, data, size); + int ret; + + ret =3D usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, + 0x0000, index, data, size); + if (ret < 0) + return ret; + else if (ret < size) + return -ENODATA; + + return ret; } =20 static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, const = void *data) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D7E6C433F5 for ; Mon, 24 Jan 2022 20:28:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382824AbiAXU0V (ORCPT ); Mon, 24 Jan 2022 15:26:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376449AbiAXUEB (ORCPT ); Mon, 24 Jan 2022 15:04:01 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57117C02B746; Mon, 24 Jan 2022 11:30:31 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 20122B8121B; Mon, 24 Jan 2022 19:30:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C86EC340E5; Mon, 24 Jan 2022 19:30:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052628; bh=vqngZsueMLG4oC2+ytBbZp2PDn5MOvaO/WQkUAEK5qM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C96JYqPNzUJZEOUMbWOZH7U7AMkKjf2JO+qi+tKbLNN13U8ykvyn+xhSJ+aTQ/get kzImV1qXn8tBbIZZIlU66v3GOI1nqFcEdgKq7LnlJPNMpzOkE7YXoFYKTGQjhBIHzw ypub8CG1tE+qNbxBbPIqJPnkzHN+uE8eqMI8McbY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Czerner , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.4 122/320] ext4: avoid trim error on fs with small groups Date: Mon, 24 Jan 2022 19:41:46 +0100 Message-Id: <20220124183957.835668821@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara [ Upstream commit 173b6e383d2a204c9921ffc1eca3b87aa2106c33 ] A user reported FITRIM ioctl failing for him on ext4 on some devices without apparent reason. After some debugging we've found out that these devices (being LVM volumes) report rather large discard granularity of 42MB and the filesystem had 1k blocksize and thus group size of 8MB. Because ext4 FITRIM implementation puts discard granularity into minlen, ext4_trim_fs() declared the trim request as invalid. However just silently doing nothing seems to be a more appropriate reaction to such combination of parameters since user did not specify anything wrong. CC: Lukas Czerner Fixes: 5c2ed62fd447 ("ext4: Adjust minlen with discard_granularity in the F= ITRIM ioctl") Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20211112152202.26614-1-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/ext4/ioctl.c | 2 -- fs/ext4/mballoc.c | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index ba13fbb443d58..9fa20f9ba52b5 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -1120,8 +1120,6 @@ resizefs_out: sizeof(range))) return -EFAULT; =20 - range.minlen =3D max((unsigned int)range.minlen, - q->limits.discard_granularity); ret =3D ext4_trim_fs(sb, &range); if (ret < 0) return ret; diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index b67ea979f0cf7..0307702d114db 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -5270,6 +5270,7 @@ out: */ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) { + struct request_queue *q =3D bdev_get_queue(sb->s_bdev); struct ext4_group_info *grp; ext4_group_t group, first_group, last_group; ext4_grpblk_t cnt =3D 0, first_cluster, last_cluster; @@ -5288,6 +5289,13 @@ int ext4_trim_fs(struct super_block *sb, struct fstr= im_range *range) start >=3D max_blks || range->len < sb->s_blocksize) return -EINVAL; + /* No point to try to trim less than discard granularity */ + if (range->minlen < q->limits.discard_granularity) { + minlen =3D EXT4_NUM_B2C(EXT4_SB(sb), + q->limits.discard_granularity >> sb->s_blocksize_bits); + if (minlen > EXT4_CLUSTERS_PER_GROUP(sb)) + goto out; + } if (end >=3D max_blks) end =3D max_blks - 1; if (end <=3D first_data_blk) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A57F7C433EF for ; Mon, 24 Jan 2022 20:23:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345913AbiAXUXT (ORCPT ); Mon, 24 Jan 2022 15:23:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376820AbiAXUEF (ORCPT ); Mon, 24 Jan 2022 15:04:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2323BC061A10; Mon, 24 Jan 2022 11:30:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E1B24B81235; Mon, 24 Jan 2022 19:30:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24DEFC340E7; Mon, 24 Jan 2022 19:30:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052631; bh=cWI8ojefn/SNJygUfmetwTuVORwXnr4IbGXVnLFJoK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WIkeqvbf316IwFXG60kYA6rFetUoXqWRBXBX6Wv97nNKqoC9jYcdqN80AF+KZ3qjr I/VILEyRKaZO0u2EI00EMrk+7vuxx7pNvmn/aCHhmhzEbfwN9O9NDTJlH7CvVvNJ72 935BvgBOZC1V2+ImuL0Db69W5bOGPFh02yCeeG98= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 5.4 123/320] ALSA: jack: Add missing rwsem around snd_ctl_remove() calls Date: Mon, 24 Jan 2022 19:41:47 +0100 Message-Id: <20220124183957.867945420@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit 06764dc931848c3a9bc01a63bbf76a605408bb54 ] snd_ctl_remove() has to be called with card->controls_rwsem held (when called after the card instantiation). This patch add the missing rwsem calls around it. Fixes: 9058cbe1eed2 ("ALSA: jack: implement kctl creating for jack devices") Link: https://lore.kernel.org/r/20211116071314.15065-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- sound/core/jack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/core/jack.c b/sound/core/jack.c index 8b209750c7a9c..b00ae6f39f054 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -54,10 +54,13 @@ static int snd_jack_dev_free(struct snd_device *device) struct snd_card *card =3D device->card; struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl; =20 + down_write(&card->controls_rwsem); list_for_each_entry_safe(jack_kctl, tmp_jack_kctl, &jack->kctl_list, list= ) { list_del_init(&jack_kctl->list); snd_ctl_remove(card, jack_kctl->kctl); } + up_write(&card->controls_rwsem); + if (jack->private_free) jack->private_free(jack); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B5CBC43219 for ; Mon, 24 Jan 2022 20:29:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383723AbiAXU1k (ORCPT ); Mon, 24 Jan 2022 15:27:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377239AbiAXUFL (ORCPT ); Mon, 24 Jan 2022 15:05:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F865C061A11; Mon, 24 Jan 2022 11:30:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DD69AB8121A; Mon, 24 Jan 2022 19:30:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CBCDC340E5; Mon, 24 Jan 2022 19:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052637; bh=bI71+dy3SjHsHKJSLG3Irk1aXpUx+GZcgDpdDh66Suk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QEJESrdDd5ZgIwu+XX32/dUPnTwYI76YaubPZqEZEeROW5gaQ89YsON9ImTjsYdjY U0YW6pxQEOF+L0eBRDmctQoR2qx0lqhFtOcYEhQnXSPFQn82o1xGuAUeFXGtDzslbN nNkg9TuftotPFdcoH3ApCXPDjgwHW17ooPRcQofQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 5.4 124/320] ALSA: PCM: Add missing rwsem around snd_ctl_remove() calls Date: Mon, 24 Jan 2022 19:41:48 +0100 Message-Id: <20220124183957.897720160@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit 5471e9762e1af4b7df057a96bfd46cc250979b88 ] snd_ctl_remove() has to be called with card->controls_rwsem held (when called after the card instantiation). This patch add the missing rwsem calls around it. Fixes: a8ff48cb7083 ("ALSA: pcm: Free chmap at PCM free callback, too") Link: https://lore.kernel.org/r/20211116071314.15065-2-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- sound/core/pcm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 9a72d641743d9..f8ce961c28d6e 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -810,7 +810,11 @@ EXPORT_SYMBOL(snd_pcm_new_internal); static void free_chmap(struct snd_pcm_str *pstr) { if (pstr->chmap_kctl) { - snd_ctl_remove(pstr->pcm->card, pstr->chmap_kctl); + struct snd_card *card =3D pstr->pcm->card; + + down_write(&card->controls_rwsem); + snd_ctl_remove(card, pstr->chmap_kctl); + up_write(&card->controls_rwsem); pstr->chmap_kctl =3D NULL; } } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6609CC4332F for ; Mon, 24 Jan 2022 20:28:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381933AbiAXUY4 (ORCPT ); Mon, 24 Jan 2022 15:24:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377240AbiAXUFL (ORCPT ); Mon, 24 Jan 2022 15:05:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C3B2C08E803; Mon, 24 Jan 2022 11:30:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D835BB8121B; Mon, 24 Jan 2022 19:30:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14A99C340E5; Mon, 24 Jan 2022 19:30:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052640; bh=1hDgkUT07j19aBXT2Go+t8wv9L8LkMKR1sBjhqc3N+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BwMcz/yoYwUWyH328nkwD+ufLwE/mpI/7hhweH8Yyai+8r5//Guhzixq5sk6FdEwN 7Hl5v8a2XBj9EzF68Y0Sj0cp5FMcFIXE5rM6FscU9ifA8gw0rZAUdMt9Enr+4gRaZ9 wL3TppVgR/vA7VEfe6/FQgjbUBvpw1vUmNjUt1kw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 5.4 125/320] ALSA: hda: Add missing rwsem around snd_ctl_remove() calls Date: Mon, 24 Jan 2022 19:41:49 +0100 Message-Id: <20220124183957.929170787@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit 80bd64af75b4bb11c0329bc66c35da2ddfb66d88 ] snd_ctl_remove() has to be called with card->controls_rwsem held (when called after the card instantiation). This patch add the missing rwsem calls around it. Fixes: d13bd412dce2 ("ALSA: hda - Manage kcontrol lists") Link: https://lore.kernel.org/r/20211116071314.15065-3-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- sound/pci/hda/hda_codec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 326f95ce5ceb1..c8847de8388f0 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1721,8 +1721,11 @@ void snd_hda_ctls_clear(struct hda_codec *codec) { int i; struct hda_nid_item *items =3D codec->mixers.list; + + down_write(&codec->card->controls_rwsem); for (i =3D 0; i < codec->mixers.used; i++) snd_ctl_remove(codec->card, items[i].kctl); + up_write(&codec->card->controls_rwsem); snd_array_free(&codec->mixers); snd_array_free(&codec->nids); } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98532C4332F for ; Mon, 24 Jan 2022 19:37:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354288AbiAXTg1 (ORCPT ); Mon, 24 Jan 2022 14:36:27 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57714 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352589AbiAXTao (ORCPT ); Mon, 24 Jan 2022 14:30:44 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 23E7661488; Mon, 24 Jan 2022 19:30:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04637C340E5; Mon, 24 Jan 2022 19:30:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052643; bh=04ATbOZ0gpjTv7LO1aetEmk2zJZK8LUVag571LjjgUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BVS88otQ4+UCNxC+ukZU8I/bJaO2xvNmmlrFr/j7EBShCXcVJ/Czp1jUme1L73sTH 7lRReRMIdMnumsXBmN9Cj4IGJiKbPM9+xuBdBrAjGVWoQqDte1pjP1Ee5Y9iwQZZnC hTUmeUEJ0NEI0XPKeeIOl+KZ6+cgn/cCYpDs31Z4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kamal Heib , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.4 126/320] RDMA/hns: Validate the pkey index Date: Mon, 24 Jan 2022 19:41:50 +0100 Message-Id: <20220124183957.961295397@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kamal Heib [ Upstream commit 2a67fcfa0db6b4075515bd23497750849b88850f ] Before query pkey, make sure that the queried index is valid. Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver") Link: https://lore.kernel.org/r/20211117145954.123893-1-kamalheib1@gmail.com Signed-off-by: Kamal Heib Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/infiniband/hw/hns/hns_roce_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband= /hw/hns/hns_roce_main.c index f23a341400c06..a360e214deaa8 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -279,6 +279,9 @@ static enum rdma_link_layer hns_roce_get_link_layer(str= uct ib_device *device, static int hns_roce_query_pkey(struct ib_device *ib_dev, u8 port, u16 inde= x, u16 *pkey) { + if (index > 0) + return -EINVAL; + *pkey =3D PKEY_ID; =20 return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A35C8C4167D for ; Mon, 24 Jan 2022 20:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382218AbiAXUZS (ORCPT ); Mon, 24 Jan 2022 15:25:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377245AbiAXUFL (ORCPT ); Mon, 24 Jan 2022 15:05:11 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89541C061A78; Mon, 24 Jan 2022 11:30:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 27C3861482; Mon, 24 Jan 2022 19:30:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07480C340E5; Mon, 24 Jan 2022 19:30:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052646; bh=1IaBwYLYhvYLRKyD+aZ7MbTyG3hN7jEVS8Rz/XY4sGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ml/tPusV9t6ePVe2thSMjTxeJLchq/GJHg9OkJPdSsuqDZp1xgv1xrYPxJaWiHT9n qL5wRcxsJDGEQGLXC4sMDRYxsS47OFs7h4P1CBS0V3ZkCdv1G8ABmp0Sjm+83mycZ8 jZJvrh2HStxnDL/KGHM+EfJQKM3d3zUH7sg0UQRE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Ford , Fabio Estevam , Abel Vesa , Sasha Levin Subject: [PATCH 5.4 127/320] clk: imx8mn: Fix imx8mn_clko1_sels Date: Mon, 24 Jan 2022 19:41:51 +0100 Message-Id: <20220124183957.992732644@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adam Ford [ Upstream commit 570727e9acfac1c2330a01dd5e1272e9c3acec08 ] When attempting to use sys_pll1_80m as the parent for clko1, the system hangs. This is due to the fact that the source select for sys_pll1_80m was incorrectly pointing to m7_alt_pll_clk, which doesn't yet exist. According to Rev 3 of the TRM, The imx8mn_clko1_sels also incorrectly references an osc_27m which does not exist, nor does an entry for source select bits 010b. Fix both by inserting a dummy clock into the missing space in the table and renaming the incorrectly name clock with dummy. Fixes: 96d6392b54db ("clk: imx: Add support for i.MX8MN clock driver") Signed-off-by: Adam Ford Reviewed-by: Fabio Estevam Link: https://lore.kernel.org/r/20211117133202.775633-1-aford173@gmail.com Signed-off-by: Abel Vesa Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/clk/imx/clk-imx8mn.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index 58b5acee38306..882b42efd2582 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -358,9 +358,9 @@ static const char * const imx8mn_pdm_sels[] =3D {"osc_2= 4m", "sys_pll2_100m", "audi =20 static const char * const imx8mn_dram_core_sels[] =3D {"dram_pll_out", "dr= am_alt_root", }; =20 -static const char * const imx8mn_clko1_sels[] =3D {"osc_24m", "sys_pll1_80= 0m", "osc_27m", - "sys_pll1_200m", "audio_pll2_out", "vpu_pll", - "sys_pll1_80m", }; +static const char * const imx8mn_clko1_sels[] =3D {"osc_24m", "sys_pll1_80= 0m", "dummy", + "sys_pll1_200m", "audio_pll2_out", "sys_pll2_500m", + "dummy", "sys_pll1_80m", }; static const char * const imx8mn_clko2_sels[] =3D {"osc_24m", "sys_pll2_20= 0m", "sys_pll1_400m", "sys_pll2_166m", "sys_pll3_out", "audio_pll1_out", "video_pll1_out", "osc_32k", }; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85D5CC4167B for ; Mon, 24 Jan 2022 20:28:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382058AbiAXUZJ (ORCPT ); Mon, 24 Jan 2022 15:25:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377244AbiAXUFL (ORCPT ); Mon, 24 Jan 2022 15:05:11 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B849C08E814; Mon, 24 Jan 2022 11:30:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3B0CA60917; Mon, 24 Jan 2022 19:30:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C7EDC340E5; Mon, 24 Jan 2022 19:30:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052649; bh=VNXFk8BJ3Gnx1wh3auxgPrTluzAXvo1QXEFYQZslIsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s+izFP24edvCMHawF7ws5/XV9XdtEVcBEbvmb2TONiM0HiT8zdN2Hjok+OuVEmoO8 mpYDFEKLcjPTyqcAZ6Gndoea49P3whrJpi6FQ1iQqje+iFyhYaVwgVmrgmEzN8xSNM hiAd/UG+qBgj1nu6fwQT0bKhytrUbnf3O0u7Gvso= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peiwei Hu , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 128/320] powerpc/prom_init: Fix improper check of prom_getprop() Date: Mon, 24 Jan 2022 19:41:52 +0100 Message-Id: <20220124183958.031926322@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peiwei Hu [ Upstream commit 869fb7e5aecbc163003f93f36dcc26d0554319f6 ] prom_getprop() can return PROM_ERROR. Binary operator can not identify it. Fixes: 94d2dde738a5 ("[POWERPC] Efika: prune fixups and make them more care= full") Signed-off-by: Peiwei Hu Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/tencent_BA28CC6897B7C95A92EB8C580B5D1858910= 5@qq.com Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/powerpc/kernel/prom_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_ini= t.c index 1b65fb7c0bdaa..7f4e2c031a9ab 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -2919,7 +2919,7 @@ static void __init fixup_device_tree_efika_add_phy(vo= id) =20 /* Check if the phy-handle property exists - bail if it does */ rv =3D prom_getprop(node, "phy-handle", prop, sizeof(prop)); - if (!rv) + if (rv <=3D 0) return; =20 /* --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C233C4321E for ; Mon, 24 Jan 2022 19:38:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354304AbiAXTg2 (ORCPT ); Mon, 24 Jan 2022 14:36:28 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51726 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352660AbiAXTay (ORCPT ); Mon, 24 Jan 2022 14:30:54 -0500 Received: from smtp.kernel.org (relay.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 CB43AB8121C; Mon, 24 Jan 2022 19:30:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02E19C340E5; Mon, 24 Jan 2022 19:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052652; bh=hoGmMt6X0klq0+u7iW/1fCYXghyAHMkMKI5zDTPe7y0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G4wFWjprk37/1bRS6h5UUsFD5/h6dOkI8SZ00dbOt5DilrJpkDOx/tVovUjvxqNuY wFEosXJQH83FlrtM+eohreAn1/1QjTbY+LyjFfAAdcmACGPbvxvm76avDCzNjsKFkn uVHZrCs3IvHZa5BGF7oCZSiTkt+tdYskR107tzUQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Bulwahn , Mark Brown , Sasha Levin Subject: [PATCH 5.4 129/320] ASoC: uniphier: drop selecting non-existing SND_SOC_UNIPHIER_AIO_DMA Date: Mon, 24 Jan 2022 19:41:53 +0100 Message-Id: <20220124183958.062009050@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Bulwahn [ Upstream commit 49f893253ab43566e34332a969324531fea463f6 ] Commit f37fe2f9987b ("ASoC: uniphier: add support for UniPhier AIO common driver") adds configs SND_SOC_UNIPHIER_{LD11,PXS2}, which select the non-existing config SND_SOC_UNIPHIER_AIO_DMA. Hence, ./scripts/checkkconfigsymbols.py warns: SND_SOC_UNIPHIER_AIO_DMA Referencing files: sound/soc/uniphier/Kconfig Probably, there is actually no further config intended to be selected here. So, just drop selecting the non-existing config. Fixes: f37fe2f9987b ("ASoC: uniphier: add support for UniPhier AIO common d= river") Signed-off-by: Lukas Bulwahn Link: https://lore.kernel.org/r/20211125095158.8394-2-lukas.bulwahn@gmail.c= om Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- sound/soc/uniphier/Kconfig | 2 -- 1 file changed, 2 deletions(-) diff --git a/sound/soc/uniphier/Kconfig b/sound/soc/uniphier/Kconfig index aa3592ee1358b..ddfa6424c656b 100644 --- a/sound/soc/uniphier/Kconfig +++ b/sound/soc/uniphier/Kconfig @@ -23,7 +23,6 @@ config SND_SOC_UNIPHIER_LD11 tristate "UniPhier LD11/LD20 Device Driver" depends on SND_SOC_UNIPHIER select SND_SOC_UNIPHIER_AIO - select SND_SOC_UNIPHIER_AIO_DMA help This adds ASoC driver for Socionext UniPhier LD11/LD20 input and output that can be used with other codecs. @@ -34,7 +33,6 @@ config SND_SOC_UNIPHIER_PXS2 tristate "UniPhier PXs2 Device Driver" depends on SND_SOC_UNIPHIER select SND_SOC_UNIPHIER_AIO - select SND_SOC_UNIPHIER_AIO_DMA help This adds ASoC driver for Socionext UniPhier PXs2 input and output that can be used with other codecs. --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67041C433F5 for ; Mon, 24 Jan 2022 19:38:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349196AbiAXTio (ORCPT ); Mon, 24 Jan 2022 14:38:44 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60474 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347273AbiAXTdG (ORCPT ); Mon, 24 Jan 2022 14:33:06 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 065266151C; Mon, 24 Jan 2022 19:33:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6EBDC340E5; Mon, 24 Jan 2022 19:33:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052785; bh=0G+0pkzy4Jb0WR+hX1OlBk7gQoBn53HGLdOIa5eFiBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qzU3U8Wfwf2NTfhnRiMnHO/gCYjlI8CNDWTRA5qKnFDzlSZldlwcBwKsze/iM/iPL EY8IZhFqWoYnbjQHjHv3Rhw0F8svCktPmru5kn/GaBZtqqQ2+73LfY5h3q28t5ElVF DLa7QzkSFsusQf/a2BJXKXdb9Sgxz23Drcfv2lsw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bixuan Cui , Takashi Iwai , Sasha Levin Subject: [PATCH 5.4 130/320] ALSA: oss: fix compile error when OSS_DEBUG is enabled Date: Mon, 24 Jan 2022 19:41:54 +0100 Message-Id: <20220124183958.094301410@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bixuan Cui [ Upstream commit 8e7daf318d97f25e18b2fc7eb5909e34cd903575 ] Fix compile error when OSS_DEBUG is enabled: sound/core/oss/pcm_oss.c: In function 'snd_pcm_oss_set_trigger': sound/core/oss/pcm_oss.c:2055:10: error: 'substream' undeclared (first use in this function); did you mean 'csubstream'? pcm_dbg(substream->pcm, "pcm_oss: trigger =3D 0x%x\n", trigger); ^ Fixes: 61efcee8608c ("ALSA: oss: Use standard printk helpers") Signed-off-by: Bixuan Cui Link: https://lore.kernel.org/r/1638349134-110369-1-git-send-email-cuibixua= n@linux.alibaba.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- sound/core/oss/pcm_oss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 9e31f4bd43826..841c0a12cc929 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -2055,7 +2055,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss= _file *pcm_oss_file, int tr int err, cmd; =20 #ifdef OSS_DEBUG - pcm_dbg(substream->pcm, "pcm_oss: trigger =3D 0x%x\n", trigger); + pr_debug("pcm_oss: trigger =3D 0x%x\n", trigger); #endif =09 psubstream =3D pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 759FDC43219 for ; Mon, 24 Jan 2022 20:28:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381952AbiAXUY6 (ORCPT ); Mon, 24 Jan 2022 15:24:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377242AbiAXUFL (ORCPT ); Mon, 24 Jan 2022 15:05:11 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 942EAC061361; Mon, 24 Jan 2022 11:31:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 35645614BE; Mon, 24 Jan 2022 19:31:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01CCFC340E5; Mon, 24 Jan 2022 19:31:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052676; bh=0KD1eiKFQZ+15lvlwGjcpA2CZ9608oocxiXbhgHw+rM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vv/cFJ0Co0+aD+XeOLEpIF0qYJEDS6P2V5xFB6HSKliPvfkxhekNRNWhAnaxt/I+d uU1JNqtY81HMxT+WRgiE5sHcO08XZinZ2dKuaSMSjG1Z5CRUIk4bpa2gvYiivHjJCY e0qD17fWqHIrlIyDtDoNkiBcFKLX9QcP4N971bQs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Sasha Levin Subject: [PATCH 5.4 131/320] char/mwave: Adjust io port register size Date: Mon, 24 Jan 2022 19:41:55 +0100 Message-Id: <20220124183958.124282838@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kees Cook [ Upstream commit f5912cc19acd7c24b2dbf65a6340bf194244f085 ] Using MKWORD() on a byte-sized variable results in OOB read. Expand the size of the reserved area so both MKWORD and MKBYTE continue to work without overflow. Silences this warning on a -Warray-bounds build: drivers/char/mwave/3780i.h:346:22: error: array subscript 'short unsigned i= nt[0]' is partly outside array bounds of 'DSP_ISA_SLAVE_CONTROL[1]' [-Werro= r=3Darray-bounds] 346 | #define MKWORD(var) (*((unsigned short *)(&var))) | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/char/mwave/3780i.h:356:40: note: in definition of macro 'OutWordDsp' 356 | #define OutWordDsp(index,value) outw(value,usDspBaseIO+index) | ^~~~~ drivers/char/mwave/3780i.c:373:41: note: in expansion of macro 'MKWORD' 373 | OutWordDsp(DSP_IsaSlaveControl, MKWORD(rSlaveControl)); | ^~~~~~ drivers/char/mwave/3780i.c:358:31: note: while referencing 'rSlaveControl' 358 | DSP_ISA_SLAVE_CONTROL rSlaveControl; | ^~~~~~~~~~~~~ Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20211203084206.3104326-1-keescook@chromium.= org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/char/mwave/3780i.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/mwave/3780i.h b/drivers/char/mwave/3780i.h index 9ccb6b270b071..95164246afd1a 100644 --- a/drivers/char/mwave/3780i.h +++ b/drivers/char/mwave/3780i.h @@ -68,7 +68,7 @@ typedef struct { unsigned char ClockControl:1; /* RW: Clock control: 0=3Dnormal, 1=3Dstop = 3780i clocks */ unsigned char SoftReset:1; /* RW: Soft reset 0=3Dnormal, 1=3Dsoft reset a= ctive */ unsigned char ConfigMode:1; /* RW: Configuration mode, 0=3Dnormal, 1=3Dco= nfig mode */ - unsigned char Reserved:5; /* 0: Reserved */ + unsigned short Reserved:13; /* 0: Reserved */ } DSP_ISA_SLAVE_CONTROL; =20 =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88499C46467 for ; Mon, 24 Jan 2022 19:37:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354565AbiAXTgq (ORCPT ); Mon, 24 Jan 2022 14:36:46 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57134 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242058AbiAXTbv (ORCPT ); Mon, 24 Jan 2022 14:31:51 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B9840614F0; Mon, 24 Jan 2022 19:31:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95700C340E5; Mon, 24 Jan 2022 19:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052710; bh=rD5AOzkXpRUJUGlmyD4mjgmBS/IZeXJBNqa5eZZZftQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SiFyuThU5MbVToAAB0c6JJLKtr4Aycv/P6T1gx1xFongMIedCGxgFByAcF1Kf5CCa Peg7cPzshqGZTI4+Paj9nl+BpCgIcobKF3OeDN5c+PML9/YjQWrB3V4U3Wb7h80ap+ 95B/W2vgVbYg0s+TNP+v2Dola/9v4nmUOUDPHIEM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Christian Brauner , Todd Kjos , Sasha Levin Subject: [PATCH 5.4 132/320] binder: fix handling of error during copy Date: Mon, 24 Jan 2022 19:41:56 +0100 Message-Id: <20220124183958.155863213@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Todd Kjos [ Upstream commit fe6b1869243f23a485a106c214bcfdc7aa0ed593 ] If a memory copy function fails to copy the whole buffer, a positive integar with the remaining bytes is returned. In binder_translate_fd_array() this can result in an fd being skipped due to the failed copy, but the loop continues processing fds since the early return condition expects a negative integer on error. Fix by returning "ret > 0 ? -EINVAL : ret" to handle this case. Fixes: bb4a2e48d510 ("binder: return errors from buffer copy functions") Suggested-by: Dan Carpenter Acked-by: Christian Brauner Signed-off-by: Todd Kjos Link: https://lore.kernel.org/r/20211130185152.437403-2-tkjos@google.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/android/binder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 0512af0f04646..b9fb2a9269443 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2660,8 +2660,8 @@ static int binder_translate_fd_array(struct binder_fd= _array_object *fda, if (!ret) ret =3D binder_translate_fd(fd, offset, t, thread, in_reply_to); - if (ret < 0) - return ret; + if (ret) + return ret > 0 ? -EINVAL : ret; } return 0; } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6939C4167B for ; Mon, 24 Jan 2022 19:38:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354766AbiAXThx (ORCPT ); Mon, 24 Jan 2022 14:37:53 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57524 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347726AbiAXTc1 (ORCPT ); Mon, 24 Jan 2022 14:32:27 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 83488614FF; Mon, 24 Jan 2022 19:32:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A9D3C340E8; Mon, 24 Jan 2022 19:32:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052745; bh=mqGBQO0RBQ+6UJAqYAr8k4AtoulFgo2/JKjKWkwUVn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=guAuDynlZoFpsz9/e+5ALs4ovfkesO4fFECDRFo6ZHXbOp3oaWk21nYyOpK89CiMu +0s5vDHThtD2W+7HICKum0bSnHLYgOkQgmX4tS+/hKpwbruelKg5S2GwklJheA/Kg7 YJY64gvihpxpJiiwH0vjOJfQH4j6q8aOgCsa8814= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Sasha Levin Subject: [PATCH 5.4 133/320] uio: uio_dmem_genirq: Catch the Exception Date: Mon, 24 Jan 2022 19:41:57 +0100 Message-Id: <20220124183958.189526620@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit eec91694f927d1026974444eb6a3adccd4f1cbc2 ] The return value of dma_set_coherent_mask() is not always 0. To catch the exception in case that dma is not support the mask. Fixes: 0a0c3b5a24bd ("Add new uio device for dynamic memory allocation") Signed-off-by: Jiasheng Jiang Link: https://lore.kernel.org/r/20211204000326.1592687-1-jiasheng@iscas.ac.= cn Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/uio/uio_dmem_genirq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c index 44858f70f5f52..bdba9dc06f63b 100644 --- a/drivers/uio/uio_dmem_genirq.c +++ b/drivers/uio/uio_dmem_genirq.c @@ -192,7 +192,11 @@ static int uio_dmem_genirq_probe(struct platform_devic= e *pdev) goto bad0; } =20 - dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); + ret =3D dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(&pdev->dev, "DMA enable failed\n"); + return ret; + } =20 priv->uioinfo =3D uioinfo; spin_lock_init(&priv->lock); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C164BC4321E for ; Tue, 25 Jan 2022 02:34:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421834AbiAYC3F (ORCPT ); Mon, 24 Jan 2022 21:29:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378673AbiAXUIS (ORCPT ); Mon, 24 Jan 2022 15:08:18 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 237E6C06E008; Mon, 24 Jan 2022 11:32:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D31C3B8123F; Mon, 24 Jan 2022 19:32:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5B0AC340E5; Mon, 24 Jan 2022 19:32:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052766; bh=Gb94Y9YdDnwpA1Wh+iUdsiCmxH8BNG5gik8azrh+w1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j2wXPH8583Oy+VUK88KQa8dd4S91TzXeDwhzaInji46X68HEXRXvgLbvkngNRlQ8M PB/umJlRJjbeIL+hcS+ONRBLvCJj+f1FRMufuqw5KRemY5xGn/BHhe/joTVmCYmrRb J2Z/kRHVnPmtjNyRqiOM7MRFxoDUgye7xB5xqgF8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Murphy , Hector Martin , Joerg Roedel , Sasha Levin Subject: [PATCH 5.4 134/320] iommu/io-pgtable-arm: Fix table descriptor paddr formatting Date: Mon, 24 Jan 2022 19:41:58 +0100 Message-Id: <20220124183958.221993907@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hector Martin [ Upstream commit 9abe2ac834851a7d0b0756e295cf7a292c45ca53 ] Table descriptors were being installed without properly formatting the address using paddr_to_iopte, which does not match up with the iopte_deref in __arm_lpae_map. This is incorrect for the LPAE pte format, as it does not handle the high bits properly. This was found on Apple T6000 DARTs, which require a new pte format (different shift); adding support for that to paddr_to_iopte/iopte_to_paddr caused it to break badly, as even <48-bit addresses would end up incorrect in that case. Fixes: 6c89928ff7a0 ("iommu/io-pgtable-arm: Support 52-bit physical address= ") Acked-by: Robin Murphy Signed-off-by: Hector Martin Link: https://lore.kernel.org/r/20211120031343.88034-1-marcan@marcan.st Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/iommu/io-pgtable-arm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index ca51036aa53c7..975237ca03267 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -351,11 +351,12 @@ static int arm_lpae_init_pte(struct arm_lpae_io_pgtab= le *data, static arm_lpae_iopte arm_lpae_install_table(arm_lpae_iopte *table, arm_lpae_iopte *ptep, arm_lpae_iopte curr, - struct io_pgtable_cfg *cfg) + struct arm_lpae_io_pgtable *data) { arm_lpae_iopte old, new; + struct io_pgtable_cfg *cfg =3D &data->iop.cfg; =20 - new =3D __pa(table) | ARM_LPAE_PTE_TYPE_TABLE; + new =3D paddr_to_iopte(__pa(table), data) | ARM_LPAE_PTE_TYPE_TABLE; if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_NS) new |=3D ARM_LPAE_PTE_NSTABLE; =20 @@ -406,7 +407,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *d= ata, unsigned long iova, if (!cptep) return -ENOMEM; =20 - pte =3D arm_lpae_install_table(cptep, ptep, 0, cfg); + pte =3D arm_lpae_install_table(cptep, ptep, 0, data); if (pte) __arm_lpae_free_pages(cptep, tblsz, cfg); } else if (!cfg->coherent_walk && !(pte & ARM_LPAE_PTE_SW_SYNC)) { @@ -575,7 +576,7 @@ static size_t arm_lpae_split_blk_unmap(struct arm_lpae_= io_pgtable *data, __arm_lpae_init_pte(data, blk_paddr, pte, lvl, &tablep[i]); } =20 - pte =3D arm_lpae_install_table(tablep, ptep, blk_pte, cfg); + pte =3D arm_lpae_install_table(tablep, ptep, blk_pte, data); if (pte !=3D blk_pte) { __arm_lpae_free_pages(tablep, tablesz, cfg); /* --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5605C433EF for ; Mon, 24 Jan 2022 23:17:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1845072AbiAXXLN (ORCPT ); Mon, 24 Jan 2022 18:11:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1578869AbiAXWRR (ORCPT ); Mon, 24 Jan 2022 17:17:17 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30E2FC06E010; Mon, 24 Jan 2022 11:32:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C9B48B81247; Mon, 24 Jan 2022 19:32:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F21AC340E5; Mon, 24 Jan 2022 19:32:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052769; bh=ZJme4Yid2pZKebZ4YavbIa0wEaqlh17EKn5d80x8Sd0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UhXNGTwpL5VC4UGNPv8WgnUr4R4Qy8ER2+eIyPbcKDJ6w7F9LiJrWFdP+A4TJ3fqW cJ1s1JCvgbzDA0TacXuxhrxrdpZLFu7erXfJnm/rp1o1omq+xHY8gvs7y1tBSena3U qEyKmscTijV7+EgzSGIO7cEq+pkt5vG7IBeVuytU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Dobriyan , Bean Huo , Bart Van Assche , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.4 135/320] scsi: ufs: Fix race conditions related to driver data Date: Mon, 24 Jan 2022 19:41:59 +0100 Message-Id: <20220124183958.253484533@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit 21ad0e49085deb22c094f91f9da57319a97188e4 ] The driver data pointer must be set before any callbacks are registered that use that pointer. Hence move the initialization of that pointer from after the ufshcd_init() call to inside ufshcd_init(). Link: https://lore.kernel.org/r/20211203231950.193369-7-bvanassche@acm.org Fixes: 3b1d05807a9a ("[SCSI] ufs: Segregate PCI Specific Code") Reported-by: Alexey Dobriyan Tested-by: Bean Huo Reviewed-by: Bean Huo Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/scsi/ufs/tc-dwc-g210-pci.c | 1 - drivers/scsi/ufs/ufshcd-pltfrm.c | 2 -- drivers/scsi/ufs/ufshcd.c | 7 +++++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ufs/tc-dwc-g210-pci.c b/drivers/scsi/ufs/tc-dwc-g= 210-pci.c index 67a6a61154b71..4e471484539d2 100644 --- a/drivers/scsi/ufs/tc-dwc-g210-pci.c +++ b/drivers/scsi/ufs/tc-dwc-g210-pci.c @@ -135,7 +135,6 @@ tc_dwc_g210_pci_probe(struct pci_dev *pdev, const struc= t pci_device_id *id) return err; } =20 - pci_set_drvdata(pdev, hba); pm_runtime_put_noidle(&pdev->dev); pm_runtime_allow(&pdev->dev); =20 diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-plt= frm.c index 8d40dc918f4e1..10eec501f6b39 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -436,8 +436,6 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, goto dealloc_host; } =20 - platform_set_drvdata(pdev, hba); - pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); =20 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 29c7a76d2c658..ebf7ae1ef70d4 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8328,6 +8328,13 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *m= mio_base, unsigned int irq) struct Scsi_Host *host =3D hba->host; struct device *dev =3D hba->dev; =20 + /* + * dev_set_drvdata() must be called before any callbacks are registered + * that use dev_get_drvdata() (frequency scaling, clock scaling, hwmon, + * sysfs). + */ + dev_set_drvdata(dev, hba); + if (!mmio_base) { dev_err(hba->dev, "Invalid memory reference for mmio_base is NULL\n"); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C96B5C433FE for ; Mon, 24 Jan 2022 19:42:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237471AbiAXTmB (ORCPT ); Mon, 24 Jan 2022 14:42:01 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60258 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353129AbiAXTcx (ORCPT ); Mon, 24 Jan 2022 14:32:53 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 180136151B; Mon, 24 Jan 2022 19:32:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECF9AC340E5; Mon, 24 Jan 2022 19:32:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052772; bh=1k00qKxoOl45JtrC5qwUDU82EQxxTUOYt/FuVoHXc9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EBO4XBby+WP+3fQ0cw/97mF13/PPVW50vbxJYKXi4Tgx8gtxOAnZAkBBAkIRD/ZMd VNU01rKMo4JIwHb3MCNsM3iSZcmXgLZirlM7HKPCdZ1aJuVz9bVK+UlBY4OFp+3MBP tIRcgCyrIpy1T4+uZgYFQ3GEWHmklvvdQcA/s8pw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Juergen Gross , Jason Gunthorpe , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.4 136/320] PCI/MSI: Fix pci_irq_vector()/pci_irq_get_affinity() Date: Mon, 24 Jan 2022 19:42:00 +0100 Message-Id: <20220124183958.285126187@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner [ Upstream commit 29bbc35e29d9b6347780dcacde2deb4b39344167 ] pci_irq_vector() and pci_irq_get_affinity() use the list position to find t= he MSI-X descriptor at a given index. That's correct for the normal case where the entry number is the same as the list position. But it's wrong for cases where MSI-X was allocated with an entries array describing sparse entry numbers into the hardware message descriptor table. That's inconsistent at best. Make it always check the entry number because that's what the zero base index really means. This change won't break existing users which use a sparse entries array for allocation because these users retrieve the Linux interrupt number from the entries array after allocation and none of them uses pci_irq_vector() or pci_irq_get_affinity(). Fixes: aff171641d18 ("PCI: Provide sensible IRQ vector alloc/free routines") Signed-off-by: Thomas Gleixner Tested-by: Juergen Gross Reviewed-by: Jason Gunthorpe Acked-by: Bjorn Helgaas Link: https://lore.kernel.org/r/20211206210223.929792157@linutronix.de Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/pci/msi.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 7dc10c2b4785d..715c85d4e688d 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -1294,19 +1294,24 @@ EXPORT_SYMBOL(pci_free_irq_vectors); =20 /** * pci_irq_vector - return Linux IRQ number of a device vector - * @dev: PCI device to operate on - * @nr: device-relative interrupt vector index (0-based). + * @dev: PCI device to operate on + * @nr: Interrupt vector index (0-based) + * + * @nr has the following meanings depending on the interrupt mode: + * MSI-X: The index in the MSI-X vector table + * MSI: The index of the enabled MSI vectors + * INTx: Must be 0 + * + * Return: The Linux interrupt number or -EINVAl if @nr is out of range. */ int pci_irq_vector(struct pci_dev *dev, unsigned int nr) { if (dev->msix_enabled) { struct msi_desc *entry; - int i =3D 0; =20 for_each_pci_msi_entry(entry, dev) { - if (i =3D=3D nr) + if (entry->msi_attrib.entry_nr =3D=3D nr) return entry->irq; - i++; } WARN_ON_ONCE(1); return -EINVAL; @@ -1330,17 +1335,22 @@ EXPORT_SYMBOL(pci_irq_vector); * pci_irq_get_affinity - return the affinity of a particular MSI vector * @dev: PCI device to operate on * @nr: device-relative interrupt vector index (0-based). + * + * @nr has the following meanings depending on the interrupt mode: + * MSI-X: The index in the MSI-X vector table + * MSI: The index of the enabled MSI vectors + * INTx: Must be 0 + * + * Return: A cpumask pointer or NULL if @nr is out of range */ const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr) { if (dev->msix_enabled) { struct msi_desc *entry; - int i =3D 0; =20 for_each_pci_msi_entry(entry, dev) { - if (i =3D=3D nr) + if (entry->msi_attrib.entry_nr =3D=3D nr) return &entry->affinity->mask; - i++; } WARN_ON_ONCE(1); return NULL; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 819FCC433F5 for ; Mon, 24 Jan 2022 19:38:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347781AbiAXTiJ (ORCPT ); Mon, 24 Jan 2022 14:38:09 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60324 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345782AbiAXTc4 (ORCPT ); Mon, 24 Jan 2022 14:32:56 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7DC5B61518; Mon, 24 Jan 2022 19:32:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26316C340E5; Mon, 24 Jan 2022 19:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052775; bh=jIFB4DyR65lRtbEr6tbrfuZymy0Zzuv0IAIULieUXJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BM+DAkhcjtr8kFMl2r/DgPc3UkRnCtr2jYoq/tJ+MiJBKL12t0HC4sgEWHoJ3vGUl TrTLua4CS3JigNsbGKsuk7ZMbwYc1ia6BrScS16j/qLM1N0H77i8fpkgG45m/8YSDH Qyy6DgfGME3LN6wSWWHdnbftGa+y9xsVqgr71roc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Erhard Furtner , Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 137/320] powerpc/powermac: Add additional missing lockdep_register_key() Date: Mon, 24 Jan 2022 19:42:01 +0100 Message-Id: <20220124183958.317521976@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy [ Upstream commit b149d5d45ac9171ed699a256f026c8ebef901112 ] Commit df1f679d19ed ("powerpc/powermac: Add missing lockdep_register_key()") fixed a problem that was causing a WARNING. There are two other places in the same file with the same problem originating from commit 9e607f72748d ("i2c_powermac: shut up lockdep warning"). Add missing lockdep_register_key() Fixes: 9e607f72748d ("i2c_powermac: shut up lockdep warning") Reported-by: Erhard Furtner Signed-off-by: Christophe Leroy Depends-on: df1f679d19ed ("powerpc/powermac: Add missing lockdep_register_k= ey()") Signed-off-by: Michael Ellerman Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D200055 Link: https://lore.kernel.org/r/2c7e421874e21b2fb87813d768cf662f630c2ad4.16= 38984999.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/powerpc/platforms/powermac/low_i2c.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platf= orms/powermac/low_i2c.c index bf4be4b53b44d..a366233d8ac2d 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c @@ -811,6 +811,7 @@ static void __init pmu_i2c_probe(void) bus->hostdata =3D bus + 1; bus->xfer =3D pmu_i2c_xfer; mutex_init(&bus->mutex); + lockdep_register_key(&bus->lock_key); lockdep_set_class(&bus->mutex, &bus->lock_key); bus->flags =3D pmac_i2c_multibus; list_add(&bus->link, &pmac_i2c_busses); @@ -934,6 +935,7 @@ static void __init smu_i2c_probe(void) bus->hostdata =3D bus + 1; bus->xfer =3D smu_i2c_xfer; mutex_init(&bus->mutex); + lockdep_register_key(&bus->lock_key); lockdep_set_class(&bus->mutex, &bus->lock_key); bus->flags =3D 0; list_add(&bus->link, &pmac_i2c_busses); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3E4DC43217 for ; Tue, 25 Jan 2022 02:35:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422009AbiAYC3v (ORCPT ); Mon, 24 Jan 2022 21:29:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357849AbiAXUJe (ORCPT ); Mon, 24 Jan 2022 15:09:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E07DC02983A; Mon, 24 Jan 2022 11:33:01 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4551BB8121C; Mon, 24 Jan 2022 19:33:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 689D5C340E5; Mon, 24 Jan 2022 19:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052779; bh=MGcczI86XdxpzZ8+PoJv+QLLEjPqQxli/cTut4UHhGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iy7vgXPYC95Rasyu3ywwZmVNLyoXqVnb5F4ExwHjoIeYskg7+72VKwFbjof8Cclnj 2FdOjnPzR7I9FvtFbolvXZhiytfYOmbz46+7s7ZXFAtIdIe5nLXElWkyrMAakt4HZF VsfRtLyNFpKTNoQKTow+j/b8OzIkque9DkMI+FKw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Avihai Horon , Mark Zhang , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.4 138/320] RDMA/core: Let ib_find_gid() continue search even after empty entry Date: Mon, 24 Jan 2022 19:42:02 +0100 Message-Id: <20220124183958.348215298@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Avihai Horon [ Upstream commit 483d805191a23191f8294bbf9b4e94836f5d92e4 ] Currently, ib_find_gid() will stop searching after encountering the first empty GID table entry. This behavior is wrong since neither IB nor RoCE spec enforce tightly packed GID tables. For example, when a valid GID entry exists at index N, and if a GID entry is empty at index N-1, ib_find_gid() will fail to find the valid entry. Fix it by making ib_find_gid() continue searching even after encountering missing entries. Fixes: 5eb620c81ce3 ("IB/core: Add helpers for uncached GID and P_Key searc= hes") Link: https://lore.kernel.org/r/e55d331b96cecfc2cf19803d16e7109ea966882d.16= 39055490.git.leonro@nvidia.com Signed-off-by: Avihai Horon Reviewed-by: Mark Zhang Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/infiniband/core/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/dev= ice.c index 256d379bba676..de66d7da1bf6e 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -2438,7 +2438,8 @@ int ib_find_gid(struct ib_device *device, union ib_gi= d *gid, ++i) { ret =3D rdma_query_gid(device, port, i, &tmp_gid); if (ret) - return ret; + continue; + if (!memcmp(&tmp_gid, gid, sizeof *gid)) { *port_num =3D port; if (index) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97867C43217 for ; Mon, 24 Jan 2022 19:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348596AbiAXTi2 (ORCPT ); Mon, 24 Jan 2022 14:38:28 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60426 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348935AbiAXTdD (ORCPT ); Mon, 24 Jan 2022 14:33:03 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A518161451; Mon, 24 Jan 2022 19:33:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E108C340E5; Mon, 24 Jan 2022 19:33:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052782; bh=cMWfF3LQ/nrwIEZTaE5UU7LojT9m35M4Ai0G8V+NHt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SdaUOSQ7VQfVohEfrxv5FeuhnZvRfJhbrJhUKSsYT71jLCGU/NwQX9zm3jUxoiQGK 5HotdXB1Xb7r37V1GQYBj1ESwyi7Ck/Nv7cSwIHLf2W0MG5xAyKq/BMcUMbRZPaKNM 39JkpgyGB5XobdKPSnkEjIxZQVTWAEYUZjz9YCeA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Avihai Horon , Mark Zhang , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.4 139/320] RDMA/cma: Let cma_resolve_ib_dev() continue search even after empty entry Date: Mon, 24 Jan 2022 19:42:03 +0100 Message-Id: <20220124183958.379115860@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Avihai Horon [ Upstream commit 20679094a0161c94faf77e373fa3f7428a8e14bd ] Currently, when cma_resolve_ib_dev() searches for a matching GID it will stop searching after encountering the first empty GID table entry. This behavior is wrong since neither IB nor RoCE spec enforce tightly packed GID tables. For example, when the matching valid GID entry exists at index N, and if a GID entry is empty at index N-1, cma_resolve_ib_dev() will fail to find the matching valid entry. Fix it by making cma_resolve_ib_dev() continue searching even after encountering missing entries. Fixes: f17df3b0dede ("RDMA/cma: Add support for AF_IB to rdma_resolve_addr(= )") Link: https://lore.kernel.org/r/b7346307e3bb396c43d67d924348c6c496493991.16= 39055490.git.leonro@nvidia.com Signed-off-by: Avihai Horon Reviewed-by: Mark Zhang Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/infiniband/core/cma.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index ec9e9598894f6..5e2b688e36fca 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -820,6 +820,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *i= d_priv) u16 pkey, index; u8 p; enum ib_port_state port_state; + int ret; int i; =20 cma_dev =3D NULL; @@ -838,9 +839,14 @@ static int cma_resolve_ib_dev(struct rdma_id_private *= id_priv) =20 if (ib_get_cached_port_state(cur_dev->device, p, &port_state)) continue; - for (i =3D 0; !rdma_query_gid(cur_dev->device, - p, i, &gid); - i++) { + + for (i =3D 0; i < cur_dev->device->port_data[p].immutable.gid_tbl_len; + ++i) { + ret =3D rdma_query_gid(cur_dev->device, p, i, + &gid); + if (ret) + continue; + if (!memcmp(&gid, dgid, sizeof(gid))) { cma_dev =3D cur_dev; sgid =3D gid; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53B0FC4167D for ; Mon, 24 Jan 2022 19:38:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354445AbiAXTgh (ORCPT ); Mon, 24 Jan 2022 14:36:37 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56854 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352973AbiAXTbU (ORCPT ); Mon, 24 Jan 2022 14:31:20 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1D89E60909; Mon, 24 Jan 2022 19:31:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E942EC340E5; Mon, 24 Jan 2022 19:31:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052679; bh=QXwHeHYX/Zqd8QEkJTWYF2EP0u+fr0fdpX7u7hy1n4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xcSZmzRcWXIdkhilnNdrboVsy4InDskp6M42jPEyisGgDvVYcXIsgTVIGrv/kiSmf HwIIx9UkrlAvPuF00Njz6CycLqbt9MDVBn695C35xXPI+KnUCLeWLUYCJrfnn6FavH Yrb3kfyMcXQ7J3DYAOjVJkTvNi581ESSgPbzvlkY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Mark Brown , Sasha Levin Subject: [PATCH 5.4 140/320] ASoC: rt5663: Handle device_property_read_u32_array error codes Date: Mon, 24 Jan 2022 19:42:04 +0100 Message-Id: <20220124183958.411641176@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 2167c0b205960607fb136b4bb3c556a62be1569a ] The return value of device_property_read_u32_array() is not always 0. To catch the exception in case that devm_kzalloc failed and the rt5663->imp_table was NULL, which caused the failure of device_property_read_u32_array. Fixes: 450f0f6a8fb4 ("ASoC: rt5663: Add the manual offset field to compensa= te the DC offset") Signed-off-by: Jiasheng Jiang Link: https://lore.kernel.org/r/20211215031550.70702-1-jiasheng@iscas.ac.cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- sound/soc/codecs/rt5663.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c index 2943692f66edd..3610be1590fcc 100644 --- a/sound/soc/codecs/rt5663.c +++ b/sound/soc/codecs/rt5663.c @@ -3461,6 +3461,7 @@ static void rt5663_calibrate(struct rt5663_priv *rt56= 63) static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) { int table_size; + int ret; =20 device_property_read_u32(dev, "realtek,dc_offset_l_manual", &rt5663->pdata.dc_offset_l_manual); @@ -3477,9 +3478,11 @@ static int rt5663_parse_dp(struct rt5663_priv *rt566= 3, struct device *dev) table_size =3D sizeof(struct impedance_mapping_table) * rt5663->pdata.impedance_sensing_num; rt5663->imp_table =3D devm_kzalloc(dev, table_size, GFP_KERNEL); - device_property_read_u32_array(dev, + ret =3D device_property_read_u32_array(dev, "realtek,impedance_sensing_table", (u32 *)rt5663->imp_table, table_size); + if (ret) + return ret; } =20 return 0; @@ -3504,8 +3507,11 @@ static int rt5663_i2c_probe(struct i2c_client *i2c, =20 if (pdata) rt5663->pdata =3D *pdata; - else - rt5663_parse_dp(rt5663, &i2c->dev); + else { + ret =3D rt5663_parse_dp(rt5663, &i2c->dev); + if (ret) + return ret; + } =20 for (i =3D 0; i < ARRAY_SIZE(rt5663->supplies); i++) rt5663->supplies[i].supply =3D rt5663_supply_names[i]; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDC0EC43219 for ; Mon, 24 Jan 2022 19:43:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355714AbiAXTnU (ORCPT ); Mon, 24 Jan 2022 14:43:20 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54526 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344766AbiAXTb3 (ORCPT ); Mon, 24 Jan 2022 14:31:29 -0500 Received: from smtp.kernel.org (relay.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 957F1B810BD; Mon, 24 Jan 2022 19:31:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4B7EC340E7; Mon, 24 Jan 2022 19:31:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052682; bh=PlU0BGXYhEPw+yxn5LNeHuz6RZoUF0+GF9AQ5NrEnq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e276yz+0dCbmXDQbEJN5GEjeNMJmGqFPdFZPsWYe3ZFEFXXPBK4uYS7VsWrmjrXyc nXf7mttieCkyB98F3UWUtBfqJLUEX4xdrnE2Yo4H+WGISbJv1pdSNMITYcPyxgjrLS aGzQ+awENObHwz9qh4niokv21tjDZoI5Vwf5YPbc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dillon Min , Patrice Chotard , Gabriel Fernandez , Stephen Boyd , Sasha Levin Subject: [PATCH 5.4 141/320] clk: stm32: Fix ltdcs clock turn off by clk_disable_unused() after system enter shell Date: Mon, 24 Jan 2022 19:42:05 +0100 Message-Id: <20220124183958.442819685@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dillon Min [ Upstream commit 6fc058a72f3b7b07fc4de6d66ad1f68951b00f6e ] stm32's clk driver register two ltdc gate clk to clk core by clk_hw_register_gate() and clk_hw_register_composite() first: 'stm32f429_gates[]', clk name is 'ltdc', which no user to use. second: 'stm32f429_aux_clk[]', clk name is 'lcd-tft', used by ltdc driver both of them point to the same offset of stm32's RCC register. after kernel enter console, clk core turn off ltdc's clk as 'stm32f429_gates[]' is no one to use. but, actually 'stm32f429_aux_clk[]' is in use. stm32f469/746/769 have the same issue, fix it. Fixes: daf2d117cbca ("clk: stm32f4: Add lcd-tft clock") Link: https://lore.kernel.org/linux-arm-kernel/1590564453-24499-7-git-send-= email-dillon.minfei@gmail.com/ Link: https://lore.kernel.org/lkml/CAPTRvHkf0cK_4ZidM17rPo99gWDmxgqFt4CDUjq= FFwkOeQeFDg@mail.gmail.com/ Signed-off-by: Dillon Min Reviewed-by: Patrice Chotard Acked-by: Gabriel Fernandez Acked-by: Stephen Boyd Link: https://lore.kernel.org/r/1635232282-3992-10-git-send-email-dillon.mi= nfei@gmail.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/clk/clk-stm32f4.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c index 5c75e3d906c20..682a18b392f08 100644 --- a/drivers/clk/clk-stm32f4.c +++ b/drivers/clk/clk-stm32f4.c @@ -129,7 +129,6 @@ static const struct stm32f4_gate_data stm32f429_gates[]= __initconst =3D { { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; =20 static const struct stm32f4_gate_data stm32f469_gates[] __initconst =3D { @@ -211,7 +210,6 @@ static const struct stm32f4_gate_data stm32f469_gates[]= __initconst =3D { { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; =20 static const struct stm32f4_gate_data stm32f746_gates[] __initconst =3D { @@ -286,7 +284,6 @@ static const struct stm32f4_gate_data stm32f746_gates[]= __initconst =3D { { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; =20 static const struct stm32f4_gate_data stm32f769_gates[] __initconst =3D { @@ -364,7 +361,6 @@ static const struct stm32f4_gate_data stm32f769_gates[]= __initconst =3D { { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, { STM32F4_RCC_APB2ENR, 30, "mdio", "apb2_div" }, }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3637C43217 for ; Mon, 24 Jan 2022 19:41:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355221AbiAXTkN (ORCPT ); Mon, 24 Jan 2022 14:40:13 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52022 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345150AbiAXTb3 (ORCPT ); Mon, 24 Jan 2022 14:31:29 -0500 Received: from smtp.kernel.org (relay.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 A1A12B81233; Mon, 24 Jan 2022 19:31:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFCF5C340E5; Mon, 24 Jan 2022 19:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052685; bh=koS4GrF8YgxQXPW/Lc4WUIb0bRVCkKlo31oGMe+LMc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pxZehjxh8TWMnTrem3iJz8jY7dryHOK4GBMJmMxCuPkiDdmVxpHWIuDHhG5XbPFP0 +7EIzXYAg0tE4G3lz9ywKqdA4dEFz+cdTEVwsjdFuXg4U/hz3HEAlm1cReUxWoa8DX dXfLgBCVlwlx3RAW9dRAto3MKzYn+DOz9ZxnKzQE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Mark Brown , Vinod Koul , Sasha Levin Subject: [PATCH 5.4 142/320] dmaengine: pxa/mmp: stop referencing config->slave_id Date: Mon, 24 Jan 2022 19:42:06 +0100 Message-Id: <20220124183958.473485737@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann [ Upstream commit 134c37fa250a87a7e77c80a7c59ae16c462e46e0 ] The last driver referencing the slave_id on Marvell PXA and MMP platforms was the SPI driver, but this stopped doing so a long time ago, so the TODO from the earlier patch can no be removed. Fixes: b729bf34535e ("spi/pxa2xx: Don't use slave_id of dma_slave_config") Fixes: 13b3006b8ebd ("dma: mmp_pdma: add filter function") Signed-off-by: Arnd Bergmann Acked-by: Mark Brown Link: https://lore.kernel.org/r/20211122222203.4103644-7-arnd@kernel.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/dma/mmp_pdma.c | 6 ------ drivers/dma/pxa_dma.c | 7 ------- 2 files changed, 13 deletions(-) diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c index 7fe494fc50d4e..ec186cf8b8af1 100644 --- a/drivers/dma/mmp_pdma.c +++ b/drivers/dma/mmp_pdma.c @@ -728,12 +728,6 @@ static int mmp_pdma_config_write(struct dma_chan *dcha= n, =20 chan->dir =3D direction; chan->dev_addr =3D addr; - /* FIXME: drivers should be ported over to use the filter - * function. Once that's done, the following two lines can - * be removed. - */ - if (cfg->slave_id) - chan->drcmr =3D cfg->slave_id; =20 return 0; } diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c index 349fb312c8725..b4ef4f19f7dec 100644 --- a/drivers/dma/pxa_dma.c +++ b/drivers/dma/pxa_dma.c @@ -911,13 +911,6 @@ static void pxad_get_config(struct pxad_chan *chan, *dcmd |=3D PXA_DCMD_BURST16; else if (maxburst =3D=3D 32) *dcmd |=3D PXA_DCMD_BURST32; - - /* FIXME: drivers should be ported over to use the filter - * function. Once that's done, the following two lines can - * be removed. - */ - if (chan->cfg.slave_id) - chan->drcmr =3D chan->cfg.slave_id; } =20 static struct dma_async_tx_descriptor * --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D73F4C4167B for ; Tue, 25 Jan 2022 02:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421639AbiAYC1X (ORCPT ); Mon, 24 Jan 2022 21:27:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377302AbiAXUFQ (ORCPT ); Mon, 24 Jan 2022 15:05:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5876DC06136A; Mon, 24 Jan 2022 11:31:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E8255614BE; Mon, 24 Jan 2022 19:31:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7441C340E5; Mon, 24 Jan 2022 19:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052688; bh=yI7KrNG5Of/LDobzB0QUI4SIKQIc7jK6J4lDQYu0n28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gDbAAkjpKQ88PXM1mqh02B/Jidh6xHq9m0cczWRJkhNpSqQ7VQCv80buhE/msYS78 +rumpcLU9cBAbkVQv+1Xqv+YUeLmfel6xkNH2pIaKF4s2wEoEJdbuxCc6AD1a5kj4J Vd9DFQR14WANqlQEQLU1W3gnQFNknp4zzFVRx0Ss= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , Xiongfeng Wang , Robin Murphy , Joerg Roedel , Sasha Levin Subject: [PATCH 5.4 143/320] iommu/iova: Fix race between FQ timeout and teardown Date: Mon, 24 Jan 2022 19:42:07 +0100 Message-Id: <20220124183958.504464068@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiongfeng Wang [ Upstream commit d7061627d701c90e1cac1e1e60c45292f64f3470 ] It turns out to be possible for hotplugging out a device to reach the stage of tearing down the device's group and default domain before the domain's flush queue has drained naturally. At this point, it is then possible for the timeout to expire just before the del_timer() call in free_iova_flush_queue(), such that we then proceed to free the FQ resources while fq_flush_timeout() is still accessing them on another CPU. Crashes due to this have been observed in the wild while removing NVMe devices. Close the race window by using del_timer_sync() to safely wait for any active timeout handler to finish before we start to free things. We already avoid any locking in free_iova_flush_queue() since the FQ is supposed to be inactive anyway, so the potential deadlock scenario does not apply. Fixes: 9a005a800ae8 ("iommu/iova: Add flush timer") Reviewed-by: John Garry Signed-off-by: Xiongfeng Wang [ rm: rewrite commit message ] Signed-off-by: Robin Murphy Link: https://lore.kernel.org/r/0a365e5b07f14b7344677ad6a9a734966a8422ce.16= 39753638.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/iommu/iova.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index 612cbf668adf8..906582a21124d 100644 --- a/drivers/iommu/iova.c +++ b/drivers/iommu/iova.c @@ -64,8 +64,7 @@ static void free_iova_flush_queue(struct iova_domain *iov= ad) if (!has_iova_flush_queue(iovad)) return; =20 - if (timer_pending(&iovad->fq_timer)) - del_timer(&iovad->fq_timer); + del_timer_sync(&iovad->fq_timer); =20 fq_destroy_all_entries(iovad); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A07CC4167B for ; Mon, 24 Jan 2022 19:38:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354460AbiAXTgi (ORCPT ); Mon, 24 Jan 2022 14:36:38 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54704 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346842AbiAXTbe (ORCPT ); Mon, 24 Jan 2022 14:31:34 -0500 Received: from smtp.kernel.org (relay.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 A954EB81238; Mon, 24 Jan 2022 19:31:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B69B3C340E5; Mon, 24 Jan 2022 19:31:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052691; bh=lgH1VX/FI0RfMOFGqDesrhhJ97fFgKQgywT4ZWVBbQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xiJAencRBWafkOmuC3zcgRBgAF1A7wyK9FJVKSm1+dlDlhV064BggQYHXadot+xFY FlML7Whd7jkpv39yn+A+wzFmCaGf+2+KXnL15O581iLKze6IFaOZxSfFpiT9BNJ21s +RgioLCkrbvChoGfC21MiRjtDgcsr34/fonfhLKw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryuta NAKANISHI , Kunihiko Hayashi , Vinod Koul , Sasha Levin Subject: [PATCH 5.4 144/320] phy: uniphier-usb3ss: fix unintended writing zeros to PHY register Date: Mon, 24 Jan 2022 19:42:08 +0100 Message-Id: <20220124183958.536281351@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ryuta NAKANISHI [ Upstream commit 898c7a9ec81620125f2463714a0f4dea18ad6e54 ] Similar to commit 4a90bbb478db ("phy: uniphier-pcie: Fix updating phy parameters"), in function uniphier_u3ssphy_set_param(), unintentionally write zeros to other fields when writing PHY registers. Fixes: 5ab43d0f8697 ("phy: socionext: add USB3 PHY driver for UniPhier SoC") Signed-off-by: Ryuta NAKANISHI Signed-off-by: Kunihiko Hayashi Link: https://lore.kernel.org/r/1640150369-4134-1-git-send-email-hayashi.ku= nihiko@socionext.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/phy/socionext/phy-uniphier-usb3ss.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/phy/socionext/phy-uniphier-usb3ss.c b/drivers/phy/soci= onext/phy-uniphier-usb3ss.c index a7577e316baf5..e63648b5c7547 100644 --- a/drivers/phy/socionext/phy-uniphier-usb3ss.c +++ b/drivers/phy/socionext/phy-uniphier-usb3ss.c @@ -22,11 +22,13 @@ #include =20 #define SSPHY_TESTI 0x0 -#define SSPHY_TESTO 0x4 #define TESTI_DAT_MASK GENMASK(13, 6) #define TESTI_ADR_MASK GENMASK(5, 1) #define TESTI_WR_EN BIT(0) =20 +#define SSPHY_TESTO 0x4 +#define TESTO_DAT_MASK GENMASK(7, 0) + #define PHY_F(regno, msb, lsb) { (regno), (msb), (lsb) } =20 #define CDR_CPD_TRIM PHY_F(7, 3, 0) /* RxPLL charge pump current */ @@ -84,12 +86,12 @@ static void uniphier_u3ssphy_set_param(struct uniphier_= u3ssphy_priv *priv, val =3D FIELD_PREP(TESTI_DAT_MASK, 1); val |=3D FIELD_PREP(TESTI_ADR_MASK, p->field.reg_no); uniphier_u3ssphy_testio_write(priv, val); - val =3D readl(priv->base + SSPHY_TESTO); + val =3D readl(priv->base + SSPHY_TESTO) & TESTO_DAT_MASK; =20 /* update value */ - val &=3D ~FIELD_PREP(TESTI_DAT_MASK, field_mask); + val &=3D ~field_mask; data =3D field_mask & (p->value << p->field.lsb); - val =3D FIELD_PREP(TESTI_DAT_MASK, data); + val =3D FIELD_PREP(TESTI_DAT_MASK, data | val); val |=3D FIELD_PREP(TESTI_ADR_MASK, p->field.reg_no); uniphier_u3ssphy_testio_write(priv, val); uniphier_u3ssphy_testio_write(priv, val | TESTI_WR_EN); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2621FC433EF for ; Mon, 24 Jan 2022 19:43:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350707AbiAXTnD (ORCPT ); Mon, 24 Jan 2022 14:43:03 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57036 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346903AbiAXTbg (ORCPT ); Mon, 24 Jan 2022 14:31:36 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3C08B61551; Mon, 24 Jan 2022 19:31:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C6C1C340E5; Mon, 24 Jan 2022 19:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052694; bh=aUjhzXTyAHaJTVFOxM8vpuyzYbSsGkP8DhdJfquucl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yzqVMfPbodcLQM/BzRMJvgL3MDSzDKnX+0+3pT1IjxZiKZJ+7mlVQBCOIZls+snpJ p0wAi5WYaeY0C6I2wWRkqcvZNu58WCg5x/QX3HaQdI4kk7I+RA5yFHh3f0kSeBx6WB mWxr/M7Tl8CKqRzHMDLCxo7XcyayxhnzV56MMtZw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Mark Brown , Sasha Levin Subject: [PATCH 5.4 145/320] ASoC: mediatek: Check for error clk pointer Date: Mon, 24 Jan 2022 19:42:09 +0100 Message-Id: <20220124183958.566967543@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 9de2b9286a6dd16966959b3cb34fc2ddfd39213e ] Yes, you are right and now the return code depending on the init_clks(). Fixes: 6078c651947a ("soc: mediatek: Refine scpsys to support multiple plat= form") Signed-off-by: Jiasheng Jiang Link: https://lore.kernel.org/r/20211222015157.1025853-1-jiasheng@iscas.ac.= cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/soc/mediatek/mtk-scpsys.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-s= cpsys.c index 75f25f08245fd..71afa2a99b17f 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -333,12 +333,17 @@ out: return ret; } =20 -static void init_clks(struct platform_device *pdev, struct clk **clk) +static int init_clks(struct platform_device *pdev, struct clk **clk) { int i; =20 - for (i =3D CLK_NONE + 1; i < CLK_MAX; i++) + for (i =3D CLK_NONE + 1; i < CLK_MAX; i++) { clk[i] =3D devm_clk_get(&pdev->dev, clk_names[i]); + if (IS_ERR(clk[i])) + return PTR_ERR(clk[i]); + } + + return 0; } =20 static struct scp *init_scp(struct platform_device *pdev, @@ -348,7 +353,7 @@ static struct scp *init_scp(struct platform_device *pde= v, { struct genpd_onecell_data *pd_data; struct resource *res; - int i, j; + int i, j, ret; struct scp *scp; struct clk *clk[CLK_MAX]; =20 @@ -403,7 +408,9 @@ static struct scp *init_scp(struct platform_device *pde= v, =20 pd_data->num_domains =3D num; =20 - init_clks(pdev, clk); + ret =3D init_clks(pdev, clk); + if (ret) + return ERR_PTR(ret); =20 for (i =3D 0; i < num; i++) { struct scp_domain *scpd =3D &scp->domains[i]; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CA19C4167E for ; Mon, 24 Jan 2022 19:38:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354499AbiAXTgk (ORCPT ); Mon, 24 Jan 2022 14:36:40 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58788 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347311AbiAXTbi (ORCPT ); Mon, 24 Jan 2022 14:31:38 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5B54A6135E; Mon, 24 Jan 2022 19:31:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B6F0C340E5; Mon, 24 Jan 2022 19:31:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052697; bh=TGICEL1JlDSz94eSHY5GVl52jJkWdxOLFeLR5apU6e0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t6U/uDtz5uE99KUdLS76zZ+lC7quTTOSYqIMsvfWb0sOq0Dkczp/4PJ4/dBfh1FKj rRumuJGDDPAzCkbkXYxIg+gbpJleh08ddu9cn+xeT4aeG576+d7cvf25sdXJMS1Uib 7LLcN5e5KDg2wQ7CG/JgCYbCbj7GB6ILdrQMwifE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Krzysztof Kozlowski , Mark Brown , Sasha Levin Subject: [PATCH 5.4 146/320] ASoC: samsung: idma: Check of ioremap return value Date: Mon, 24 Jan 2022 19:42:10 +0100 Message-Id: <20220124183958.606307191@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 3ecb46755eb85456b459a1a9f952c52986bce8ec ] Because of the potential failure of the ioremap(), the buf->area could be NULL. Therefore, we need to check it and return -ENOMEM in order to transfer the error. Fixes: f09aecd50f39 ("ASoC: SAMSUNG: Add I2S0 internal dma driver") Signed-off-by: Jiasheng Jiang Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20211228034026.1659385-1-jiasheng@iscas.ac.= cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- sound/soc/samsung/idma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c index 65497cd477a50..47f6f5d70853d 100644 --- a/sound/soc/samsung/idma.c +++ b/sound/soc/samsung/idma.c @@ -363,6 +363,8 @@ static int preallocate_idma_buffer(struct snd_pcm *pcm,= int stream) buf->addr =3D idma.lp_tx_addr; buf->bytes =3D idma_hardware.buffer_bytes_max; buf->area =3D (unsigned char * __force)ioremap(buf->addr, buf->bytes); + if (!buf->area) + return -ENOMEM; =20 return 0; } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3639FC4332F for ; Tue, 25 Jan 2022 02:34:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421658AbiAYC1Z (ORCPT ); Mon, 24 Jan 2022 21:27:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377325AbiAXUFR (ORCPT ); Mon, 24 Jan 2022 15:05:17 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3533C061378; Mon, 24 Jan 2022 11:31:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5075661318; Mon, 24 Jan 2022 19:31:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 225D0C340E5; Mon, 24 Jan 2022 19:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052700; bh=mgxWZWBc0Eucoc+hoIoXSz+Ix0iMdTBDwuB1PKnJCCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KyQ/xIIPUL0fktyDtNXio+ounmH1MkzXxCs4tJm9BlrTF7OF1sse4HRO1inwNouc1 n49/rCAqKQ1pAPXV3TeTBj6aDQ95UiA3ErYWZq+zWPxBKQc1iZK+sqClrBMILPiOtt kYSUA9HIHnDsdgaJf+46V4i3Yn+5H2CgqP6YdaA8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wei Yongjun , Sasha Levin Subject: [PATCH 5.4 147/320] misc: lattice-ecp3-config: Fix task hung when firmware load failed Date: Mon, 24 Jan 2022 19:42:11 +0100 Message-Id: <20220124183958.645541290@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wei Yongjun [ Upstream commit fcee5ce50bdb21116711e38635e3865594af907e ] When firmware load failed, kernel report task hung as follows: INFO: task xrun:5191 blocked for more than 147 seconds. Tainted: G W 5.16.0-rc5-next-20211220+ #11 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:xrun state:D stack: 0 pid: 5191 ppid: 270 flags:0x0000= 0004 Call Trace: __schedule+0xc12/0x4b50 kernel/sched/core.c:4986 schedule+0xd7/0x260 kernel/sched/core.c:6369 (discriminator 1) schedule_timeout+0x7aa/0xa80 kernel/time/timer.c:1857 wait_for_completion+0x181/0x290 kernel/sched/completion.c:85 lattice_ecp3_remove+0x32/0x40 drivers/misc/lattice-ecp3-config.c:221 spi_remove+0x72/0xb0 drivers/spi/spi.c:409 lattice_ecp3_remove() wait for signals from firmware loading, but when load failed, firmware_load() does not send this signal. This cause device remove hung. Fix it by sending signal even if load failed. Fixes: 781551df57c7 ("misc: Add Lattice ECP3 FPGA configuration via SPI") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun Link: https://lore.kernel.org/r/20211228125522.3122284-1-weiyongjun1@huawei= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/misc/lattice-ecp3-config.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3= -config.c index 884485c3f7232..3a0d2b052ed29 100644 --- a/drivers/misc/lattice-ecp3-config.c +++ b/drivers/misc/lattice-ecp3-config.c @@ -77,12 +77,12 @@ static void firmware_load(const struct firmware *fw, vo= id *context) =20 if (fw =3D=3D NULL) { dev_err(&spi->dev, "Cannot load firmware, aborting\n"); - return; + goto out; } =20 if (fw->size =3D=3D 0) { dev_err(&spi->dev, "Error: Firmware size is 0!\n"); - return; + goto out; } =20 /* Fill dummy data (24 stuffing bits for commands) */ @@ -104,7 +104,7 @@ static void firmware_load(const struct firmware *fw, vo= id *context) dev_err(&spi->dev, "Error: No supported FPGA detected (JEDEC_ID=3D%08x)!\n", jedec_id); - return; + goto out; } =20 dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); @@ -117,7 +117,7 @@ static void firmware_load(const struct firmware *fw, vo= id *context) buffer =3D kzalloc(fw->size + 8, GFP_KERNEL); if (!buffer) { dev_err(&spi->dev, "Error: Can't allocate memory!\n"); - return; + goto out; } =20 /* @@ -156,7 +156,7 @@ static void firmware_load(const struct firmware *fw, vo= id *context) "Error: Timeout waiting for FPGA to clear (status=3D%08x)!\n", status); kfree(buffer); - return; + goto out; } =20 dev_info(&spi->dev, "Configuring the FPGA...\n"); @@ -182,7 +182,7 @@ static void firmware_load(const struct firmware *fw, vo= id *context) release_firmware(fw); =20 kfree(buffer); - +out: complete(&data->fw_loaded); } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 929FFC433EF for ; Mon, 24 Jan 2022 19:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354533AbiAXTgn (ORCPT ); Mon, 24 Jan 2022 14:36:43 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54902 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353001AbiAXTbr (ORCPT ); Mon, 24 Jan 2022 14:31:47 -0500 Received: from smtp.kernel.org (relay.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 137A6B8119D; Mon, 24 Jan 2022 19:31:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34DFDC340E5; Mon, 24 Jan 2022 19:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052703; bh=Qbnpal6S+UxOf65CG/ERZROcEXBzaAoH3S2RJUPcGq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a5y9x4wjKBp9IaVu6k4YH7cwKd/bII3XiX8/e/GWxE5FF3u4383A5sm3+W74nC2U3 bqY8rTxVBgRp57fX1jPqNCnZIvJGPqVHnEZqpa9MiXZ7C43EKUrv1f/TxKhQ2d+6vS exMVwbm+gM2IQDDR7MBfk8PJj8lQxPSphszlRa8w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , kernel test robot , Jonathan Cameron , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.4 148/320] mips: lantiq: add support for clk_set_parent() Date: Mon, 24 Jan 2022 19:42:12 +0100 Message-Id: <20220124183958.676737458@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Randy Dunlap [ Upstream commit 76f66dfd60dc5d2f9dec22d99091fea1035c5d03 ] Provide a simple implementation of clk_set_parent() in the lantiq subarch so that callers of it will build without errors. Fixes these build errors: ERROR: modpost: "clk_set_parent" [sound/soc/jz4740/snd-soc-jz4740-i2s.ko] u= ndefined! ERROR: modpost: "clk_set_parent" [sound/soc/atmel/snd-soc-atmel-i2s.ko] und= efined! Fixes: 171bb2f19ed6 ("MIPS: Lantiq: Add initial support for Lantiq SoCs") Signed-off-by: Randy Dunlap Reported-by: kernel test robot --to=3Dlinux-mips@vger.kernel.org --cc=3D"John Crispin " = --cc=3D"Jonathan Cameron " --cc=3D"Russell King " --cc=3D"Andy Shevchenko " --cc= =3Dalsa-devel@alsa-project.org --to=3D"Thomas Bogendoerfer " Reviewed-by: Jonathan Cameron Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/mips/lantiq/clk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c index 4916cccf378fd..7a623684d9b5e 100644 --- a/arch/mips/lantiq/clk.c +++ b/arch/mips/lantiq/clk.c @@ -164,6 +164,12 @@ struct clk *clk_get_parent(struct clk *clk) } EXPORT_SYMBOL(clk_get_parent); =20 +int clk_set_parent(struct clk *clk, struct clk *parent) +{ + return 0; +} +EXPORT_SYMBOL(clk_set_parent); + static inline u32 get_counter_resolution(void) { u32 res; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2C41C433FE for ; Mon, 24 Jan 2022 19:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354582AbiAXTgr (ORCPT ); Mon, 24 Jan 2022 14:36:47 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:54946 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353025AbiAXTbt (ORCPT ); Mon, 24 Jan 2022 14:31:49 -0500 Received: from smtp.kernel.org (relay.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 49212B81215; Mon, 24 Jan 2022 19:31:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BDD4C340E5; Mon, 24 Jan 2022 19:31:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052707; bh=TYR6G0G1NNZYgGiHfvo4P7O8iCjHHs0h9Uv+G6h0s/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wLEgCA0fM+DeHukj/oXpjTPaLXtLquEGWaVDLjZQXo2dE08AUT9UPEwPT/X2hUCec fyG7c8GXqPIv5ZRQLZa3xOe4p9r9+6vda93T6cqG25J4pUpQDsjrNta931ykNRDKA6 QgpKvnnl+KpdZsRx3YMj4JThEx6pJlxwwvTL27TM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Jonathan Cameron , Florian Fainelli , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.4 149/320] mips: bcm63xx: add support for clk_set_parent() Date: Mon, 24 Jan 2022 19:42:13 +0100 Message-Id: <20220124183958.705625217@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Randy Dunlap [ Upstream commit 6f03055d508ff4feb8db02ba3df9303a1db8d381 ] The MIPS BMC63XX subarch does not provide/support clk_set_parent(). This causes build errors in a few drivers, so add a simple implementation of that function so that callers of it will build without errors. Fixes these build errors: ERROR: modpost: "clk_set_parent" [sound/soc/jz4740/snd-soc-jz4740-i2s.ko] u= ndefined! ERROR: modpost: "clk_set_parent" [sound/soc/atmel/snd-soc-atmel-i2s.ko] und= efined! Fixes: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx f= amily of SOCs." ) Signed-off-by: Randy Dunlap Reviewed-by: Jonathan Cameron Acked-by: Florian Fainelli Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/mips/bcm63xx/clk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c index aba6e2d6a736c..dcfa0ea912fe1 100644 --- a/arch/mips/bcm63xx/clk.c +++ b/arch/mips/bcm63xx/clk.c @@ -387,6 +387,12 @@ struct clk *clk_get_parent(struct clk *clk) } EXPORT_SYMBOL(clk_get_parent); =20 +int clk_set_parent(struct clk *clk, struct clk *parent) +{ + return 0; +} +EXPORT_SYMBOL(clk_set_parent); + unsigned long clk_get_rate(struct clk *clk) { if (!clk) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87C99C433F5 for ; Mon, 24 Jan 2022 19:38:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354605AbiAXTgu (ORCPT ); Mon, 24 Jan 2022 14:36:50 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59192 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345297AbiAXTb4 (ORCPT ); Mon, 24 Jan 2022 14:31:56 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E253361525; Mon, 24 Jan 2022 19:31:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBA8BC340E5; Mon, 24 Jan 2022 19:31:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052713; bh=PULv7iKdPfd6CSRSOX+Xe6qW3RgjiLrKcgWi2KcRGZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R43HKERE4xz9RuXOOxbyzDbUvuun0QwmUf4/7AaUvg4gkibvVeyUliwkDeB5xp33O xcuN0wiTjCCaTjPgS7mfOdV2XrnYwV0/fscKoVm+77sB1ar2MPVzR93rWYfLOZOoAv 4WGvXmjBTagc9pdMJYy00jhlIUplF1YHFa/Y7F7s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kamal Heib , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.4 150/320] RDMA/cxgb4: Set queue pair state when being queried Date: Mon, 24 Jan 2022 19:42:14 +0100 Message-Id: <20220124183958.739216604@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kamal Heib [ Upstream commit e375b9c92985e409c4bb95dd43d34915ea7f5e28 ] The API for ib_query_qp requires the driver to set cur_qp_state on return, add the missing set. Fixes: 67bbc05512d8 ("RDMA/cxgb4: Add query_qp support") Link: https://lore.kernel.org/r/20211220152530.60399-1-kamalheib1@gmail.com Signed-off-by: Kamal Heib Reviewed-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/infiniband/hw/cxgb4/qp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4= /qp.c index 3ac08f47a8ce4..b3fbafbf66555 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c @@ -2469,6 +2469,7 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp= _attr *attr, memset(attr, 0, sizeof(*attr)); memset(init_attr, 0, sizeof(*init_attr)); attr->qp_state =3D to_ib_qp_state(qhp->attr.state); + attr->cur_qp_state =3D to_ib_qp_state(qhp->attr.state); init_attr->cap.max_send_wr =3D qhp->attr.sq_num_entries; init_attr->cap.max_recv_wr =3D qhp->attr.rq_num_entries; init_attr->cap.max_send_sge =3D qhp->attr.sq_max_sges; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BFE8C4321E for ; Mon, 24 Jan 2022 20:29:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383806AbiAXU1t (ORCPT ); Mon, 24 Jan 2022 15:27:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377477AbiAXUFc (ORCPT ); Mon, 24 Jan 2022 15:05:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32E65C08E874; Mon, 24 Jan 2022 11:31:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E322EB81235; Mon, 24 Jan 2022 19:31:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED5C6C340E5; Mon, 24 Jan 2022 19:31:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052716; bh=jcxrBk633Q5y72o5iIj9XdKsxh6Z9iUt7QDvXfWK9l4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0WybXRca0eSCMSeq88U9L0CuZAOP4ZM8Rddg8EOfdmwNLErJy/D2DvTJ7dNEuyjGn yQuLawfNbuXbpGwDVYcFss64V7cEm89aXQvEI2g+w9YKwOLWHVoevloYgFQ3SSj5h+ v37MYjoqkXYW218zFlw56+1Nlr82TM0MFZSrLPQA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Baruch Siach , Rob Herring , Sasha Levin Subject: [PATCH 5.4 151/320] of: base: Fix phandle argument length mismatch error message Date: Mon, 24 Jan 2022 19:42:15 +0100 Message-Id: <20220124183958.775283680@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baruch Siach [ Upstream commit 94a4950a4acff39b5847cc1fee4f65e160813493 ] The cell_count field of of_phandle_iterator is the number of cells we expect in the phandle arguments list when cells_name is missing. The error message should show the number of cells we actually see. Fixes: af3be70a3211 ("of: Improve of_phandle_iterator_next() error message") Cc: Florian Fainelli Signed-off-by: Baruch Siach Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/96519ac55be90a63fa44afe01480c30d08535465.16= 40881913.git.baruch@tkos.co.il Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/of/base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 1d667eb730e19..a240211653789 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1366,9 +1366,9 @@ int of_phandle_iterator_next(struct of_phandle_iterat= or *it) * property data length */ if (it->cur + count > it->list_end) { - pr_err("%pOF: %s =3D %d found %d\n", + pr_err("%pOF: %s =3D %d found %td\n", it->parent, it->cells_name, - count, it->cell_count); + count, it->list_end - it->cur); goto err; } } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9246C2BA4C for ; Mon, 24 Jan 2022 19:37:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354626AbiAXTgw (ORCPT ); Mon, 24 Jan 2022 14:36:52 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59380 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346571AbiAXTcB (ORCPT ); Mon, 24 Jan 2022 14:32:01 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 34AC66121F; Mon, 24 Jan 2022 19:32:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17FBFC340E5; Mon, 24 Jan 2022 19:31:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052719; bh=1qafoHmQHzEeYvZZ5mPQtfK7V5ZbfodQBUKQCPnWoO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z1vDJuXvfXWFIXdmxt2V+JEvXAggnDSeS3cMJ3gFfIpgDLkqo7Bv3QCpBP+DZR5x0 AWGTAl1A689kn2uXywkQUASiFyI/rCKMx4uTouLnhhIG7BlfxYepJY+hlEhzjPanuZ NOiXepZFPBLw5oprbYyype/M0XsaiFRGdklQNN5o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wei Yongjun , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.4 152/320] Bluetooth: Fix debugfs entry leak in hci_register_dev() Date: Mon, 24 Jan 2022 19:42:16 +0100 Message-Id: <20220124183958.807958146@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wei Yongjun [ Upstream commit 5a4bb6a8e981d3d0d492aa38412ee80b21033177 ] Fault injection test report debugfs entry leak as follows: debugfs: Directory 'hci0' with parent 'bluetooth' already present! When register_pm_notifier() failed in hci_register_dev(), the debugfs create by debugfs_create_dir() do not removed in the error handing path. Add the remove debugfs code to fix it. Signed-off-by: Wei Yongjun Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/bluetooth/hci_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index c50e3e8afbd34..2edaa601df13a 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3387,6 +3387,7 @@ int hci_register_dev(struct hci_dev *hdev) return id; =20 err_wqueue: + debugfs_remove_recursive(hdev->debugfs); destroy_workqueue(hdev->workqueue); destroy_workqueue(hdev->req_workqueue); err: --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9D5BC43217 for ; Mon, 24 Jan 2022 20:29:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356822AbiAXU2b (ORCPT ); Mon, 24 Jan 2022 15:28:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377496AbiAXUFd (ORCPT ); Mon, 24 Jan 2022 15:05:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39F7CC08E87B; Mon, 24 Jan 2022 11:32:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EAC57B8125F; Mon, 24 Jan 2022 19:32:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16C2FC340E7; Mon, 24 Jan 2022 19:32:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052722; bh=WJ0l9wBkHylNm8t0kXEqMvXswbr+3A7YmZXxEF2MNFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B1AKckWe+MFjkDgav+L6fCdvKuTdeupaqHhFB2sT9j2Fd4HAz7ptYtGzqsPv7mZMO 186Nazkknkyh3az1yGZFqHeWawNmzklFvNrGc407Nd6ATc5Tro7FHjMkF7Z/BZpMRg yibLoosSJexrqHVF4g+9Xpfhz+DMjRr5GhAA6Emg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland , Sasha Levin Subject: [PATCH 5.4 153/320] fs: dlm: filter user dlm messages for kernel locks Date: Mon, 24 Jan 2022 19:42:17 +0100 Message-Id: <20220124183958.838861997@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Aring [ Upstream commit 6c2e3bf68f3e5e5a647aa52be246d5f552d7496d ] This patch fixes the following crash by receiving a invalid message: [ 160.672220] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ 160.676206] BUG: KASAN: user-memory-access in dlm_user_add_ast+0xc3/0x370 [ 160.679659] Read of size 8 at addr 00000000deadbeef by task kworker/u32:= 13/319 [ 160.681447] [ 160.681824] CPU: 10 PID: 319 Comm: kworker/u32:13 Not tainted 5.14.0-rc2= + #399 [ 160.683472] Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.14.0-1.module+el8= .6.0+12648+6ede71a5 04/01/2014 [ 160.685574] Workqueue: dlm_recv process_recv_sockets [ 160.686721] Call Trace: [ 160.687310] dump_stack_lvl+0x56/0x6f [ 160.688169] ? dlm_user_add_ast+0xc3/0x370 [ 160.689116] kasan_report.cold.14+0x116/0x11b [ 160.690138] ? dlm_user_add_ast+0xc3/0x370 [ 160.690832] dlm_user_add_ast+0xc3/0x370 [ 160.691502] _receive_unlock_reply+0x103/0x170 [ 160.692241] _receive_message+0x11df/0x1ec0 [ 160.692926] ? rcu_read_lock_sched_held+0xa1/0xd0 [ 160.693700] ? rcu_read_lock_bh_held+0xb0/0xb0 [ 160.694427] ? lock_acquire+0x175/0x400 [ 160.695058] ? do_purge.isra.51+0x200/0x200 [ 160.695744] ? lock_acquired+0x360/0x5d0 [ 160.696400] ? lock_contended+0x6a0/0x6a0 [ 160.697055] ? lock_release+0x21d/0x5e0 [ 160.697686] ? lock_is_held_type+0xe0/0x110 [ 160.698352] ? lock_is_held_type+0xe0/0x110 [ 160.699026] ? ___might_sleep+0x1cc/0x1e0 [ 160.699698] ? dlm_wait_requestqueue+0x94/0x140 [ 160.700451] ? dlm_process_requestqueue+0x240/0x240 [ 160.701249] ? down_write_killable+0x2b0/0x2b0 [ 160.701988] ? do_raw_spin_unlock+0xa2/0x130 [ 160.702690] dlm_receive_buffer+0x1a5/0x210 [ 160.703385] dlm_process_incoming_buffer+0x726/0x9f0 [ 160.704210] receive_from_sock+0x1c0/0x3b0 [ 160.704886] ? dlm_tcp_shutdown+0x30/0x30 [ 160.705561] ? lock_acquire+0x175/0x400 [ 160.706197] ? rcu_read_lock_sched_held+0xa1/0xd0 [ 160.706941] ? rcu_read_lock_bh_held+0xb0/0xb0 [ 160.707681] process_recv_sockets+0x32/0x40 [ 160.708366] process_one_work+0x55e/0xad0 [ 160.709045] ? pwq_dec_nr_in_flight+0x110/0x110 [ 160.709820] worker_thread+0x65/0x5e0 [ 160.710423] ? process_one_work+0xad0/0xad0 [ 160.711087] kthread+0x1ed/0x220 [ 160.711628] ? set_kthread_struct+0x80/0x80 [ 160.712314] ret_from_fork+0x22/0x30 The issue is that we received a DLM message for a user lock but the destination lock is a kernel lock. Note that the address which is trying to derefence is 00000000deadbeef, which is in a kernel lock lkb->lkb_astparam, this field should never be derefenced by the DLM kernel stack. In case of a user lock lkb->lkb_astparam is lkb->lkb_ua (memory is shared by a union field). The struct lkb_ua will be handled by the DLM kernel stack but on a kernel lock it will contain invalid data and ends in most likely crashing the kernel. It can be reproduced with two cluster nodes. node 2: dlm_tool join test echo "862 fooobaar 1 2 1" > /sys/kernel/debug/dlm/test_locks echo "862 3 1" > /sys/kernel/debug/dlm/test_waiters node 1: dlm_tool join test python: foo =3D DLM(h_cmd=3D3, o_nextcmd=3D1, h_nodeid=3D1, h_lockspace=3D0x7722202= 7, \ m_type=3D7, m_flags=3D0x1, m_remid=3D0x862, m_result=3D0xFFFEFFFE) newFile =3D open("/sys/kernel/debug/dlm/comms/2/rawmsg", "wb") newFile.write(bytes(foo)) Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/dlm/lock.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 18d81599522f3..53500b555bfa8 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -3975,6 +3975,14 @@ static int validate_message(struct dlm_lkb *lkb, str= uct dlm_message *ms) int from =3D ms->m_header.h_nodeid; int error =3D 0; =20 + /* currently mixing of user/kernel locks are not supported */ + if (ms->m_flags & DLM_IFL_USER && ~lkb->lkb_flags & DLM_IFL_USER) { + log_error(lkb->lkb_resource->res_ls, + "got user dlm message for a kernel lock"); + error =3D -EINVAL; + goto out; + } + switch (ms->m_type) { case DLM_MSG_CONVERT: case DLM_MSG_UNLOCK: @@ -4003,6 +4011,7 @@ static int validate_message(struct dlm_lkb *lkb, stru= ct dlm_message *ms) error =3D -EINVAL; } =20 +out: if (error) log_error(lkb->lkb_resource->res_ls, "ignore invalid message %d from %d %x %x %x %d", --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 251CFC4332F for ; Mon, 24 Jan 2022 19:38:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352812AbiAXThX (ORCPT ); Mon, 24 Jan 2022 14:37:23 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55340 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347666AbiAXTcJ (ORCPT ); Mon, 24 Jan 2022 14:32:09 -0500 Received: from smtp.kernel.org (relay.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 1F548B81232; Mon, 24 Jan 2022 19:32:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A331C36AFB; Mon, 24 Jan 2022 19:32:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052725; bh=heTk60CDtiDxyRuaYkCe/Cwdp8eX4YXc3TH7vtDBWIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bHmEnV6HMrtzpH9dNQnPPc+OjTZ4ZusFmOZYWiwSn/SXa2Ou5zXMqkYHpLuQ47fVx hXXjCTap/0CKFzZnRkZnM5JGXfnvFzI4ogBjpzyaoHWejhppjkOkAWfoaYZzZgyjwy mYVW5eG+ILXRbVSrfQDp0GNJF1OiOKuyZM6Klg00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Yonghong Song , Sasha Levin Subject: [PATCH 5.4 154/320] libbpf: Validate that .BTF and .BTF.ext sections contain data Date: Mon, 24 Jan 2022 19:42:18 +0100 Message-Id: <20220124183958.868121722@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 62554d52e71797eefa3fc15b54008038837bb2d4 ] .BTF and .BTF.ext ELF sections should have SHT_PROGBITS type and contain data. If they are not, ELF is invalid or corrupted, so bail out. Otherwise this can lead to data->d_buf being NULL and SIGSEGV later on. Reported by oss-fuzz project. Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20211103173213.1376990-4-andrii@kernel.org Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- tools/lib/bpf/libbpf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 2a1dbf52fc9a5..54e776886bf1e 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -1578,8 +1578,12 @@ static int bpf_object__elf_collect(struct bpf_object= *obj, int flags) } else if (strcmp(name, MAPS_ELF_SEC) =3D=3D 0) { obj->efile.btf_maps_shndx =3D idx; } else if (strcmp(name, BTF_ELF_SEC) =3D=3D 0) { + if (sh->sh_type !=3D SHT_PROGBITS) + return -LIBBPF_ERRNO__FORMAT; btf_data =3D data; } else if (strcmp(name, BTF_EXT_ELF_SEC) =3D=3D 0) { + if (sh->sh_type !=3D SHT_PROGBITS) + return -LIBBPF_ERRNO__FORMAT; btf_ext_data =3D data; } else if (sh.sh_type =3D=3D SHT_SYMTAB) { if (obj->efile.symbols) { --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4B99C3526D for ; Mon, 24 Jan 2022 19:37:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347410AbiAXThO (ORCPT ); Mon, 24 Jan 2022 14:37:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55356 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347717AbiAXTcL (ORCPT ); Mon, 24 Jan 2022 14:32:11 -0500 Received: from smtp.kernel.org (relay.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 31972B8122C; Mon, 24 Jan 2022 19:32:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 578C8C340E5; Mon, 24 Jan 2022 19:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052728; bh=0Qm+dWNT8phmQ4tU5kIS5Fv5RyW+rZO78HIgmJ65jAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YWMVb79GFm4XZ+8BeXOZEaf+Thcyo4n3U1GUR3Key/R5+qhSlw+xTAPRrhDQeXCSp Ahd0H38mcdCrfD6emf8RMrwzQTogvefL7/y/3qHRrQRZaWuNzlmO40EeiuxruS4sVV gPHHLlCZp8T4Bngbe9X+b+XYeWDjaNBHV13JH5Hk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Khoruzhick , Roman Stratiienko , Qiang Yu , Sasha Levin Subject: [PATCH 5.4 155/320] drm/lima: fix warning when CONFIG_DEBUG_SG=y & CONFIG_DMA_API_DEBUG=y Date: Mon, 24 Jan 2022 19:42:19 +0100 Message-Id: <20220124183958.901709370@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qiang Yu [ Upstream commit 89636a06fa2ee7826a19c39c19a9bc99ab9340a9 ] Otherwise get following warning: DMA-API: lima 1c40000.gpu: mapping sg segment longer than device claims to = support [len=3D4149248] [max=3D65536] See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5496 Reviewed-by: Vasily Khoruzhick Reported-by: Roman Stratiienko Signed-off-by: Qiang Yu Link: https://patchwork.freedesktop.org/patch/msgid/20211031041604.187216-1= -yuq825@gmail.com Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/lima/lima_device.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/lima/lima_device.c b/drivers/gpu/drm/lima/lima= _device.c index d86b8d81a483a..155971c57b2d5 100644 --- a/drivers/gpu/drm/lima/lima_device.c +++ b/drivers/gpu/drm/lima/lima_device.c @@ -293,6 +293,7 @@ int lima_device_init(struct lima_device *ldev) struct resource *res; =20 dma_set_coherent_mask(ldev->dev, DMA_BIT_MASK(32)); + dma_set_max_seg_size(ldev->dev, UINT_MAX); =20 err =3D lima_clk_init(ldev); if (err) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88E17C43217 for ; Mon, 24 Jan 2022 19:38:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354723AbiAXTh1 (ORCPT ); Mon, 24 Jan 2022 14:37:27 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59616 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347861AbiAXTcS (ORCPT ); Mon, 24 Jan 2022 14:32:18 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D124660917; Mon, 24 Jan 2022 19:32:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93AC9C340E5; Mon, 24 Jan 2022 19:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052732; bh=dR6pZiRW7TNa1iTDp9N7qtUKzFnTqgXitlsxGEtbyDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z3r2198i9+pWn/1JH8EF5GEqD7y+KsbTDGYOl9zX24vHx3UBKV+qeWeUy1r7YcGIB QGheXIRI824mgW0d/VYpueE/b/IXTOH2vYrZH5In/A2rEi7UKGusYcnWkEoDXk1xal 2r91mxHweo1l6eCuqlHDpa6VsqRfoVeKggZrAQg4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zekun Shen , Kalle Valo , Sasha Levin Subject: [PATCH 5.4 156/320] ar5523: Fix null-ptr-deref with unexpected WDCMSG_TARGET_START reply Date: Mon, 24 Jan 2022 19:42:20 +0100 Message-Id: <20220124183958.932774879@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zekun Shen [ Upstream commit ae80b6033834342601e99f74f6a62ff5092b1cee ] Unexpected WDCMSG_TARGET_START replay can lead to null-ptr-deref when ar->tx_cmd->odata is NULL. The patch adds a null check to prevent such case. KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] ar5523_cmd+0x46a/0x581 [ar5523] ar5523_probe.cold+0x1b7/0x18da [ar5523] ? ar5523_cmd_rx_cb+0x7a0/0x7a0 [ar5523] ? __pm_runtime_set_status+0x54a/0x8f0 ? _raw_spin_trylock_bh+0x120/0x120 ? pm_runtime_barrier+0x220/0x220 ? __pm_runtime_resume+0xb1/0xf0 usb_probe_interface+0x25b/0x710 really_probe+0x209/0x5d0 driver_probe_device+0xc6/0x1b0 device_driver_attach+0xe2/0x120 I found the bug using a custome USBFuzz port. It's a research work to fuzz USB stack/drivers. I modified it to fuzz ath9k driver only, providing hand-crafted usb descriptors to QEMU. After fixing the code (fourth byte in usb packet) to WDCMSG_TARGET_START, I got the null-ptr-deref bug. I believe the bug is triggerable whenever cmd->odata is NULL. After patching, I tested with the same input and no longer see the KASAN report. This was NOT tested on a real device. Signed-off-by: Zekun Shen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YXsmPQ3awHFLuAj2@10-18-43-117.dynapool.wire= less.nyu.edu Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/wireless/ath/ar5523/ar5523.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireles= s/ath/ar5523/ar5523.c index 4c57e79e5779a..58e189ec672f9 100644 --- a/drivers/net/wireless/ath/ar5523/ar5523.c +++ b/drivers/net/wireless/ath/ar5523/ar5523.c @@ -153,6 +153,10 @@ static void ar5523_cmd_rx_cb(struct urb *urb) ar5523_err(ar, "Invalid reply to WDCMSG_TARGET_START"); return; } + if (!cmd->odata) { + ar5523_err(ar, "Unexpected WDCMSG_TARGET_START reply"); + return; + } memcpy(cmd->odata, hdr + 1, sizeof(u32)); cmd->olen =3D sizeof(u32); cmd->res =3D 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91E11C43219 for ; Mon, 24 Jan 2022 20:29:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384099AbiAXU2w (ORCPT ); Mon, 24 Jan 2022 15:28:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378304AbiAXUGs (ORCPT ); Mon, 24 Jan 2022 15:06:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA72FC02B759; Mon, 24 Jan 2022 11:32:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B2600B81240; Mon, 24 Jan 2022 19:32:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4861C340E5; Mon, 24 Jan 2022 19:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052735; bh=1VvY1q6ys+z/nxaqazZx6mlkGoBLdE1pBlUsSpD+yXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jgpEGF8B5K7niHfmpMJtlmEnW4kfCpow/+RAdupqzyiDBOO9H8ePCj6QzMjDjvDs+ FwI/zjm1ohjZuto9djlNoeXPWGK6rgrj8YNxzT5rf0VXXtVW9g4o9bVr432LVymCg6 rQD6qdkOLNtgz7ZZXVvBMBmbkjaRy0tCEmrngOM0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Diego Viola , Ben Skeggs , Karol Herbst , Sasha Levin Subject: [PATCH 5.4 157/320] drm/nouveau/pmu/gm200-: avoid touching PMU outside of DEVINIT/PREOS/ACR Date: Mon, 24 Jan 2022 19:42:21 +0100 Message-Id: <20220124183958.969793377@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ben Skeggs [ Upstream commit 1d2271d2fb85e54bfc9630a6c30ac0feb9ffb983 ] There have been reports of the WFI timing out on some boards, and a patch was proposed to just remove it. This stuff is rather fragile, and I believe the WFI might be needed with our FW prior to GM200. However, we probably should not be touching PMU during init on GPUs where we depend on NVIDIA FW, outside of limited circumstances, so this should be a somewhat safer change that achieves the desired result. Reported-by: Diego Viola Signed-off-by: Ben Skeggs Reviewed-by: Karol Herbst Signed-off-by: Karol Herbst Link: https://gitlab.freedesktop.org/drm/nouveau/-/merge_requests/10 Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- .../gpu/drm/nouveau/nvkm/subdev/pmu/base.c | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c b/drivers/gpu/d= rm/nouveau/nvkm/subdev/pmu/base.c index ea2e11771bca5..105b4be467a3e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c @@ -88,20 +88,13 @@ nvkm_pmu_fini(struct nvkm_subdev *subdev, bool suspend) return 0; } =20 -static int +static void nvkm_pmu_reset(struct nvkm_pmu *pmu) { struct nvkm_device *device =3D pmu->subdev.device; =20 if (!pmu->func->enabled(pmu)) - return 0; - - /* Inhibit interrupts, and wait for idle. */ - nvkm_wr32(device, 0x10a014, 0x0000ffff); - nvkm_msec(device, 2000, - if (!nvkm_rd32(device, 0x10a04c)) - break; - ); + return; =20 /* Reset. */ if (pmu->func->reset) @@ -112,25 +105,37 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu) if (!(nvkm_rd32(device, 0x10a10c) & 0x00000006)) break; ); - - return 0; } =20 static int nvkm_pmu_preinit(struct nvkm_subdev *subdev) { struct nvkm_pmu *pmu =3D nvkm_pmu(subdev); - return nvkm_pmu_reset(pmu); + nvkm_pmu_reset(pmu); + return 0; } =20 static int nvkm_pmu_init(struct nvkm_subdev *subdev) { struct nvkm_pmu *pmu =3D nvkm_pmu(subdev); - int ret =3D nvkm_pmu_reset(pmu); - if (ret =3D=3D 0 && pmu->func->init) - ret =3D pmu->func->init(pmu); - return ret; + struct nvkm_device *device =3D pmu->subdev.device; + + if (!pmu->func->init) + return 0; + + if (pmu->func->enabled(pmu)) { + /* Inhibit interrupts, and wait for idle. */ + nvkm_wr32(device, 0x10a014, 0x0000ffff); + nvkm_msec(device, 2000, + if (!nvkm_rd32(device, 0x10a04c)) + break; + ); + + nvkm_pmu_reset(pmu); + } + + return pmu->func->init(pmu); } =20 static int --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A051C433EF for ; Mon, 24 Jan 2022 19:38:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349718AbiAXThn (ORCPT ); Mon, 24 Jan 2022 14:37:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59702 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345179AbiAXTcU (ORCPT ); Mon, 24 Jan 2022 14:32:20 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 34B69614A8; Mon, 24 Jan 2022 19:32:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AC78C340E7; Mon, 24 Jan 2022 19:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052738; bh=k/Lz/Zo8RSedFrd/Cb57u0V3RMctMpavMVRb8b8/edc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o+vFfqqBTfdJYK6XzOvdlqAYQFiNPXJx9Un/9tEIbhSbqOlDJOCFlUKGR/rsczmpP eU3xqZ9ugLwIMDI4JmRNom5kU0lvxtDnFd3HbkmXDSA24ghS0AaiKfZimr7FNMW3nU rZii2Ejine6TlSGPT8P8OiLEUlrnplIKqGdhc4o4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wan Jiabing , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.4 158/320] ARM: shmobile: rcar-gen2: Add missing of_node_put() Date: Mon, 24 Jan 2022 19:42:22 +0100 Message-Id: <20220124183959.009971247@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wan Jiabing [ Upstream commit 85744f2d938c5f3cfc44cb6533c157469634da93 ] Fix following coccicheck warning: ./arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c:156:1-33: Function for_each_matching_node_and_match should have of_node_put() before break and goto. Early exits from for_each_matching_node_and_match() should decrement the node reference counter. Signed-off-by: Wan Jiabing Link: https://lore.kernel.org/r/20211018014503.7598-1-wanjiabing@vivo.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/= mach-shmobile/regulator-quirk-rcar-gen2.c index ee949255ced3f..09ef73b99dd86 100644 --- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c +++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c @@ -154,8 +154,10 @@ static int __init rcar_gen2_regulator_quirk(void) return -ENODEV; =20 for_each_matching_node_and_match(np, rcar_gen2_quirk_match, &id) { - if (!of_device_is_available(np)) + if (!of_device_is_available(np)) { + of_node_put(np); break; + } =20 ret =3D of_property_read_u32(np, "reg", &addr); if (ret) /* Skip invalid entry and continue */ @@ -164,6 +166,7 @@ static int __init rcar_gen2_regulator_quirk(void) quirk =3D kzalloc(sizeof(*quirk), GFP_KERNEL); if (!quirk) { ret =3D -ENOMEM; + of_node_put(np); goto err_mem; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE68BC433F5 for ; Mon, 24 Jan 2022 19:38:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349804AbiAXThp (ORCPT ); Mon, 24 Jan 2022 14:37:45 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59736 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351748AbiAXTcW (ORCPT ); Mon, 24 Jan 2022 14:32:22 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 56598614BB; Mon, 24 Jan 2022 19:32:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 397F5C340E5; Mon, 24 Jan 2022 19:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052741; bh=J50OZHN0zvd2GM4+rHZ4BtCzAMe4iStWevzL2oEi4hY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eIrKLVj+S5r31/JrO0BIkU5/x+W9VKRK+ZT5Kn2TnCBnIuXxv47IM3NKCOYQoJRHT xDSu51vD4N8+N0E1q9iujYHGAsHNEQjKSbuXfYrNTrcuaP0gBfrfXfTzmRtzdJenFC geLr3kFkNI+8JZ8I5MSJen1UeLTyg3bDa5tVFIVU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tycho Andersen , =?UTF-8?q?Linus=20L=C3=BCssing?= , Sven Eckelmann , Simon Wunderlich , Sasha Levin Subject: [PATCH 5.4 159/320] batman-adv: allow netlink usage in unprivileged containers Date: Mon, 24 Jan 2022 19:42:23 +0100 Message-Id: <20220124183959.050250496@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus L=C3=BCssing [ Upstream commit 9057d6c23e7388ee9d037fccc9a7bc8557ce277b ] Currently, creating a batman-adv interface in an unprivileged LXD container and attaching secondary interfaces to it with "ip" or "batctl" works fine. However all batctl debug and configuration commands fail: root@container:~# batctl originators Error received: Operation not permitted root@container:~# batctl orig_interval 1000 root@container:~# batctl orig_interval 2000 root@container:~# batctl orig_interval 1000 To fix this change the generic netlink permissions from GENL_ADMIN_PERM to GENL_UNS_ADMIN_PERM. This way a batman-adv interface is fully maintainable as root from within a user namespace, from an unprivileged container. All except one batman-adv netlink setting are per interface and do not leak information or change settings from the host system and are therefore save to retrieve or modify as root from within an unprivileged container. "batctl routing_algo" / BATADV_CMD_GET_ROUTING_ALGOS is the only exception: It provides the batman-adv kernel module wide default routing algorithm. However it is read-only from netlink and an unprivileged container is still not allowed to modify /sys/module/batman_adv/parameters/routing_algo. Instead it is advised to use the newly introduced "batctl if create routing_algo RA_NAME" / IFLA_BATADV_ALGO_NAME to set the routing algorithm on interface creation, which already works fine in an unprivileged container. Cc: Tycho Andersen Signed-off-by: Linus L=C3=BCssing Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/batman-adv/netlink.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c index 7e052d6f759b6..e59c5aa27ee0b 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c @@ -1351,21 +1351,21 @@ static const struct genl_ops batadv_netlink_ops[] = =3D { { .cmd =3D BATADV_CMD_TP_METER, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .doit =3D batadv_netlink_tp_meter_start, .internal_flags =3D BATADV_FLAG_NEED_MESH, }, { .cmd =3D BATADV_CMD_TP_METER_CANCEL, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .doit =3D batadv_netlink_tp_meter_cancel, .internal_flags =3D BATADV_FLAG_NEED_MESH, }, { .cmd =3D BATADV_CMD_GET_ROUTING_ALGOS, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_algo_dump, }, { @@ -1380,68 +1380,68 @@ static const struct genl_ops batadv_netlink_ops[] = =3D { { .cmd =3D BATADV_CMD_GET_TRANSTABLE_LOCAL, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_tt_local_dump, }, { .cmd =3D BATADV_CMD_GET_TRANSTABLE_GLOBAL, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_tt_global_dump, }, { .cmd =3D BATADV_CMD_GET_ORIGINATORS, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_orig_dump, }, { .cmd =3D BATADV_CMD_GET_NEIGHBORS, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_hardif_neigh_dump, }, { .cmd =3D BATADV_CMD_GET_GATEWAYS, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_gw_dump, }, { .cmd =3D BATADV_CMD_GET_BLA_CLAIM, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_bla_claim_dump, }, { .cmd =3D BATADV_CMD_GET_BLA_BACKBONE, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_bla_backbone_dump, }, { .cmd =3D BATADV_CMD_GET_DAT_CACHE, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_dat_cache_dump, }, { .cmd =3D BATADV_CMD_GET_MCAST_FLAGS, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .dumpit =3D batadv_mcast_flags_dump, }, { .cmd =3D BATADV_CMD_SET_MESH, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .doit =3D batadv_netlink_set_mesh, .internal_flags =3D BATADV_FLAG_NEED_MESH, }, { .cmd =3D BATADV_CMD_SET_HARDIF, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .doit =3D batadv_netlink_set_hardif, .internal_flags =3D BATADV_FLAG_NEED_MESH | BATADV_FLAG_NEED_HARDIF, @@ -1457,7 +1457,7 @@ static const struct genl_ops batadv_netlink_ops[] =3D= { { .cmd =3D BATADV_CMD_SET_VLAN, .validate =3D GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags =3D GENL_ADMIN_PERM, + .flags =3D GENL_UNS_ADMIN_PERM, .doit =3D batadv_netlink_set_vlan, .internal_flags =3D BATADV_FLAG_NEED_MESH | BATADV_FLAG_NEED_VLAN, --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ABFEC433FE for ; Mon, 24 Jan 2022 19:42:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346154AbiAXTmj (ORCPT ); Mon, 24 Jan 2022 14:42:39 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55624 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352225AbiAXTce (ORCPT ); Mon, 24 Jan 2022 14:32:34 -0500 Received: from smtp.kernel.org (relay.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 32B45B8122F; Mon, 24 Jan 2022 19:32:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65705C340E5; Mon, 24 Jan 2022 19:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052747; bh=DAO4tYwqdARcTANi8ZVt/gONjK/k/ESqgOqBbagLP1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WgXw+SSDsuHknmkbFyi5Mr1T7qLubIW7S1AaLkSBVQUVJUNO8AcjApBKQW5M56Uas KowftTt+h273oK+K+6Uqke6Zo3KtfjlPOQR2lb/1ZlPgPgsKUmB2qWj5L5R2wIQ20m 1nVnFc+po7czqQGE+tmQj+FsLHtY4PNOmHt/CaRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Keeping , Pavankumar Kondeti , Sasha Levin Subject: [PATCH 5.4 160/320] usb: gadget: f_fs: Use stream_open() for endpoint files Date: Mon, 24 Jan 2022 19:42:24 +0100 Message-Id: <20220124183959.083332678@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavankumar Kondeti [ Upstream commit c76ef96fc00eb398c8fc836b0eb2f82bcc619dc7 ] Function fs endpoint file operations are synchronized via an interruptible mutex wait. However we see threads that do ep file operations concurrently are getting blocked for the mutex lock in __fdget_pos(). This is an uninterruptible wait and we see hung task warnings and kernel panic if hung_task_panic systcl is enabled if host does not send/receive the data for long time. The reason for threads getting blocked in __fdget_pos() is due to the file position protection introduced by the commit 9c225f2655e3 ("vfs: atomic f_pos accesses as per POSIX"). Since function fs endpoint files does not have the notion of the file position, switch to the stream mode. This will bypass the file position mutex and threads will be blocked in interruptible state for the function fs mutex. It should not affects user space as we are only changing the task state changes the task state from UNINTERRUPTIBLE to INTERRUPTIBLE while waiting for the USB transfers to be finished. However there is a slight change to the O_NONBLOCK behavior. Earlier threads that are using O_NONBLOCK are also getting blocked inside fdget_pos(). Now they reach to function fs and error code is returned. The non blocking behavior is actually honoured now. Reviewed-by: John Keeping Signed-off-by: Pavankumar Kondeti Link: https://lore.kernel.org/r/1636712682-1226-1-git-send-email-quic_pkond= eti@quicinc.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/usb/gadget/function/f_fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/functi= on/f_fs.c index 3f5c21f7f9905..2bea33b41553b 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -614,7 +614,7 @@ static int ffs_ep0_open(struct inode *inode, struct fil= e *file) file->private_data =3D ffs; ffs_data_opened(ffs); =20 - return 0; + return stream_open(inode, file); } =20 static int ffs_ep0_release(struct inode *inode, struct file *file) @@ -1156,7 +1156,7 @@ ffs_epfile_open(struct inode *inode, struct file *fil= e) file->private_data =3D epfile; ffs_data_opened(epfile->ffs); =20 - return 0; + return stream_open(inode, file); } =20 static int ffs_aio_cancel(struct kiocb *kiocb) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00DC1C43217 for ; Tue, 25 Jan 2022 02:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3421742AbiAYC1g (ORCPT ); Mon, 24 Jan 2022 21:27:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358987AbiAXUH2 (ORCPT ); Mon, 24 Jan 2022 15:07:28 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03066C029805; Mon, 24 Jan 2022 11:32:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 982436141C; Mon, 24 Jan 2022 19:32:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B623C340E5; Mon, 24 Jan 2022 19:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052751; bh=dxlHkkDhrDWGJRS2ZBt0S7lqBxv/VVktAClM8xc6FqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZBCa+mn/l0J15JxuxJlC/+Iwdu4JrlGU9itMzeXnfOnaT4LpUeTmJBNcaNZXHrNfl NiRD8OCcgo4RADfduaf0sou6ae7GVqeZmLdlUk1xB7tPTaN+brD0SWjihOtCgSc+q2 oquZ+gMFCMU6ZnXyAU6LfdiRfIKHzieToLWh3dlI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yauhen Kharuzhy , Hans de Goede , Simon Ser , Sasha Levin Subject: [PATCH 5.4 161/320] drm: panel-orientation-quirks: Add quirk for the Lenovo Yoga Book X91F/L Date: Mon, 24 Jan 2022 19:42:25 +0100 Message-Id: <20220124183959.121870623@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 bc30c3b0c8a1904d83d5f0d60fb8650a334b207b ] The Lenovo Yoga Book X91F/L uses a panel which has been mounted 90 degrees rotated. Add a quirk for this. Cc: Yauhen Kharuzhy Signed-off-by: Hans de Goede Acked-by: Simon Ser Tested-by: Yauhen Kharuzhy Link: https://patchwork.freedesktop.org/patch/msgid/20211106130227.11927-1-= hdegoede@redhat.com Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/d= rm/drm_panel_orientation_quirks.c index a950d5db211c5..9d1bd8f491ad7 100644 --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -248,6 +248,12 @@ static const struct dmi_system_id orientation_data[] = =3D { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), }, .driver_data =3D (void *)&lcd1200x1920_rightside_up, + }, { /* Lenovo Yoga Book X90F / X91F / X91L */ + .matches =3D { + /* Non exact match to match all versions */ + DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"), + }, + .driver_data =3D (void *)&lcd1200x1920_rightside_up, }, { /* OneGX1 Pro */ .matches =3D { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SYSTEM_MANUFACTURER"), --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7F83C433F5 for ; Mon, 24 Jan 2022 19:42:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347807AbiAXTmb (ORCPT ); Mon, 24 Jan 2022 14:42:31 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55684 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353059AbiAXTcg (ORCPT ); Mon, 24 Jan 2022 14:32:36 -0500 Received: from smtp.kernel.org (relay.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 5995FB81239; Mon, 24 Jan 2022 19:32:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B1E8C340E5; Mon, 24 Jan 2022 19:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052754; bh=1AC9kSNkKHKjHLUFTivSrUAlNSvN3ie5d3LvlLeVE9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oX05IkfEkRBuVElkLlbE7OtBMIVYEqVqyjDz+l3PRLsOpUIPYBC5rESWmGec7FmOu bu1B75JQ1UN0dAothxx6PcaKxgVMt829fC/nDVR1UlwVoGnoZp7gyUUKvjVYEVG1yD BG0PGRs40N9gfL6eFwfAEPJvhjyb6JPXW8KYF5Ow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Jiri Kosina , Sasha Levin Subject: [PATCH 5.4 162/320] HID: apple: Do not reset quirks when the Fn key is not found Date: Mon, 24 Jan 2022 19:42:26 +0100 Message-Id: <20220124183959.157100886@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Jos=C3=A9 Exp=C3=B3sito [ Upstream commit a5fe7864d8ada170f19cc47d176bf8260ffb4263 ] When a keyboard without a function key is detected, instead of removing all quirks, remove only the APPLE_HAS_FN quirk. Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/hid/hid-apple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index 07df64daf7dae..efce31d035ef5 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c @@ -389,7 +389,7 @@ static int apple_input_configured(struct hid_device *hd= ev, =20 if ((asc->quirks & APPLE_HAS_FN) && !asc->fn_found) { hid_info(hdev, "Fn key not found (Apple Wireless Keyboard clone?), disab= ling Fn key handling\n"); - asc->quirks =3D 0; + asc->quirks &=3D ~APPLE_HAS_FN; } =20 return 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0547C4167B for ; Mon, 24 Jan 2022 19:40:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354970AbiAXTjp (ORCPT ); Mon, 24 Jan 2022 14:39:45 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55730 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353078AbiAXTcn (ORCPT ); Mon, 24 Jan 2022 14:32:43 -0500 Received: from smtp.kernel.org (relay.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 93D72B81243; Mon, 24 Jan 2022 19:32:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9890C340E5; Mon, 24 Jan 2022 19:32:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052757; bh=c48g0P2kXom32ZkWk2oniIOiwrvvjuNKadW20KYAa4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r43gWbelS30z4WmaiOL78EdPywGwx31rEDljAyGKLya3poGTBMLiWRDzRW8CibY8l HOFPl75YA1TTESPmmpm7OQR5zo35+/Y9RXFa3OxAvcatV4blmifGl2OOGgaAM+s1T0 mPYiiZBEes9DDvp265ScGxNkX2yluB1VRFeDlUxc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 163/320] media: b2c2: Add missing check in flexcop_pci_isr: Date: Mon, 24 Jan 2022 19:42:27 +0100 Message-Id: <20220124183959.194972317@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheyu Ma [ Upstream commit b13203032e679674c7c518f52a7ec0801ca3a829 ] A out-of-bounds bug can be triggered by an interrupt, the reason for this bug is the lack of checking of register values. In flexcop_pci_isr, the driver reads value from a register and uses it as a dma address. Finally, this address will be passed to the count parameter of find_next_packet. If this value is larger than the size of dma, the index of buffer will be out-of-bounds. Fix this by adding a check after reading the value of the register. The following KASAN report reveals it: BUG: KASAN: slab-out-of-bounds in find_next_packet drivers/media/dvb-core/dvb_demux.c:528 [inline] BUG: KASAN: slab-out-of-bounds in _dvb_dmx_swfilter drivers/media/dvb-core/dvb_demux.c:572 [inline] BUG: KASAN: slab-out-of-bounds in dvb_dmx_swfilter+0x3fa/0x420 drivers/media/dvb-core/dvb_demux.c:603 Read of size 1 at addr ffff8880608c00a0 by task swapper/2/0 CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.19.177-gdba4159c14ef #25 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xec/0x156 lib/dump_stack.c:118 print_address_description+0x78/0x290 mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report+0x25b/0x380 mm/kasan/report.c:412 __asan_report_load1_noabort+0x19/0x20 mm/kasan/report.c:430 find_next_packet drivers/media/dvb-core/dvb_demux.c:528 [inline] _dvb_dmx_swfilter drivers/media/dvb-core/dvb_demux.c:572 [inline] dvb_dmx_swfilter+0x3fa/0x420 drivers/media/dvb-core/dvb_demux.c:603 flexcop_pass_dmx_data+0x2e/0x40 drivers/media/common/b2c2/flexcop.c:167 flexcop_pci_isr+0x3d1/0x5d0 drivers/media/pci/b2c2/flexcop-pci.c:212 __handle_irq_event_percpu+0xfb/0x770 kernel/irq/handle.c:149 handle_irq_event_percpu+0x79/0x150 kernel/irq/handle.c:189 handle_irq_event+0xac/0x140 kernel/irq/handle.c:206 handle_fasteoi_irq+0x232/0x5c0 kernel/irq/chip.c:725 generic_handle_irq_desc include/linux/irqdesc.h:155 [inline] handle_irq+0x230/0x3a0 arch/x86/kernel/irq_64.c:87 do_IRQ+0xa7/0x1e0 arch/x86/kernel/irq.c:247 common_interrupt+0xf/0xf arch/x86/entry/entry_64.S:670 RIP: 0010:native_safe_halt+0x28/0x30 arch/x86/include/asm/irqflags.h:61 Code: 00 00 55 be 04 00 00 00 48 c7 c7 00 62 2f 8c 48 89 e5 e8 fb 31 e8 f8 8b 05 75 4f 8e 03 85 c0 7e 07 0f 00 2d 8a 61 66 00 fb f4 <5d> c3 90 90 90 90 90 90 0f 1f 44 00 00 55 48 89 e5 41 57 41 56 41 RSP: 0018:ffff88806b71fcc8 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffde RAX: 0000000000000000 RBX: ffffffff8bde44c8 RCX: ffffffff88a11285 RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffffff8c2f6200 RBP: ffff88806b71fcc8 R08: fffffbfff185ec40 R09: fffffbfff185ec40 R10: 0000000000000001 R11: fffffbfff185ec40 R12: 0000000000000002 R13: ffffffff8be9d6e0 R14: 0000000000000000 R15: 0000000000000000 arch_safe_halt arch/x86/include/asm/paravirt.h:94 [inline] default_idle+0x6f/0x360 arch/x86/kernel/process.c:557 arch_cpu_idle+0xf/0x20 arch/x86/kernel/process.c:548 default_idle_call+0x3b/0x60 kernel/sched/idle.c:93 cpuidle_idle_call kernel/sched/idle.c:153 [inline] do_idle+0x2ab/0x3c0 kernel/sched/idle.c:263 cpu_startup_entry+0xcb/0xe0 kernel/sched/idle.c:369 start_secondary+0x3b8/0x4e0 arch/x86/kernel/smpboot.c:271 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 Allocated by task 1: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:553 kasan_slab_alloc+0x11/0x20 mm/kasan/kasan.c:490 slab_post_alloc_hook mm/slab.h:445 [inline] slab_alloc_node mm/slub.c:2741 [inline] slab_alloc mm/slub.c:2749 [inline] kmem_cache_alloc+0xeb/0x280 mm/slub.c:2754 kmem_cache_zalloc include/linux/slab.h:699 [inline] __kernfs_new_node+0xe2/0x6f0 fs/kernfs/dir.c:633 kernfs_new_node+0x9a/0x120 fs/kernfs/dir.c:693 __kernfs_create_file+0x5f/0x340 fs/kernfs/file.c:992 sysfs_add_file_mode_ns+0x22a/0x4e0 fs/sysfs/file.c:306 create_files fs/sysfs/group.c:63 [inline] internal_create_group+0x34e/0xc30 fs/sysfs/group.c:147 sysfs_create_group fs/sysfs/group.c:173 [inline] sysfs_create_groups+0x9c/0x140 fs/sysfs/group.c:200 driver_add_groups+0x3e/0x50 drivers/base/driver.c:129 bus_add_driver+0x3a5/0x790 drivers/base/bus.c:684 driver_register+0x1cd/0x410 drivers/base/driver.c:170 __pci_register_driver+0x197/0x200 drivers/pci/pci-driver.c:1411 cx88_audio_pci_driver_init+0x23/0x25 drivers/media/pci/cx88/cx88-alsa.c: 1017 do_one_initcall+0xe0/0x610 init/main.c:884 do_initcall_level init/main.c:952 [inline] do_initcalls init/main.c:960 [inline] do_basic_setup init/main.c:978 [inline] kernel_init_freeable+0x4d0/0x592 init/main.c:1145 kernel_init+0x18/0x190 init/main.c:1062 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 Freed by task 0: (stack is not available) The buggy address belongs to the object at ffff8880608c0000 which belongs to the cache kernfs_node_cache of size 160 The buggy address is located 0 bytes to the right of 160-byte region [ffff8880608c0000, ffff8880608c00a0) The buggy address belongs to the page: page:ffffea0001823000 count:1 mapcount:0 mapping:ffff88806bed1e00 index:0x0 compound_mapcount: 0 flags: 0x100000000008100(slab|head) raw: 0100000000008100 dead000000000100 dead000000000200 ffff88806bed1e00 raw: 0000000000000000 0000000000240024 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880608bff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880608c0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8880608c0080: 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 00 00 ^ ffff8880608c0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880608c0180: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Link: https://lore.kernel.org/linux-media/1620723603-30912-1-git-send-email= -zheyuma97@gmail.com Reported-by: Zheyu Ma Signed-off-by: Zheyu Ma Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/pci/b2c2/flexcop-pci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/pci/b2c2/flexcop-pci.c b/drivers/media/pci/b2c2/= flexcop-pci.c index a9d9520a94c6d..c9e6c7d663768 100644 --- a/drivers/media/pci/b2c2/flexcop-pci.c +++ b/drivers/media/pci/b2c2/flexcop-pci.c @@ -185,6 +185,8 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_i= d) dma_addr_t cur_addr =3D fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2; u32 cur_pos =3D cur_addr - fc_pci->dma[0].dma_addr0; + if (cur_pos > fc_pci->dma[0].size * 2) + goto error; =20 deb_irq("%u irq: %08x cur_addr: %llx: cur_pos: %08x, last_cur_pos: %08x = ", jiffies_to_usecs(jiffies - fc_pci->last_irq), @@ -225,6 +227,7 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_i= d) ret =3D IRQ_NONE; } =20 +error: spin_unlock_irqrestore(&fc_pci->irq_lock, flags); return ret; } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0A25C4321E for ; Mon, 24 Jan 2022 19:40:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354941AbiAXTjn (ORCPT ); Mon, 24 Jan 2022 14:39:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60064 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345636AbiAXTcl (ORCPT ); Mon, 24 Jan 2022 14:32:41 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BFB07612A5; Mon, 24 Jan 2022 19:32:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1C39C340E5; Mon, 24 Jan 2022 19:32:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052760; bh=VKtWU7N1EdLQFZ82cUPjVOMgCStG3PuUh+WUdBvaBIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IDL9ryiZ5UapeP9g2Mv5Pcoo95Eli7SDSW/MSaCnweiMiZRgHhnCRNvjWyBRyRL0p qSdchBxS0xhBHZsHhsVbm3kbF/dHjgVz5lg0xuYiWnIYMsu/InYO/PUd/RjjHm8SH1 sracNhOaNsphrRy+l7dgRdMlQ6rK/YjrjkQrULR8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinh Nguyen , Borislav Petkov , Michal Simek , Sasha Levin Subject: [PATCH 5.4 164/320] EDAC/synopsys: Use the quirk for version instead of ddr version Date: Mon, 24 Jan 2022 19:42:28 +0100 Message-Id: <20220124183959.233834958@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dinh Nguyen [ Upstream commit bd1d6da17c296bd005bfa656952710d256e77dd3 ] Version 2.40a supports DDR_ECC_INTR_SUPPORT for a quirk, so use that quirk to determine a call to setup_address_map(). Signed-off-by: Dinh Nguyen Signed-off-by: Borislav Petkov Reviewed-by: Michal Simek Link: https://lkml.kernel.org/r/20211012190709.1504152-1-dinguyen@kernel.org Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/edac/synopsys_edac.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c index 6becf3363ad57..d23a0782fb49c 100644 --- a/drivers/edac/synopsys_edac.c +++ b/drivers/edac/synopsys_edac.c @@ -1351,8 +1351,7 @@ static int mc_probe(struct platform_device *pdev) } } =20 - if (of_device_is_compatible(pdev->dev.of_node, - "xlnx,zynqmp-ddrc-2.40a")) + if (priv->p_data->quirks & DDR_ECC_INTR_SUPPORT) setup_address_map(priv); #endif =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6095C433FE for ; Mon, 24 Jan 2022 19:38:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347734AbiAXTh6 (ORCPT ); Mon, 24 Jan 2022 14:37:58 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55826 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343972AbiAXTcq (ORCPT ); Mon, 24 Jan 2022 14:32:46 -0500 Received: from smtp.kernel.org (relay.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 9B630B81240; Mon, 24 Jan 2022 19:32:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9EECC340E5; Mon, 24 Jan 2022 19:32:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052763; bh=OQKY68uSZxyTkO1zyDzrFf7bb6/e1IwkJ1PbxxVpPVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wkS3yTSypTKPiE/W6/UAOTimpHdfsLE3VwT9rdoCcW3dTy9QDU8z6/fmCkpPiFN5P 4IHtXFQn7s2eVlL5QO6qWh+gHHdTw4NhfPqRxH6tOhvwDHU1h8m4JoeLa86k7/E6yB HoGzY0X1rw/e3oF27uOxwbxPurfGenYYt4QsEbgM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Bulwahn , Arnd Bergmann , Shawn Guo , Sasha Levin Subject: [PATCH 5.4 165/320] ARM: imx: rename DEBUG_IMX21_IMX27_UART to DEBUG_IMX27_UART Date: Mon, 24 Jan 2022 19:42:29 +0100 Message-Id: <20220124183959.273107606@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Bulwahn [ Upstream commit b0100bce4ff82ec1ccd3c1f3d339fd2df6a81784 ] Since commit 4b563a066611 ("ARM: imx: Remove imx21 support"), the config DEBUG_IMX21_IMX27_UART is really only debug support for IMX27. So, rename this option to DEBUG_IMX27_UART and adjust dependencies in Kconfig and rename the definitions to IMX27 as further clean-up. This issue was discovered with ./scripts/checkkconfigsymbols.py, which reported that DEBUG_IMX21_IMX27_UART depends on the non-existing config SOC_IMX21. Signed-off-by: Lukas Bulwahn Reviewed-by: Arnd Bergmann Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm/Kconfig.debug | 14 +++++++------- arch/arm/include/debug/imx-uart.h | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 8bcbd0cd739b5..5e2b44a9df18c 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -400,12 +400,12 @@ choice Say Y here if you want kernel low-level debugging support on i.MX25. =20 - config DEBUG_IMX21_IMX27_UART - bool "i.MX21 and i.MX27 Debug UART" - depends on SOC_IMX21 || SOC_IMX27 + config DEBUG_IMX27_UART + bool "i.MX27 Debug UART" + depends on SOC_IMX27 help Say Y here if you want kernel low-level debugging support - on i.MX21 or i.MX27. + on i.MX27. =20 config DEBUG_IMX28_UART bool "i.MX28 Debug UART" @@ -1472,7 +1472,7 @@ config DEBUG_IMX_UART_PORT int "i.MX Debug UART Port Selection" depends on DEBUG_IMX1_UART || \ DEBUG_IMX25_UART || \ - DEBUG_IMX21_IMX27_UART || \ + DEBUG_IMX27_UART || \ DEBUG_IMX31_UART || \ DEBUG_IMX35_UART || \ DEBUG_IMX50_UART || \ @@ -1529,12 +1529,12 @@ config DEBUG_LL_INCLUDE default "debug/icedcc.S" if DEBUG_ICEDCC default "debug/imx.S" if DEBUG_IMX1_UART || \ DEBUG_IMX25_UART || \ - DEBUG_IMX21_IMX27_UART || \ + DEBUG_IMX27_UART || \ DEBUG_IMX31_UART || \ DEBUG_IMX35_UART || \ DEBUG_IMX50_UART || \ DEBUG_IMX51_UART || \ - DEBUG_IMX53_UART ||\ + DEBUG_IMX53_UART || \ DEBUG_IMX6Q_UART || \ DEBUG_IMX6SL_UART || \ DEBUG_IMX6SX_UART || \ diff --git a/arch/arm/include/debug/imx-uart.h b/arch/arm/include/debug/imx= -uart.h index c8eb83d4b8964..3edbb3c5b42bf 100644 --- a/arch/arm/include/debug/imx-uart.h +++ b/arch/arm/include/debug/imx-uart.h @@ -11,13 +11,6 @@ #define IMX1_UART_BASE_ADDR(n) IMX1_UART##n##_BASE_ADDR #define IMX1_UART_BASE(n) IMX1_UART_BASE_ADDR(n) =20 -#define IMX21_UART1_BASE_ADDR 0x1000a000 -#define IMX21_UART2_BASE_ADDR 0x1000b000 -#define IMX21_UART3_BASE_ADDR 0x1000c000 -#define IMX21_UART4_BASE_ADDR 0x1000d000 -#define IMX21_UART_BASE_ADDR(n) IMX21_UART##n##_BASE_ADDR -#define IMX21_UART_BASE(n) IMX21_UART_BASE_ADDR(n) - #define IMX25_UART1_BASE_ADDR 0x43f90000 #define IMX25_UART2_BASE_ADDR 0x43f94000 #define IMX25_UART3_BASE_ADDR 0x5000c000 @@ -26,6 +19,13 @@ #define IMX25_UART_BASE_ADDR(n) IMX25_UART##n##_BASE_ADDR #define IMX25_UART_BASE(n) IMX25_UART_BASE_ADDR(n) =20 +#define IMX27_UART1_BASE_ADDR 0x1000a000 +#define IMX27_UART2_BASE_ADDR 0x1000b000 +#define IMX27_UART3_BASE_ADDR 0x1000c000 +#define IMX27_UART4_BASE_ADDR 0x1000d000 +#define IMX27_UART_BASE_ADDR(n) IMX27_UART##n##_BASE_ADDR +#define IMX27_UART_BASE(n) IMX27_UART_BASE_ADDR(n) + #define IMX31_UART1_BASE_ADDR 0x43f90000 #define IMX31_UART2_BASE_ADDR 0x43f94000 #define IMX31_UART3_BASE_ADDR 0x5000c000 @@ -112,10 +112,10 @@ =20 #ifdef CONFIG_DEBUG_IMX1_UART #define UART_PADDR IMX_DEBUG_UART_BASE(IMX1) -#elif defined(CONFIG_DEBUG_IMX21_IMX27_UART) -#define UART_PADDR IMX_DEBUG_UART_BASE(IMX21) #elif defined(CONFIG_DEBUG_IMX25_UART) #define UART_PADDR IMX_DEBUG_UART_BASE(IMX25) +#elif defined(CONFIG_DEBUG_IMX27_UART) +#define UART_PADDR IMX_DEBUG_UART_BASE(IMX27) #elif defined(CONFIG_DEBUG_IMX31_UART) #define UART_PADDR IMX_DEBUG_UART_BASE(IMX31) #elif defined(CONFIG_DEBUG_IMX35_UART) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4F2AC4167E for ; Mon, 24 Jan 2022 19:41:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345605AbiAXTkp (ORCPT ); Mon, 24 Jan 2022 14:40:45 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57354 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353535AbiAXTe5 (ORCPT ); Mon, 24 Jan 2022 14:34:57 -0500 Received: from smtp.kernel.org (relay.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 5D8A1B81215; Mon, 24 Jan 2022 19:34:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BB9AC340E5; Mon, 24 Jan 2022 19:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052895; bh=ot27nxBOMITcF6fRXuYtehlwri265v9oIoxpy+iAVNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JUnLxchYRLufPenOhXlP2hgzIzKpE7BKopnwwFZS1hXoiH0N2fKwLbZ7qh5kx19c8 /w6K5N7Sp9YqGqw3r7o26uzAQ2PuP5RttuLj++WEYxic7Vwn4erds0JGUYDwfsxWz1 mcjwYmmn90ux46DEGSBbN2FmpP1luoWsrsvUdh78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Biederman , Danielle Ratson , Ido Schimmel , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 166/320] mlxsw: pci: Add shutdown method in PCI driver Date: Mon, 24 Jan 2022 19:42:30 +0100 Message-Id: <20220124183959.314851203@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Danielle Ratson [ Upstream commit c1020d3cf4752f61a6a413f632ea2ce2370e150d ] On an arm64 platform with the Spectrum ASIC, after loading and executing a new kernel via kexec, the following trace [1] is observed. This seems to be caused by the fact that the device is not properly shutdown before executing the new kernel. Fix this by implementing a shutdown method which mirrors the remove method, as recommended by the kexec maintainer [2][3]. [1] BUG: Bad page state in process devlink pfn:22f73d page:fffffe00089dcf40 refcount:-1 mapcount:0 mapping:0000000000000000 index= :0x0 flags: 0x2ffff00000000000() raw: 2ffff00000000000 0000000000000000 ffffffff089d0201 0000000000000000 raw: 0000000000000000 0000000000000000 ffffffffffffffff 0000000000000000 page dumped because: nonzero _refcount Modules linked in: CPU: 1 PID: 16346 Comm: devlink Tainted: G B 5.8.0-rc6-custom-273020-gac6b3= 65b1bf5 #44 Hardware name: Marvell Armada 7040 TX4810M (DT) Call trace: dump_backtrace+0x0/0x1d0 show_stack+0x1c/0x28 dump_stack+0xbc/0x118 bad_page+0xcc/0xf8 check_free_page_bad+0x80/0x88 __free_pages_ok+0x3f8/0x418 __free_pages+0x38/0x60 kmem_freepages+0x200/0x2a8 slab_destroy+0x28/0x68 slabs_destroy+0x60/0x90 ___cache_free+0x1b4/0x358 kfree+0xc0/0x1d0 skb_free_head+0x2c/0x38 skb_release_data+0x110/0x1a0 skb_release_all+0x2c/0x38 consume_skb+0x38/0x130 __dev_kfree_skb_any+0x44/0x50 mlxsw_pci_rdq_fini+0x8c/0xb0 mlxsw_pci_queue_fini.isra.0+0x28/0x58 mlxsw_pci_queue_group_fini+0x58/0x88 mlxsw_pci_aqs_fini+0x2c/0x60 mlxsw_pci_fini+0x34/0x50 mlxsw_core_bus_device_unregister+0x104/0x1d0 mlxsw_devlink_core_bus_device_reload_down+0x2c/0x48 devlink_reload+0x44/0x158 devlink_nl_cmd_reload+0x270/0x290 genl_rcv_msg+0x188/0x2f0 netlink_rcv_skb+0x5c/0x118 genl_rcv+0x3c/0x50 netlink_unicast+0x1bc/0x278 netlink_sendmsg+0x194/0x390 __sys_sendto+0xe0/0x158 __arm64_sys_sendto+0x2c/0x38 el0_svc_common.constprop.0+0x70/0x168 do_el0_svc+0x28/0x88 el0_sync_handler+0x88/0x190 el0_sync+0x140/0x180 [2] https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1195432.html [3] https://patchwork.kernel.org/project/linux-scsi/patch/20170212214920.28866-= 1-anton@ozlabs.org/#20116693 Cc: Eric Biederman Signed-off-by: Danielle Ratson Signed-off-by: Ido Schimmel Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlxsw/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethern= et/mellanox/mlxsw/pci.c index aa4fef7890841..ff331251a019a 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c @@ -1876,6 +1876,7 @@ int mlxsw_pci_driver_register(struct pci_driver *pci_= driver) { pci_driver->probe =3D mlxsw_pci_probe; pci_driver->remove =3D mlxsw_pci_remove; + pci_driver->shutdown =3D mlxsw_pci_remove; return pci_register_driver(pci_driver); } EXPORT_SYMBOL(mlxsw_pci_driver_register); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26107C4332F for ; Mon, 24 Jan 2022 19:39:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348533AbiAXTi6 (ORCPT ); Mon, 24 Jan 2022 14:38:58 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56192 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349041AbiAXTdL (ORCPT ); Mon, 24 Jan 2022 14:33:11 -0500 Received: from smtp.kernel.org (relay.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 8CBF3B8121C; Mon, 24 Jan 2022 19:33:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B67E6C340E5; Mon, 24 Jan 2022 19:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052788; bh=L1FZY7oupMnV4r+qLrtX4HeBx/mqsF0svfINSM539tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MZtrGVR4w6J9W9jwR0pY92og4AQyVlSEsDk24ffNbuZksNxmCyktO7yOsdJgS/eyE EFuc9mWvoCpZXpnSEzVMEuRLEVapco3XAbxXaCX+5JLqrBBwaahh1BIaMzjkrYDV1g NyEkv68WR2SuCYXj28ROqoakVUX219TseXmhLFaw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martyn Welch , Peter Senna Tschudin , Martyn Welch , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sasha Levin Subject: [PATCH 5.4 167/320] drm/bridge: megachips: Ensure both bridges are probed before registration Date: Mon, 24 Jan 2022 19:42:31 +0100 Message-Id: <20220124183959.352113508@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Martyn Welch [ Upstream commit 11632d4aa2b3f126790e81a4415d6c23103cf8bb ] In the configuration used by the b850v3, the STDP2690 is used to read EDID data whilst it's the STDP4028 which can detect when monitors are connected. This can result in problems at boot with monitors connected when the STDP4028 is probed first, a monitor is detected and an attempt is made to read the EDID data before the STDP2690 has probed: [ 3.795721] Unable to handle kernel NULL pointer dereference at virtual = address 00000018 [ 3.803845] pgd =3D (ptrval) [ 3.806581] [00000018] *pgd=3D00000000 [ 3.810180] Internal error: Oops: 5 [#1] SMP ARM [ 3.814813] Modules linked in: [ 3.817879] CPU: 0 PID: 64 Comm: kworker/u4:1 Not tainted 5.15.0 #1 [ 3.824161] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [ 3.830705] Workqueue: events_unbound deferred_probe_work_func [ 3.836565] PC is at stdp2690_get_edid+0x44/0x19c [ 3.841286] LR is at ge_b850v3_lvds_get_modes+0x2c/0x5c [ 3.846526] pc : [<805eae10>] lr : [<805eb138>] psr: 80000013 [ 3.852802] sp : 81c359d0 ip : 7dbb550b fp : 81c35a1c [ 3.858037] r10: 81c73840 r9 : 81c73894 r8 : 816d9800 [ 3.863270] r7 : 00000000 r6 : 81c34000 r5 : 00000000 r4 : 810c35f0 [ 3.869808] r3 : 80e3e294 r2 : 00000080 r1 : 00000cc0 r0 : 81401180 [ 3.876349] Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment= none [ 3.883499] Control: 10c5387d Table: 1000404a DAC: 00000051 [ 3.889254] Register r0 information: slab kmem_cache start 81401180 poin= ter offset 0 [ 3.897034] Register r1 information: non-paged memory [ 3.902097] Register r2 information: non-paged memory [ 3.907160] Register r3 information: non-slab/vmalloc memory [ 3.912832] Register r4 information: non-slab/vmalloc memory [ 3.918503] Register r5 information: NULL pointer [ 3.923217] Register r6 information: non-slab/vmalloc memory [ 3.928887] Register r7 information: NULL pointer [ 3.933601] Register r8 information: slab kmalloc-1k start 816d9800 poin= ter offset 0 size 1024 [ 3.942244] Register r9 information: slab kmalloc-2k start 81c73800 poin= ter offset 148 size 2048 [ 3.951058] Register r10 information: slab kmalloc-2k start 81c73800 poi= nter offset 64 size 2048 [ 3.959873] Register r11 information: non-slab/vmalloc memory [ 3.965632] Register r12 information: non-paged memory [ 3.970781] Process kworker/u4:1 (pid: 64, stack limit =3D 0x(ptrval)) [ 3.977148] Stack: (0x81c359d0 to 0x81c36000) [ 3.981517] 59c0: 80b2b668 80b2b5bc = 000002e2 0000034e [ 3.989712] 59e0: 81c35a8c 816d98e8 81c35a14 7dbb550b 805bfcd0 810c35f0 = 81c73840 824addc0 [ 3.997906] 5a00: 00001000 816d9800 81c73894 81c73840 81c35a34 81c35a20 = 805eb138 805eadd8 [ 4.006099] 5a20: 810c35f0 00000045 81c35adc 81c35a38 80594188 805eb118 = 80d7c788 80dd1848 [ 4.014292] 5a40: 00000000 81c35a50 80dca950 811194d3 80dca7c4 80dca944 = 80dca91c 816d9800 [ 4.022485] 5a60: 81c34000 81c760a8 816d9800 80c58c98 810c35f0 816d98e8 = 00001000 00001000 [ 4.030678] 5a80: 00000000 00000000 8017712c 81c60000 00000002 00000001 = 00000000 00000000 [ 4.038870] 5aa0: 816d9900 816d9900 00000000 7dbb550b 805c700c 00000008 = 826282c8 826282c8 [ 4.047062] 5ac0: 00001000 81e1ce40 00001000 00000002 81c35bf4 81c35ae0 = 805d9694 80593fc0 [ 4.055255] 5ae0: 8017a970 80179ad8 00000179 00000000 81c35bcc 81c35b00 = 80177108 8017a950 [ 4.063447] 5b00: 00000000 81c35b10 81c34000 00000000 81004fd8 81010a38 = 00000000 00000059 [ 4.071639] 5b20: 816d98d4 81fbb718 00000013 826282c8 8017a940 81c35b40 = 81134448 00000400 [ 4.079831] 5b40: 00000178 00000000 e063b9c1 00000000 c2000049 00000040 = 00000000 00000008 [ 4.088024] 5b60: 82628300 82628380 00000000 00000000 81c34000 00000000 = 81fbb700 82628340 [ 4.096216] 5b80: 826283c0 00001000 00000000 00000010 816d9800 826282c0 = 801766f8 00000000 [ 4.104408] 5ba0: 00000000 81004fd8 00000049 00000000 00000000 00000001 = 80dcf940 80178de4 [ 4.112601] 5bc0: 81c35c0c 7dbb550b 80178de4 81fbb700 00000010 00000010 = 810c35f4 81e1ce40 [ 4.120793] 5be0: 81c40908 0000000c 81c35c64 81c35bf8 805a7f18 805d94a0 = 81c35c3c 816d9800 [ 4.128985] 5c00: 00000010 81c34000 81c35c2c 81c35c18 8012fce0 805be90c = 81c35c3c 81c35c28 [ 4.137178] 5c20: 805be90c 80173210 81fbb600 81fbb6b4 81c35c5c 7dbb550b = 81c35c64 81fbb700 [ 4.145370] 5c40: 816d9800 00000010 810c35f4 81e1ce40 81c40908 0000000c = 81c35c84 81c35c68 [ 4.153565] 5c60: 805a8c78 805a7ed0 816d9800 81fbb700 00000010 00000000 = 81c35cac 81c35c88 [ 4.161758] 5c80: 805a8dc4 805a8b68 816d9800 00000000 816d9800 00000000 = 8179f810 810c42d0 [ 4.169950] 5ca0: 81c35ccc 81c35cb0 805e47b0 805a8d18 824aa240 81e1ea80 = 81c40908 81126b60 [ 4.178144] 5cc0: 81c35d14 81c35cd0 8060db1c 805e46cc 81c35d14 81c35ce0 = 80dd90f8 810c4d58 [ 4.186338] 5ce0: 80dd90dc 81fe9740 fffffffe 81fe9740 81e1ea80 00000000 = 810c4d6c 80c4b95c [ 4.194531] 5d00: 80dd9a3c 815c6810 81c35d34 81c35d18 8060dc9c 8060d8fc = 8246b440 815c6800 [ 4.202724] 5d20: 815c6810 eefd8e00 81c35d44 81c35d38 8060dd80 8060dbec = 81c35d6c 81c35d48 [ 4.210918] 5d40: 805e98a4 8060dd70 00000000 815c6810 810c45b0 81126e90 = 81126e90 80dd9a3c [ 4.219112] 5d60: 81c35d8c 81c35d70 80619574 805e9808 815c6810 00000000 = 810c45b0 81126e90 [ 4.227305] 5d80: 81c35db4 81c35d90 806168dc 80619514 80625df0 80623c80 = 815c6810 810c45b0 [ 4.235498] 5da0: 81c35e6c 815c6810 81c35dec 81c35db8 80616d04 80616800 = 81c35de4 81c35dc8 [ 4.243691] 5dc0: 808382b0 80b2f444 8116e310 8116e314 81c35e6c 815c6810 = 00000003 80dd9a3c [ 4.251884] 5de0: 81c35e14 81c35df0 80616ec8 80616c60 00000001 810c45b0 = 81c35e6c 815c6810 [ 4.260076] 5e00: 00000001 80dd9a3c 81c35e34 81c35e18 80617338 80616e90 = 00000000 81c35e6c [ 4.268269] 5e20: 80617284 81c34000 81c35e64 81c35e38 80614730 80617290 = 81c35e64 8171a06c [ 4.276461] 5e40: 81e220b8 7dbb550b 815c6810 81c34000 815c6854 81126e90 = 81c35e9c 81c35e68 [ 4.284654] 5e60: 8061673c 806146a8 8060f5e0 815c6810 00000001 7dbb550b = 00000000 810c5080 [ 4.292847] 5e80: 810c5320 815c6810 81126e90 00000000 81c35eac 81c35ea0 = 80617554 80616650 [ 4.301040] 5ea0: 81c35ecc 81c35eb0 80615694 80617544 810c5080 810c5080 = 810c5094 81126e90 [ 4.309233] 5ec0: 81c35efc 81c35ed0 80615c6c 8061560c 80615bc0 810c50c0 = 817eeb00 81412800 [ 4.317425] 5ee0: 814c3000 00000000 814c300d 81119a60 81c35f3c 81c35f00 = 80141488 80615bcc [ 4.325618] 5f00: 81c60000 81c34000 81c35f24 81c35f18 80143078 817eeb00 = 81412800 817eeb18 [ 4.333811] 5f20: 81412818 81003d00 00000088 81412800 81c35f74 81c35f40 = 80141a48 80141298 [ 4.342005] 5f40: 81c35f74 81c34000 801481ac 817efa40 817efc00 801417d8 = 817eeb00 00000000 [ 4.350199] 5f60: 815a7e7c 81c34000 81c35fac 81c35f78 80149b1c 801417e4 = 817efc20 817efc20 [ 4.358391] 5f80: ffffe000 817efa40 801499a8 00000000 00000000 00000000 = 00000000 00000000 [ 4.366583] 5fa0: 00000000 81c35fb0 80100130 801499b4 00000000 00000000 = 00000000 00000000 [ 4.374774] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 = 00000000 00000000 [ 4.382966] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 = 00000000 00000000 [ 4.391155] Backtrace: [ 4.393613] [<805eadcc>] (stdp2690_get_edid) from [<805eb138>] (ge_b850v= 3_lvds_get_modes+0x2c/0x5c) [ 4.402691] r10:81c73840 r9:81c73894 r8:816d9800 r7:00001000 r6:824addc= 0 r5:81c73840 [ 4.410534] r4:810c35f0 [ 4.413073] [<805eb10c>] (ge_b850v3_lvds_get_modes) from [<80594188>] (d= rm_helper_probe_single_connector_modes+0x1d4/0x84c) [ 4.424240] r5:00000045 r4:810c35f0 [ 4.427822] [<80593fb4>] (drm_helper_probe_single_connector_modes) from = [<805d9694>] (drm_client_modeset_probe+0x200/0x1384) [ 4.439074] r10:00000002 r9:00001000 r8:81e1ce40 r7:00001000 r6:826282c= 8 r5:826282c8 [ 4.446917] r4:00000008 [ 4.449455] [<805d9494>] (drm_client_modeset_probe) from [<805a7f18>] (_= _drm_fb_helper_initial_config_and_unlock+0x54/0x5b4) [ 4.460713] r10:0000000c r9:81c40908 r8:81e1ce40 r7:810c35f4 r6:0000001= 0 r5:00000010 [ 4.468556] r4:81fbb700 [ 4.471095] [<805a7ec4>] (__drm_fb_helper_initial_config_and_unlock) fro= m [<805a8c78>] (drm_fbdev_client_hotplug+0x11c/0x1b0) [ 4.482434] r10:0000000c r9:81c40908 r8:81e1ce40 r7:810c35f4 r6:0000001= 0 r5:816d9800 [ 4.490276] r4:81fbb700 [ 4.492814] [<805a8b5c>] (drm_fbdev_client_hotplug) from [<805a8dc4>] (d= rm_fbdev_generic_setup+0xb8/0x1a4) [ 4.502494] r7:00000000 r6:00000010 r5:81fbb700 r4:816d9800 [ 4.508160] [<805a8d0c>] (drm_fbdev_generic_setup) from [<805e47b0>] (im= x_drm_bind+0xf0/0x130) [ 4.516805] r7:810c42d0 r6:8179f810 r5:00000000 r4:816d9800 [ 4.522474] [<805e46c0>] (imx_drm_bind) from [<8060db1c>] (try_to_bring_= up_master+0x22c/0x2f0) [ 4.531116] r7:81126b60 r6:81c40908 r5:81e1ea80 r4:824aa240 [ 4.536783] [<8060d8f0>] (try_to_bring_up_master) from [<8060dc9c>] (__c= omponent_add+0xbc/0x184) [ 4.545597] r10:815c6810 r9:80dd9a3c r8:80c4b95c r7:810c4d6c r6:0000000= 0 r5:81e1ea80 [ 4.553440] r4:81fe9740 [ 4.555980] [<8060dbe0>] (__component_add) from [<8060dd80>] (component_= add+0x1c/0x20) [ 4.563921] r7:eefd8e00 r6:815c6810 r5:815c6800 r4:8246b440 [ 4.569589] [<8060dd64>] (component_add) from [<805e98a4>] (dw_hdmi_imx_= probe+0xa8/0xe8) [ 4.577702] [<805e97fc>] (dw_hdmi_imx_probe) from [<80619574>] (platform= _probe+0x6c/0xc8) [ 4.585908] r9:80dd9a3c r8:81126e90 r7:81126e90 r6:810c45b0 r5:815c6810= r4:00000000 [ 4.593662] [<80619508>] (platform_probe) from [<806168dc>] (really_prob= e+0xe8/0x460) [ 4.601524] r7:81126e90 r6:810c45b0 r5:00000000 r4:815c6810 [ 4.607191] [<806167f4>] (really_probe) from [<80616d04>] (__driver_prob= e_device+0xb0/0x230) [ 4.615658] r7:815c6810 r6:81c35e6c r5:810c45b0 r4:815c6810 [ 4.621326] [<80616c54>] (__driver_probe_device) from [<80616ec8>] (driv= er_probe_device+0x44/0xe0) [ 4.630313] r9:80dd9a3c r8:00000003 r7:815c6810 r6:81c35e6c r5:8116e314= r4:8116e310 [ 4.638068] [<80616e84>] (driver_probe_device) from [<80617338>] (__devi= ce_attach_driver+0xb4/0x12c) [ 4.647227] r9:80dd9a3c r8:00000001 r7:815c6810 r6:81c35e6c r5:810c45b0= r4:00000001 [ 4.654981] [<80617284>] (__device_attach_driver) from [<80614730>] (bus= _for_each_drv+0x94/0xd8) [ 4.663794] r7:81c34000 r6:80617284 r5:81c35e6c r4:00000000 [ 4.669461] [<8061469c>] (bus_for_each_drv) from [<8061673c>] (__device_= attach+0xf8/0x190) [ 4.677753] r7:81126e90 r6:815c6854 r5:81c34000 r4:815c6810 [ 4.683419] [<80616644>] (__device_attach) from [<80617554>] (device_ini= tial_probe+0x1c/0x20) [ 4.691971] r8:00000000 r7:81126e90 r6:815c6810 r5:810c5320 r4:810c5080 [ 4.698681] [<80617538>] (device_initial_probe) from [<80615694>] (bus_p= robe_device+0x94/0x9c) [ 4.707318] [<80615600>] (bus_probe_device) from [<80615c6c>] (deferred_= probe_work_func+0xac/0xf0) [ 4.716305] r7:81126e90 r6:810c5094 r5:810c5080 r4:810c5080 [ 4.721973] [<80615bc0>] (deferred_probe_work_func) from [<80141488>] (p= rocess_one_work+0x1fc/0x54c) [ 4.731139] r10:81119a60 r9:814c300d r8:00000000 r7:814c3000 r6:8141280= 0 r5:817eeb00 [ 4.738981] r4:810c50c0 r3:80615bc0 [ 4.742563] [<8014128c>] (process_one_work) from [<80141a48>] (worker_th= read+0x270/0x570) [ 4.750765] r10:81412800 r9:00000088 r8:81003d00 r7:81412818 r6:817eeb1= 8 r5:81412800 [ 4.758608] r4:817eeb00 [ 4.761147] [<801417d8>] (worker_thread) from [<80149b1c>] (kthread+0x17= 4/0x190) [ 4.768574] r10:81c34000 r9:815a7e7c r8:00000000 r7:817eeb00 r6:801417d= 8 r5:817efc00 [ 4.776417] r4:817efa40 [ 4.778955] [<801499a8>] (kthread) from [<80100130>] (ret_from_fork+0x14= /0x24) [ 4.786201] Exception stack(0x81c35fb0 to 0x81c35ff8) [ 4.791266] 5fa0: 00000000 00000000 = 00000000 00000000 [ 4.799459] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 = 00000000 00000000 [ 4.807651] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 [ 4.814279] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:0000000= 0 r5:801499a8 [ 4.822120] r4:817efa40 [ 4.824664] Code: e3a02080 e593001c e3a01d33 e3a05000 (e5979018) Split the registration from the STDP4028 probe routine and only perform registration once both the STDP4028 and STDP2690 have probed. Signed-off-by: Martyn Welch CC: Peter Senna Tschudin CC: Martyn Welch CC: Neil Armstrong CC: Robert Foss CC: Laurent Pinchart CC: Jonas Karlman CC: Jernej Skrabec Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/43552c3404e8fdf92d8bc56= 58fac24e9f03c2c57.1637836606.git.martyn.welch@collabora.com Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- .../bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/dri= vers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c index b050fd1f3d201..5302dd90a7a5f 100644 --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c @@ -291,19 +291,10 @@ out: mutex_unlock(&ge_b850v3_lvds_dev_mutex); } =20 -static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, - const struct i2c_device_id *id) +static int ge_b850v3_register(void) { + struct i2c_client *stdp4028_i2c =3D ge_b850v3_lvds_ptr->stdp4028_i2c; struct device *dev =3D &stdp4028_i2c->dev; - int ret; - - ret =3D ge_b850v3_lvds_init(dev); - - if (ret) - return ret; - - ge_b850v3_lvds_ptr->stdp4028_i2c =3D stdp4028_i2c; - i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); =20 /* drm bridge initialization */ ge_b850v3_lvds_ptr->bridge.funcs =3D &ge_b850v3_lvds_funcs; @@ -325,6 +316,27 @@ static int stdp4028_ge_b850v3_fw_probe(struct i2c_clie= nt *stdp4028_i2c, "ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr); } =20 +static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, + const struct i2c_device_id *id) +{ + struct device *dev =3D &stdp4028_i2c->dev; + int ret; + + ret =3D ge_b850v3_lvds_init(dev); + + if (ret) + return ret; + + ge_b850v3_lvds_ptr->stdp4028_i2c =3D stdp4028_i2c; + i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); + + /* Only register after both bridges are probed */ + if (!ge_b850v3_lvds_ptr->stdp2690_i2c) + return 0; + + return ge_b850v3_register(); +} + static int stdp4028_ge_b850v3_fw_remove(struct i2c_client *stdp4028_i2c) { ge_b850v3_lvds_remove(); @@ -368,7 +380,11 @@ static int stdp2690_ge_b850v3_fw_probe(struct i2c_clie= nt *stdp2690_i2c, ge_b850v3_lvds_ptr->stdp2690_i2c =3D stdp2690_i2c; i2c_set_clientdata(stdp2690_i2c, ge_b850v3_lvds_ptr); =20 - return 0; + /* Only register after both bridges are probed */ + if (!ge_b850v3_lvds_ptr->stdp4028_i2c) + return 0; + + return ge_b850v3_register(); } =20 static int stdp2690_ge_b850v3_fw_remove(struct i2c_client *stdp2690_i2c) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 995E7C433F5 for ; Mon, 24 Jan 2022 19:42:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346071AbiAXTmY (ORCPT ); Mon, 24 Jan 2022 14:42:24 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60916 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349200AbiAXTdp (ORCPT ); Mon, 24 Jan 2022 14:33:45 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A6D1E6135E; Mon, 24 Jan 2022 19:33:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CC5BC340E5; Mon, 24 Jan 2022 19:33:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052823; bh=m9BuTBZpIugcPF288rm1rumd82hWsPg0dVWh+nu1Mow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=niRoCQAviX55mVzLNFKqSzxoSWDsogiAVAdIMkbtq0EXlF2K82VSOOOgH8ZmDu1/y RuWQkRYI8uDNEQrUKWMO64FontOVBfwpISjfXaB8K4AXTJdzgwJ6w+w9FtL4kch/Nl vQOuk2XS9PT9Qq4Ep04ov3HK0Z7/voyNObwnY4Dk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.4 168/320] gpiolib: acpi: Do not set the IRQ type if the IRQ is already in use Date: Mon, 24 Jan 2022 19:42:32 +0100 Message-Id: <20220124183959.385582897@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 bdfd6ab8fdccd8b138837efff66f4a1911496378 ] If the IRQ is already in use, then acpi_dev_gpio_irq_get_by() really should not change the type underneath the current owner. I specifically hit an issue with this an a Chuwi Hi8 Super (CWI509) Bay Trail tablet, when the Boot OS selection in the BIOS is set to Android. In this case _STA for a MAX17047 ACPI I2C device wrongly returns 0xf and the _CRS resources for this device include a GpioInt pointing to a GPIO already in use by an _AEI handler, with a different type then specified in the _CRS for the MAX17047 device. Leading to the acpi_dev_gpio_irq_get() call done by the i2c-core-acpi.c code changing the type breaking the _AEI handler. Now this clearly is a bug in the DSDT of this tablet (in Android mode), but in general calling irq_set_irq_type() on an IRQ which already is in use seems like a bad idea. Signed-off-by: Hans de Goede Signed-off-by: Andy Shevchenko Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpio/gpiolib-acpi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index e3ddc99c105d4..13c6eee481da7 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -953,10 +953,17 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, i= nt index) irq_flags =3D acpi_dev_get_irq_type(info.triggering, info.polarity); =20 - /* Set type if specified and different than the current one */ - if (irq_flags !=3D IRQ_TYPE_NONE && - irq_flags !=3D irq_get_trigger_type(irq)) - irq_set_irq_type(irq, irq_flags); + /* + * If the IRQ is not already in use then set type + * if specified and different than the current one. + */ + if (can_request_irq(irq, irq_flags)) { + if (irq_flags !=3D IRQ_TYPE_NONE && + irq_flags !=3D irq_get_trigger_type(irq)) + irq_set_irq_type(irq, irq_flags); + } else { + dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); + } =20 return irq; } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E51CC4321E for ; Mon, 24 Jan 2022 20:38:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386603AbiAXUfm (ORCPT ); Mon, 24 Jan 2022 15:35:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355128AbiAXUNU (ORCPT ); Mon, 24 Jan 2022 15:13:20 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE8A0C028C3E; Mon, 24 Jan 2022 11:34:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ABACAB811F9; Mon, 24 Jan 2022 19:34:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E622DC340E5; Mon, 24 Jan 2022 19:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052857; bh=SR6/RHYzbaW8Yv7fuCZxeBV3M2Vgut2hDG7UGkgolbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tp91cejAMrxQZDK/KtBJxVu9mu9DRKVwFVYrCkgzzSYnszt9iZ19aNPSusXxbgEMX 9DTbBIrazPmygi+2y84aXTFXXklwjwo3ReDZCwSjkHYFalSpJd/QEn/GSG4vUP5/Ib ZSWAIe1b5Jq1euU872/qDf9gEQli6geUJLwE73ys= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chengfeng Ye , Sebastian Reichel , Sasha Levin Subject: [PATCH 5.4 169/320] HSI: core: Fix return freed object in hsi_new_client Date: Mon, 24 Jan 2022 19:42:33 +0100 Message-Id: <20220124183959.418536720@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chengfeng Ye [ Upstream commit a1ee1c08fcd5af03187dcd41dcab12fd5b379555 ] cl is freed on error of calling device_register, but this object is return later, which will cause uaf issue. Fix it by return NULL on error. Signed-off-by: Chengfeng Ye Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/hsi/hsi_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hsi/hsi_core.c b/drivers/hsi/hsi_core.c index a5f92e2889cb8..a330f58d45fc6 100644 --- a/drivers/hsi/hsi_core.c +++ b/drivers/hsi/hsi_core.c @@ -102,6 +102,7 @@ struct hsi_client *hsi_new_client(struct hsi_port *port, if (device_register(&cl->device) < 0) { pr_err("hsi: failed to register client: %s\n", info->name); put_device(&cl->device); + goto err; } =20 return cl; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CD0EC43217 for ; Mon, 24 Jan 2022 19:41:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355251AbiAXTkR (ORCPT ); Mon, 24 Jan 2022 14:40:17 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33376 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353371AbiAXTei (ORCPT ); Mon, 24 Jan 2022 14:34:38 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF02C614BB; Mon, 24 Jan 2022 19:34:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F67BC340E5; Mon, 24 Jan 2022 19:34:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052876; bh=LoTCXz3m/OT67ZXWMKudCikM2xU8jL2j7gLCbPmVYmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k9JbyLmIdGwHE2Mva1xS71faGCqCoOjHLvRd5jtCgCM41MrnodZZmDkE5Cy7gx0cb OeXq26bALfZX1LrFP9eJgk47WwIM/oYwE6xenZf0tbxFemx5Qxae48QCIzjfdxIqlA wEoyNpq32wCHkVbiP1IhVT+RQsxHZ191HmTc/QZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brendan Dolan-Gavitt , Zekun Shen , Kalle Valo , Sasha Levin Subject: [PATCH 5.4 170/320] mwifiex: Fix skb_over_panic in mwifiex_usb_recv() Date: Mon, 24 Jan 2022 19:42:34 +0100 Message-Id: <20220124183959.448642208@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zekun Shen [ Upstream commit 04d80663f67ccef893061b49ec8a42ff7045ae84 ] Currently, with an unknown recv_type, mwifiex_usb_recv just return -1 without restoring the skb. Next time mwifiex_usb_rx_complete is invoked with the same skb, calling skb_put causes skb_over_panic. The bug is triggerable with a compromised/malfunctioning usb device. After applying the patch, skb_over_panic no longer shows up with the same input. Attached is the panic report from fuzzing. skbuff: skb_over_panic: text:000000003bf1b5fa len:2048 put:4 head:00000000dd6a115b data:000000000a9445d8 tail:0x844 end:0x840 dev: kernel BUG at net/core/skbuff.c:109! invalid opcode: 0000 [#1] SMP KASAN NOPTI CPU: 0 PID: 198 Comm: in:imklog Not tainted 5.6.0 #60 RIP: 0010:skb_panic+0x15f/0x161 Call Trace: ? mwifiex_usb_rx_complete+0x26b/0xfcd [mwifiex_usb] skb_put.cold+0x24/0x24 mwifiex_usb_rx_complete+0x26b/0xfcd [mwifiex_usb] __usb_hcd_giveback_urb+0x1e4/0x380 usb_giveback_urb_bh+0x241/0x4f0 ? __hrtimer_run_queues+0x316/0x740 ? __usb_hcd_giveback_urb+0x380/0x380 tasklet_action_common.isra.0+0x135/0x330 __do_softirq+0x18c/0x634 irq_exit+0x114/0x140 smp_apic_timer_interrupt+0xde/0x380 apic_timer_interrupt+0xf/0x20 Reported-by: Brendan Dolan-Gavitt Signed-off-by: Zekun Shen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YX4CqjfRcTa6bVL+@Zekuns-MBP-16.fios-router.= home Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/wireless/marvell/mwifiex/usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wirel= ess/marvell/mwifiex/usb.c index cb8a9ad40cfe9..39cf713d5054c 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -130,7 +130,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *ada= pter, default: mwifiex_dbg(adapter, ERROR, "unknown recv_type %#x\n", recv_type); - return -1; + ret =3D -1; + goto exit_restore_skb; } break; case MWIFIEX_USB_EP_DATA: --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5471C433FE for ; Mon, 24 Jan 2022 20:31:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385243AbiAXUbx (ORCPT ); Mon, 24 Jan 2022 15:31:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355377AbiAXUNh (ORCPT ); Mon, 24 Jan 2022 15:13:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B361C061756; Mon, 24 Jan 2022 11:34:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BF63E614F0; Mon, 24 Jan 2022 19:34:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EF97C340E5; Mon, 24 Jan 2022 19:34:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052879; bh=IvJKwIwGyTqPAugXypICL4pj0G7zTTc3ag8osLjsUmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UBEjnptd5jVEcndDanvxyc5ocGhr3PPswm4dYnnWuGCTRloI6JTz5vvDDFHtsboK5 UsO5gLd0pshPTlTfO/LbYbPPnKd0x1RQdmBzuPaQrtfAoYUvOHiVyLrlfJvviDzw/b pKh3ZB67+l9BbTgg7o7LSkyANRSMt5kqUqhtMPA4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brendan Dolan-Gavitt , Zekun Shen , Kalle Valo , Sasha Levin Subject: [PATCH 5.4 171/320] rsi: Fix use-after-free in rsi_rx_done_handler() Date: Mon, 24 Jan 2022 19:42:35 +0100 Message-Id: <20220124183959.478734116@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zekun Shen [ Upstream commit b07e3c6ebc0c20c772c0f54042e430acec2945c3 ] When freeing rx_cb->rx_skb, the pointer is not set to NULL, a later rsi_rx_done_handler call will try to read the freed address. This bug will very likley lead to double free, although detected early as use-after-free bug. The bug is triggerable with a compromised/malfunctional usb device. After applying the patch, the same input no longer triggers the use-after-free. Attached is the kasan report from fuzzing. BUG: KASAN: use-after-free in rsi_rx_done_handler+0x354/0x430 [rsi_usb] Read of size 4 at addr ffff8880188e5930 by task modprobe/231 Call Trace: dump_stack+0x76/0xa0 print_address_description.constprop.0+0x16/0x200 ? rsi_rx_done_handler+0x354/0x430 [rsi_usb] ? rsi_rx_done_handler+0x354/0x430 [rsi_usb] __kasan_report.cold+0x37/0x7c ? dma_direct_unmap_page+0x90/0x110 ? rsi_rx_done_handler+0x354/0x430 [rsi_usb] kasan_report+0xe/0x20 rsi_rx_done_handler+0x354/0x430 [rsi_usb] __usb_hcd_giveback_urb+0x1e4/0x380 usb_giveback_urb_bh+0x241/0x4f0 ? __usb_hcd_giveback_urb+0x380/0x380 ? apic_timer_interrupt+0xa/0x20 tasklet_action_common.isra.0+0x135/0x330 __do_softirq+0x18c/0x634 ? handle_irq_event+0xcd/0x157 ? handle_edge_irq+0x1eb/0x7b0 irq_exit+0x114/0x140 do_IRQ+0x91/0x1e0 common_interrupt+0xf/0xf Reported-by: Brendan Dolan-Gavitt Signed-off-by: Zekun Shen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YXxQL/vIiYcZUu/j@10-18-43-117.dynapool.wire= less.nyu.edu Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/wireless/rsi/rsi_91x_usb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/= rsi/rsi_91x_usb.c index 68ce3d2bc5357..730d7bf86c40c 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c @@ -261,8 +261,12 @@ static void rsi_rx_done_handler(struct urb *urb) struct rsi_91x_usbdev *dev =3D (struct rsi_91x_usbdev *)rx_cb->data; int status =3D -EINVAL; =20 + if (!rx_cb->rx_skb) + return; + if (urb->status) { dev_kfree_skb(rx_cb->rx_skb); + rx_cb->rx_skb =3D NULL; return; } =20 @@ -286,8 +290,10 @@ out: if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num, GFP_ATOMIC)) rsi_dbg(ERR_ZONE, "%s: Failed in urb submission", __func__); =20 - if (status) + if (status) { dev_kfree_skb(rx_cb->rx_skb); + rx_cb->rx_skb =3D NULL; + } } =20 static void rsi_rx_urb_kill(struct rsi_hw *adapter, u8 ep_num) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1486FC4167B for ; Mon, 24 Jan 2022 19:41:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355283AbiAXTkV (ORCPT ); Mon, 24 Jan 2022 14:40:21 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57204 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353440AbiAXTeo (ORCPT ); Mon, 24 Jan 2022 14:34:44 -0500 Received: from smtp.kernel.org (relay.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 877B0B810BD; Mon, 24 Jan 2022 19:34:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0615C340E5; Mon, 24 Jan 2022 19:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052882; bh=88jBPow+2JlJ1CiI4sRMcEJq4kG76BFtyjtYunFiHdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WHcvZOreiWv3NpnwWcQrto/Vhr3mGDhgPtkHtZQ2F+WZ0T1S+KNu98FJEgOdtxn/1 OP3n09r8apeS3zCGR2Shtk5q1ZPWlD/6QyiXT/IvlKeJ6VuLzHHLT5GqKhfZYAeEx+ zf2UaUwtSift8xF3SR/F9yDRmCO2ZG3trRJcXL0Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brendan Dolan-Gavitt , Zekun Shen , Kalle Valo , Sasha Levin Subject: [PATCH 5.4 172/320] rsi: Fix out-of-bounds read in rsi_read_pkt() Date: Mon, 24 Jan 2022 19:42:36 +0100 Message-Id: <20220124183959.512254254@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zekun Shen [ Upstream commit f1cb3476e48b60c450ec3a1d7da0805bffc6e43a ] rsi_get_* functions rely on an offset variable from usb input. The size of usb input is RSI_MAX_RX_USB_PKT_SIZE(3000), while 2-byte offset can be up to 0xFFFF. Thus a large offset can cause out-of-bounds read. The patch adds a bound checking condition when rcv_pkt_len is 0, indicating it's USB. It's unclear whether this is triggerable from other type of bus. The following check might help in that case. offset > rcv_pkt_len - FRAME_DESC_SZ The bug is trigerrable with conpromised/malfunctioning USB devices. I tested the patch with the crashing input and got no more bug report. Attached is the KASAN report from fuzzing. BUG: KASAN: slab-out-of-bounds in rsi_read_pkt+0x42e/0x500 [rsi_91x] Read of size 2 at addr ffff888019439fdb by task RX-Thread/227 CPU: 0 PID: 227 Comm: RX-Thread Not tainted 5.6.0 #66 Call Trace: dump_stack+0x76/0xa0 print_address_description.constprop.0+0x16/0x200 ? rsi_read_pkt+0x42e/0x500 [rsi_91x] ? rsi_read_pkt+0x42e/0x500 [rsi_91x] __kasan_report.cold+0x37/0x7c ? rsi_read_pkt+0x42e/0x500 [rsi_91x] kasan_report+0xe/0x20 rsi_read_pkt+0x42e/0x500 [rsi_91x] rsi_usb_rx_thread+0x1b1/0x2fc [rsi_usb] ? rsi_probe+0x16a0/0x16a0 [rsi_usb] ? _raw_spin_lock_irqsave+0x7b/0xd0 ? _raw_spin_trylock_bh+0x120/0x120 ? __wake_up_common+0x10b/0x520 ? rsi_probe+0x16a0/0x16a0 [rsi_usb] kthread+0x2b5/0x3b0 ? kthread_create_on_node+0xd0/0xd0 ret_from_fork+0x22/0x40 Reported-by: Brendan Dolan-Gavitt Signed-off-by: Zekun Shen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YXxXS4wgu2OsmlVv@10-18-43-117.dynapool.wire= less.nyu.edu Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/wireless/rsi/rsi_91x_main.c | 4 ++++ drivers/net/wireless/rsi/rsi_91x_usb.c | 1 - drivers/net/wireless/rsi/rsi_usb.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless= /rsi/rsi_91x_main.c index 441fda71f6289..d92337169ee3a 100644 --- a/drivers/net/wireless/rsi/rsi_91x_main.c +++ b/drivers/net/wireless/rsi/rsi_91x_main.c @@ -23,6 +23,7 @@ #include "rsi_common.h" #include "rsi_coex.h" #include "rsi_hal.h" +#include "rsi_usb.h" =20 u32 rsi_zone_enabled =3D /* INFO_ZONE | INIT_ZONE | @@ -167,6 +168,9 @@ int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt,= s32 rcv_pkt_len) frame_desc =3D &rx_pkt[index]; actual_length =3D *(u16 *)&frame_desc[0]; offset =3D *(u16 *)&frame_desc[2]; + if (!rcv_pkt_len && offset > + RSI_MAX_RX_USB_PKT_SIZE - FRAME_DESC_SZ) + goto fail; =20 queueno =3D rsi_get_queueno(frame_desc, offset); length =3D rsi_get_length(frame_desc, offset); diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/= rsi/rsi_91x_usb.c index 730d7bf86c40c..94bf2a7ca635d 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c @@ -320,7 +320,6 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8= ep_num, gfp_t mem_flags) struct sk_buff *skb; u8 dword_align_bytes =3D 0; =20 -#define RSI_MAX_RX_USB_PKT_SIZE 3000 skb =3D dev_alloc_skb(RSI_MAX_RX_USB_PKT_SIZE); if (!skb) return -ENOMEM; diff --git a/drivers/net/wireless/rsi/rsi_usb.h b/drivers/net/wireless/rsi/= rsi_usb.h index 8702f434b5699..ad88f8c70a351 100644 --- a/drivers/net/wireless/rsi/rsi_usb.h +++ b/drivers/net/wireless/rsi/rsi_usb.h @@ -44,6 +44,8 @@ #define RSI_USB_BUF_SIZE 4096 #define RSI_USB_CTRL_BUF_SIZE 0x04 =20 +#define RSI_MAX_RX_USB_PKT_SIZE 3000 + struct rx_usb_ctrl_block { u8 *data; struct urb *rx_urb; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D7CCC433F5 for ; Mon, 24 Jan 2022 20:31:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352220AbiAXUbm (ORCPT ); Mon, 24 Jan 2022 15:31:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355367AbiAXUNg (ORCPT ); Mon, 24 Jan 2022 15:13:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0323C01D7D0; Mon, 24 Jan 2022 11:34:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 404D2612A5; Mon, 24 Jan 2022 19:34:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0774C340E5; Mon, 24 Jan 2022 19:34:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052885; bh=Wz1PAbR8+iIe/jPfTcBbjPHkLNB0RxFEi0fK8+Aossk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GnbzTkVFfEEUR6g4t6TRBDWo+1/QnLkkDkvV2DSvkLnkQPfwvGWq5SVrP10iQeVWW IY61jp3pbsHS+9fxg/MfX/FoVlZSGGWTtZ0Ki63kw46z246TptEURNqsDztso1MNDS beYvSy6fypp3UuMZNWyoKGGSuZ2uwTlPZNuXoOlg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neal Liu , Sasha Levin Subject: [PATCH 5.4 173/320] usb: uhci: add aspeed ast2600 uhci support Date: Mon, 24 Jan 2022 19:42:37 +0100 Message-Id: <20220124183959.550782168@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Neal Liu [ Upstream commit 554abfe2eadec97d12c71d4a69da1518478f69eb ] Enable ast2600 uhci quirks. Signed-off-by: Neal Liu Link: https://lore.kernel.org/r/20211126100021.2331024-1-neal_liu@aspeedtec= h.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/usb/host/uhci-platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platf= orm.c index 70dbd95c3f063..be9e9db7cad10 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c @@ -113,7 +113,8 @@ static int uhci_hcd_platform_probe(struct platform_devi= ce *pdev) num_ports); } if (of_device_is_compatible(np, "aspeed,ast2400-uhci") || - of_device_is_compatible(np, "aspeed,ast2500-uhci")) { + of_device_is_compatible(np, "aspeed,ast2500-uhci") || + of_device_is_compatible(np, "aspeed,ast2600-uhci")) { uhci->is_aspeed =3D 1; dev_info(&pdev->dev, "Enabled Aspeed implementation workarounds\n"); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4B7DC3526D for ; Mon, 24 Jan 2022 19:41:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355299AbiAXTkY (ORCPT ); Mon, 24 Jan 2022 14:40:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57292 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353497AbiAXTev (ORCPT ); Mon, 24 Jan 2022 14:34:51 -0500 Received: from smtp.kernel.org (relay.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 EDD87B8119D; Mon, 24 Jan 2022 19:34:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2148DC340E5; Mon, 24 Jan 2022 19:34:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052888; bh=5PIb9zgLfIDlpJXXCYVlibu41uMeDiCYR7yxgWThjCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Av9RTKR/rnsN12Uy7OMC0gJ+lU3upMlemyAIb9Z0iPCojQLH+SJz/xoybcAUchPog 6SIavfXqd4TjiCKGXMXx4nelGkjvGiqKrMn1vC98zGvAX+w53vpwkvbNz3vfbk5brf wq9jKnD6btAa9VDEE+S3WA/uasUz1oSYppCfjcrM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+23a02c7df2cf2bc93fa2@syzkaller.appspotmail.com, Xiongwei Song , Denis Efremov , Jens Axboe , Sasha Levin Subject: [PATCH 5.4 174/320] floppy: Add max size check for user space request Date: Mon, 24 Jan 2022 19:42:38 +0100 Message-Id: <20220124183959.580700948@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiongwei Song [ Upstream commit 545a32498c536ee152331cd2e7d2416aa0f20e01 ] We need to check the max request size that is from user space before allocating pages. If the request size exceeds the limit, return -EINVAL. This check can avoid the warning below from page allocator. WARNING: CPU: 3 PID: 16525 at mm/page_alloc.c:5344 current_gfp_context incl= ude/linux/sched/mm.h:195 [inline] WARNING: CPU: 3 PID: 16525 at mm/page_alloc.c:5344 __alloc_pages+0x45d/0x50= 0 mm/page_alloc.c:5356 Modules linked in: CPU: 3 PID: 16525 Comm: syz-executor.3 Not tainted 5.15.0-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 RIP: 0010:__alloc_pages+0x45d/0x500 mm/page_alloc.c:5344 Code: be c9 00 00 00 48 c7 c7 20 4a 97 89 c6 05 62 32 a7 0b 01 e8 74 9a 42 = 07 e9 6a ff ff ff 0f 0b e9 a0 fd ff ff 40 80 e5 3f eb 88 <0f> 0b e9 18 ff f= f ff 4c 89 ef 44 89 e6 45 31 ed e8 1e 76 ff ff e9 RSP: 0018:ffffc90023b87850 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 1ffff92004770f0b RCX: dffffc0000000000 RDX: 0000000000000000 RSI: 0000000000000033 RDI: 0000000000010cc1 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001 R10: ffffffff81bb4686 R11: 0000000000000001 R12: ffffffff902c1960 R13: 0000000000000033 R14: 0000000000000000 R15: ffff88804cf64a30 FS: 0000000000000000(0000) GS:ffff88802cd00000(0063) knlGS:00000000f44b4b40 CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 CR2: 000000002c921000 CR3: 000000004f507000 CR4: 0000000000150ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: alloc_pages+0x1a7/0x300 mm/mempolicy.c:2191 __get_free_pages+0x8/0x40 mm/page_alloc.c:5418 raw_cmd_copyin drivers/block/floppy.c:3113 [inline] raw_cmd_ioctl drivers/block/floppy.c:3160 [inline] fd_locked_ioctl+0x12e5/0x2820 drivers/block/floppy.c:3528 fd_ioctl drivers/block/floppy.c:3555 [inline] fd_compat_ioctl+0x891/0x1b60 drivers/block/floppy.c:3869 compat_blkdev_ioctl+0x3b8/0x810 block/ioctl.c:662 __do_compat_sys_ioctl+0x1c7/0x290 fs/ioctl.c:972 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c Reported-by: syzbot+23a02c7df2cf2bc93fa2@syzkaller.appspotmail.com Link: https://lore.kernel.org/r/20211116131033.27685-1-sxwjean@me.com Signed-off-by: Xiongwei Song Signed-off-by: Denis Efremov Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/block/floppy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 212a1e1ce0d9e..02af4f109e59f 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3112,6 +3112,8 @@ static void raw_cmd_free(struct floppy_raw_cmd **ptr) } } =20 +#define MAX_LEN (1UL << MAX_ORDER << PAGE_SHIFT) + static int raw_cmd_copyin(int cmd, void __user *param, struct floppy_raw_cmd **rcmd) { @@ -3149,7 +3151,7 @@ loop: ptr->resultcode =3D 0; =20 if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { - if (ptr->length <=3D 0) + if (ptr->length <=3D 0 || ptr->length >=3D MAX_LEN) return -EINVAL; ptr->kernel_data =3D (char *)fd_dma_mem_alloc(ptr->length); fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8DC4C433EF for ; Mon, 24 Jan 2022 20:32:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350392AbiAXUcB (ORCPT ); Mon, 24 Jan 2022 15:32:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355388AbiAXUNh (ORCPT ); Mon, 24 Jan 2022 15:13:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41619C06175A; Mon, 24 Jan 2022 11:34:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F3945B811F9; Mon, 24 Jan 2022 19:34:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58496C340E5; Mon, 24 Jan 2022 19:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052891; bh=QAoycasiljDcdSm6faYBKX2CXMKw6Rx++/AvlQpD6PI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iB5PKUAy98OwqndIR+5L3aq5aQjwOe6O3XW1IRp+6rcXSU7LunMdjgfFetk117KRy yvuzmij82p3aAPvKASeiy+ZiIAKiAFpTnHRQfyxLC0pBJIJtAbnxuIBofWENHKiMZ3 nQ8D5D6DgKMjHYb8Vk6b61yY4JZLUf60DIL+m9aY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joerg Roedel , Borislav Petkov , Sasha Levin Subject: [PATCH 5.4 175/320] x86/mm: Flush global TLB when switching to trampoline page-table Date: Mon, 24 Jan 2022 19:42:39 +0100 Message-Id: <20220124183959.610833735@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joerg Roedel [ Upstream commit 71d5049b053876afbde6c3273250b76935494ab2 ] Move the switching code into a function so that it can be re-used and add a global TLB flush. This makes sure that usage of memory which is not mapped in the trampoline page-table is reliably caught. Also move the clearing of CR4.PCIDE before the CR3 switch because the cr4_clear_bits() function will access data not mapped into the trampoline page-table. Signed-off-by: Joerg Roedel Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20211202153226.22946-4-joro@8bytes.org Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/x86/include/asm/realmode.h | 1 + arch/x86/kernel/reboot.c | 12 ++---------- arch/x86/realmode/init.c | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/arch/x86/include/asm/realmode.h b/arch/x86/include/asm/realmod= e.h index 09ecc32f65248..52d7512ea91ab 100644 --- a/arch/x86/include/asm/realmode.h +++ b/arch/x86/include/asm/realmode.h @@ -82,6 +82,7 @@ static inline void set_real_mode_mem(phys_addr_t mem) } =20 void reserve_real_mode(void); +void load_trampoline_pgtable(void); =20 #endif /* __ASSEMBLY__ */ =20 diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index d65d1afb27161..fdef27a84d713 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c @@ -113,17 +113,9 @@ void __noreturn machine_real_restart(unsigned int type) spin_unlock(&rtc_lock); =20 /* - * Switch back to the initial page table. + * Switch to the trampoline page table. */ -#ifdef CONFIG_X86_32 - load_cr3(initial_page_table); -#else - write_cr3(real_mode_header->trampoline_pgd); - - /* Exiting long mode will fail if CR4.PCIDE is set. */ - if (boot_cpu_has(X86_FEATURE_PCID)) - cr4_clear_bits(X86_CR4_PCIDE); -#endif + load_trampoline_pgtable(); =20 /* Jump to the identity-mapped low memory code */ #ifdef CONFIG_X86_32 diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c index de371e52cfa85..fac50ebb122b5 100644 --- a/arch/x86/realmode/init.c +++ b/arch/x86/realmode/init.c @@ -16,6 +16,32 @@ u32 *trampoline_cr4_features; /* Hold the pgd entry used on booting additional CPUs */ pgd_t trampoline_pgd_entry; =20 +void load_trampoline_pgtable(void) +{ +#ifdef CONFIG_X86_32 + load_cr3(initial_page_table); +#else + /* + * This function is called before exiting to real-mode and that will + * fail with CR4.PCIDE still set. + */ + if (boot_cpu_has(X86_FEATURE_PCID)) + cr4_clear_bits(X86_CR4_PCIDE); + + write_cr3(real_mode_header->trampoline_pgd); +#endif + + /* + * The CR3 write above will not flush global TLB entries. + * Stale, global entries from previous page tables may still be + * present. Flush those stale entries. + * + * This ensures that memory accessed while running with + * trampoline_pgd is *actually* mapped into trampoline_pgd. + */ + __flush_tlb_all(); +} + void __init reserve_real_mode(void) { phys_addr_t mem; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98E4FC433F5 for ; Mon, 24 Jan 2022 20:31:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356310AbiAXUa5 (ORCPT ); Mon, 24 Jan 2022 15:30:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379358AbiAXULU (ORCPT ); Mon, 24 Jan 2022 15:11:20 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7FF5C06F8D4; Mon, 24 Jan 2022 11:33:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 91CA3B811FC; Mon, 24 Jan 2022 19:33:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF652C340E5; Mon, 24 Jan 2022 19:33:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052791; bh=qd+RMW3ekTWdd5Ghm7/F/Cbe9ZBpbdGE29aSnDE0Ntc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TY6eY/TIzB/ZXxr3IlKVOZ69EOUhUeC0JpSP1Lji8YDjZipz1ZYE3VUVUdfuaEJM+ tb1OLvlRF/h7xSCXOs/TLfsUfPGlFN62gzzUtkWAN+wbfmSmfJxfJgvBCeT48lvjBd j848z2RUmpYsa5uMV0czXzMPuZx7a9RPIl7ACO/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Hilliard , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 176/320] media: uvcvideo: Increase UVC_CTRL_CONTROL_TIMEOUT to 5 seconds. Date: Mon, 24 Jan 2022 19:42:40 +0100 Message-Id: <20220124183959.647817904@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Hilliard [ Upstream commit c8ed7d2f614cd8b315981d116c7a2fb01829500d ] Some uvc devices appear to require the maximum allowed USB timeout for GET_CUR/SET_CUR requests. So lets just bump the UVC control timeout to 5 seconds which is the same as the usb ctrl get/set defaults: USB_CTRL_GET_TIMEOUT 5000 USB_CTRL_SET_TIMEOUT 5000 It fixes the following runtime warnings: Failed to query (GET_CUR) UVC control 11 on unit 2: -110 (exp. 1). Failed to query (SET_CUR) UVC control 3 on unit 2: -110 (exp. 2). Signed-off-by: James Hilliard Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/usb/uvc/uvcvideo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvi= deo.h index 24e3d8c647e77..5f137400bebd6 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -179,7 +179,7 @@ /* Maximum status buffer size in bytes of interrupt URB. */ #define UVC_MAX_STATUS_SIZE 16 =20 -#define UVC_CTRL_CONTROL_TIMEOUT 500 +#define UVC_CTRL_CONTROL_TIMEOUT 5000 #define UVC_CTRL_STREAMING_TIMEOUT 5000 =20 /* Maximum allowed number of control mappings per device */ --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B344C433EF for ; Mon, 24 Jan 2022 19:39:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347693AbiAXTjP (ORCPT ); Mon, 24 Jan 2022 14:39:15 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58052 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353154AbiAXTdU (ORCPT ); Mon, 24 Jan 2022 14:33:20 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 064EE61482; Mon, 24 Jan 2022 19:33:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAE5DC340E5; Mon, 24 Jan 2022 19:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052794; bh=stwyFcwrHvk0WqGjAaEa8Do+lR1jsqKuLO+DyPAgQIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XSLHR4tI29L8zV5qi7Rl0HA83b/Yqko0E6ns/1MJfetoQrZVIUNvEmtf/xNGqrRJo oiOJf1HkIJ8MXA4pPx0GcIC2Thj0o0BOgUR15ah9QWrcVmXiAuEzIugb+qJKRtWr8U CNKigvPIGgMWjzuKXboSBz0yhWOistla9HjGg+nY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 177/320] media: saa7146: hexium_orion: Fix a NULL pointer dereference in hexium_attach() Date: Mon, 24 Jan 2022 19:42:41 +0100 Message-Id: <20220124183959.678602776@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit 348df8035301dd212e3cc2860efe4c86cb0d3303 ] In hexium_attach(dev, info), saa7146_vv_init() is called to allocate a new memory for dev->vv_data. In hexium_detach(), saa7146_vv_release() will be called and there is a dereference of dev->vv_data in saa7146_vv_release(), which could lead to a NULL pointer dereference on failure of saa7146_vv_init() according to the following logic. Both hexium_attach() and hexium_detach() are callback functions of the variable 'extension', so there exists a possible call chain directly from hexium_attach() to hexium_detach(): hexium_attach(dev, info) -- fail to alloc memory to dev->vv_data | in saa7146_vv_init(). | | hexium_detach() -- a dereference of dev->vv_data in saa7146_vv_release() Fix this bug by adding a check of saa7146_vv_init(). This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_VIDEO_HEXIUM_ORION=3Dm show no new warnings, and our static analyzer no longer warns about this code. Signed-off-by: Zhou Qingyang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/pci/saa7146/hexium_orion.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/s= aa7146/hexium_orion.c index bf5e55348f159..31388597386aa 100644 --- a/drivers/media/pci/saa7146/hexium_orion.c +++ b/drivers/media/pci/saa7146/hexium_orion.c @@ -355,10 +355,16 @@ static struct saa7146_ext_vv vv_data; static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_exten= sion_data *info) { struct hexium *hexium =3D (struct hexium *) dev->ext_priv; + int ret; =20 DEB_EE("\n"); =20 - saa7146_vv_init(dev, &vv_data); + ret =3D saa7146_vv_init(dev, &vv_data); + if (ret) { + pr_err("Error in saa7146_vv_init()\n"); + return ret; + } + vv_data.vid_ops.vidioc_enum_input =3D vidioc_enum_input; vv_data.vid_ops.vidioc_g_input =3D vidioc_g_input; vv_data.vid_ops.vidioc_s_input =3D vidioc_s_input; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D97F9C433F5 for ; Mon, 24 Jan 2022 19:42:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239914AbiAXTmT (ORCPT ); Mon, 24 Jan 2022 14:42:19 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56286 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353189AbiAXTdV (ORCPT ); Mon, 24 Jan 2022 14:33:21 -0500 Received: from smtp.kernel.org (relay.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 24134B810AF; Mon, 24 Jan 2022 19:33:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BC05C340E5; Mon, 24 Jan 2022 19:33:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052797; bh=8H5EoVxDGihervYYRp6fPu7r8TlKkjq40J4IIxrxiNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1PqQ7rScLD86SrJLr6jO+8lcb2OJ/uzUeJvNRYQLnWEartjEl41BJ9r1B8J9Ll8uO evG8yz4uwpaU6PRbiaDZYkFY3QWjmmGokq6W89g0Di0exkstGGE5aeLqcloZXrPcI4 /a6tK2WaRru/eQhoEGikJR9hCHKK9ncaKF8ul43A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, rkardell@mida.se, Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 178/320] media: m920x: dont use stack on USB reads Date: Mon, 24 Jan 2022 19:42:42 +0100 Message-Id: <20220124183959.716996501@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mauro Carvalho Chehab [ Upstream commit a2ab06d7c4d6bfd0b545a768247a70463e977e27 ] Using stack-allocated pointers for USB message data don't work. This driver is almost OK with that, except for the I2C read logic. Fix it by using a temporary read buffer, just like on all other calls to m920x_read(). Link: https://lore.kernel.org/all/ccc99e48-de4f-045e-0fe4-61e3118e3f74@mida= .se/ Reported-by: rkardell@mida.se Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/usb/dvb-usb/m920x.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb/m920x.c b/drivers/media/usb/dvb-usb/= m920x.c index d866a1990a7d2..7282f60226558 100644 --- a/drivers/media/usb/dvb-usb/m920x.c +++ b/drivers/media/usb/dvb-usb/m920x.c @@ -274,6 +274,13 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, st= ruct i2c_msg msg[], int nu /* Should check for ack here, if we knew how. */ } if (msg[i].flags & I2C_M_RD) { + char *read =3D kmalloc(1, GFP_KERNEL); + if (!read) { + ret =3D -ENOMEM; + kfree(read); + goto unlock; + } + for (j =3D 0; j < msg[i].len; j++) { /* Last byte of transaction? * Send STOP, otherwise send ACK. */ @@ -281,9 +288,12 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, st= ruct i2c_msg msg[], int nu =20 if ((ret =3D m920x_read(d->udev, M9206_I2C, 0x0, 0x20 | stop, - &msg[i].buf[j], 1)) !=3D 0) + read, 1)) !=3D 0) goto unlock; + msg[i].buf[j] =3D read[0]; } + + kfree(read); } else { for (j =3D 0; j < msg[i].len; j++) { /* Last byte of transaction? Then send STOP. */ --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01294C433F5 for ; Mon, 24 Jan 2022 19:42:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343907AbiAXTmE (ORCPT ); Mon, 24 Jan 2022 14:42:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:56854 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347228AbiAXTdW (ORCPT ); Mon, 24 Jan 2022 14:33:22 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 61FF6614FC; Mon, 24 Jan 2022 19:33:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33738C340E5; Mon, 24 Jan 2022 19:33:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052800; bh=42VGfcpCsuLzDqmi2gYeSLUCwjK3nu0k10kgmKeHXME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DuHCnlX50xoI5AxxXnFSQTteev4VtHLRAB2wY1fVSgo13Ry4gJUSeZjGQqaUCODEi 5Z6uwuTYrkEqnjl3eoCzbokp/DXgOwKSSYTmssjxhxCi83wYmfrpFf1H7MjG8hJCl3 0QLAsGp/xagyxMISXfxfHpBN3nZzdrQPewF8E11Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emmanuel Grumbach , Maximilian Ernestus , Johannes Berg , Luca Coelho , Sasha Levin Subject: [PATCH 5.4 179/320] iwlwifi: mvm: synchronize with FW after multicast commands Date: Mon, 24 Jan 2022 19:42:43 +0100 Message-Id: <20220124183959.756538497@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg [ Upstream commit db66abeea3aefed481391ecc564fb7b7fb31d742 ] If userspace installs a lot of multicast groups very quickly, then we may run out of command queue space as we send the updates in an asynchronous fashion (due to locking concerns), and the CPU can create them faster than the firmware can process them. This is true even when mac80211 has a work struct that gets scheduled. Fix this by synchronizing with the firmware after sending all those commands - outside of the iteration we can send a synchronous echo command that just has the effect of the CPU waiting for the prior asynchronous commands to finish. This also will cause fewer of the commands to be sent to the firmware overall, because the work will only run once when rescheduled multiple times while it's running. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D213649 Suggested-by: Emmanuel Grumbach Reported-by: Maximilian Ernestus Signed-off-by: Johannes Berg Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211204083238.51aea5b79ea4.I88a447= 98efda16e9fe480fb3e94224931d311b29@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/ne= t/wireless/intel/iwlwifi/mvm/mac80211.c index c942255aa1dbc..29ad7804d77aa 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1696,6 +1696,7 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *= mvm) struct iwl_mvm_mc_iter_data iter_data =3D { .mvm =3D mvm, }; + int ret; =20 lockdep_assert_held(&mvm->mutex); =20 @@ -1705,6 +1706,22 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm = *mvm) ieee80211_iterate_active_interfaces_atomic( mvm->hw, IEEE80211_IFACE_ITER_NORMAL, iwl_mvm_mc_iface_iterator, &iter_data); + + /* + * Send a (synchronous) ech command so that we wait for the + * multiple asynchronous MCAST_FILTER_CMD commands sent by + * the interface iterator. Otherwise, we might get here over + * and over again (by userspace just sending a lot of these) + * and the CPU can send them faster than the firmware can + * process them. + * Note that the CPU is still faster - but with this we'll + * actually send fewer commands overall because the CPU will + * not schedule the work in mac80211 as frequently if it's + * still running when rescheduled (possibly multiple times). + */ + ret =3D iwl_mvm_send_cmd_pdu(mvm, ECHO_CMD, 0, 0, NULL); + if (ret) + IWL_ERR(mvm, "Failed to synchronize multicast groups update\n"); } =20 static u64 iwl_mvm_prepare_multicast(struct ieee80211_hw *hw, --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F277C4167D for ; Tue, 25 Jan 2022 02:36:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422154AbiAYCaW (ORCPT ); Mon, 24 Jan 2022 21:30:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379374AbiAXULU (ORCPT ); Mon, 24 Jan 2022 15:11:20 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B422C06F8E0; Mon, 24 Jan 2022 11:33:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 28EF6B811FC; Mon, 24 Jan 2022 19:33:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5086AC340E5; Mon, 24 Jan 2022 19:33:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052804; bh=QzS4tXh8Kdb+NYlC5nFHkToGbuxguFI/gh7D8iqd0oc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P1wOvy8Hbe/UQQhFjKIQpwcWFztU2WqXQ81VQ5db290uHArVItTIuCzJyMdCjG8dm UXgTd3Sf3LbM2O8pD+GuZBskXqiiG56t1vHjC/kt3VQwxb8Mm3jiuC+/9bO3AX8MfG NDuUEMi0D/rYbneTLqFcxWi1NQ2hPRY76DKtB/ag= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Gottschall , Kalle Valo , Sasha Levin Subject: [PATCH 5.4 180/320] ath10k: Fix tx hanging Date: Mon, 24 Jan 2022 19:42:44 +0100 Message-Id: <20220124183959.787054022@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sebastian Gottschall [ Upstream commit e8a91863eba3966a447d2daa1526082d52b5db2a ] While running stress tests in roaming scenarios (switching ap's every 5 seconds, we discovered a issue which leads to tx hangings of exactly 5 seconds while or after scanning for new accesspoints. We found out that this hanging is triggered by ath10k_mac_wait_tx_complete since the empty_tx_wq was not wake when the num_tx_pending counter reaches zero. To fix this, we simply move the wake_up call to htt_tx_dec_pending, since this call was missed on several locations within the ath10k code. Signed-off-by: Sebastian Gottschall Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20210505085806.11474-1-s.gottschall@dd-wrt.= com Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/wireless/ath/ath10k/htt_tx.c | 3 +++ drivers/net/wireless/ath/ath10k/txrx.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireles= s/ath/ath10k/htt_tx.c index c38e1963ebc05..f73ed1044390c 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -147,6 +147,9 @@ void ath10k_htt_tx_dec_pending(struct ath10k_htt *htt) htt->num_pending_tx--; if (htt->num_pending_tx =3D=3D htt->max_num_pending_tx - 1) ath10k_mac_tx_unlock(htt->ar, ATH10K_TX_PAUSE_Q_FULL); + + if (htt->num_pending_tx =3D=3D 0) + wake_up(&htt->empty_tx_wq); } =20 int ath10k_htt_tx_inc_pending(struct ath10k_htt *htt) diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/= ath/ath10k/txrx.c index f46b9083bbf10..2c254f43790d2 100644 --- a/drivers/net/wireless/ath/ath10k/txrx.c +++ b/drivers/net/wireless/ath/ath10k/txrx.c @@ -80,8 +80,6 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, =20 ath10k_htt_tx_free_msdu_id(htt, tx_done->msdu_id); ath10k_htt_tx_dec_pending(htt); - if (htt->num_pending_tx =3D=3D 0) - wake_up(&htt->empty_tx_wq); spin_unlock_bh(&htt->tx_lock); =20 rcu_read_lock(); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FD26C433EF for ; Mon, 24 Jan 2022 20:31:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384988AbiAXUbK (ORCPT ); Mon, 24 Jan 2022 15:31:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379369AbiAXULV (ORCPT ); Mon, 24 Jan 2022 15:11:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEA51C06F8E2; Mon, 24 Jan 2022 11:33:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4DCC161504; Mon, 24 Jan 2022 19:33:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35EA3C340E5; Mon, 24 Jan 2022 19:33:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052807; bh=9aYQODP5szAojPD5WJTQP+8gls/HiWPful1vla/RVVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g5sMzs0k5IrgxWb2Iu8ZgxWcC68zEGo6FZrUQm9wBXJnk4Zz4qschzkWEvThmK//L IVPCHZzIU+Xx6VwKFt3CY6mH76r6sd0DAWifmgLMqCfGh49fUdllGsTCI6DrQIkF59 VQ54o4A9mp7+B0o3ZL5ac/5bqBCwb4oUiqn9uAuw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antoine Tenart , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 181/320] net-sysfs: update the queue counts in the unregistration path Date: Mon, 24 Jan 2022 19:42:45 +0100 Message-Id: <20220124183959.824749734@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antoine Tenart [ Upstream commit d7dac083414eb5bb99a6d2ed53dc2c1b405224e5 ] When updating Rx and Tx queue kobjects, the queue count should always be updated to match the queue kobjects count. This was not done in the net device unregistration path, fix it. Tracking all queue count updates will allow in a following up patch to detect illegal updates. Signed-off-by: Antoine Tenart Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/core/net-sysfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 05b0c60bfba2b..bcad7028bbf45 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -1661,6 +1661,9 @@ static void remove_queue_kobjects(struct net_device *= dev) =20 net_rx_queue_update_kobjects(dev, real_rx, 0); netdev_queue_update_kobjects(dev, real_tx, 0); + + dev->real_num_rx_queues =3D 0; + dev->real_num_tx_queues =3D 0; #ifdef CONFIG_SYSFS kset_unregister(dev->queues_kset); #endif --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F4E8C433EF for ; Mon, 24 Jan 2022 19:39:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354211AbiAXTjS (ORCPT ); Mon, 24 Jan 2022 14:39:18 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56438 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353222AbiAXTdd (ORCPT ); Mon, 24 Jan 2022 14:33:33 -0500 Received: from smtp.kernel.org (relay.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 0FF84B811FB; Mon, 24 Jan 2022 19:33:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29B2AC340E5; Mon, 24 Jan 2022 19:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052810; bh=z3KHjrtjkrAJ1l60+JVSkvpB2u2zxdDMwLh9FzYWkM8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eaT2bYcJPpqC4kXQPUSVMzK5zNTwDVesxhNLr4dm1ZEV/ob+7bsIO1BBCypGGWCLO py8fYe2WwjLjAB5rMvK7QByA1B06mPenxald7olN2nwRf7LJIXRmjx4WMNKnf8aUjW rTkJlfggZ34iAsA0FCzAd2WFq2mtDBs4aQPvUaSM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Lendacky , "Russell King (Oracle)" , Andrew Lunn , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 182/320] net: phy: prefer 1000baseT over 1000baseKX Date: Mon, 24 Jan 2022 19:42:46 +0100 Message-Id: <20220124183959.854124738@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Russell King (Oracle) [ Upstream commit f20f94f7f52c4685c81754f489ffcc72186e8bdb ] The PHY settings table is supposed to be sorted by descending match priority - in other words, earlier entries are preferred over later entries. The order of 1000baseKX/Full and 1000baseT/Full is such that we prefer 1000baseKX/Full over 1000baseT/Full, but 1000baseKX/Full is a lot rarer than 1000baseT/Full, and thus is much less likely to be preferred. This causes phylink problems - it means a fixed link specifying a speed of 1G and full duplex gets an ethtool linkmode of 1000baseKX/Full rather than 1000baseT/Full as would be expected - and since we offer userspace a software emulation of a conventional copper PHY, we want to offer copper modes in preference to anything else. However, we do still want to allow the rarer modes as well. Hence, let's reorder these two modes to prefer copper. Tested-by: Tom Lendacky Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn Reported-by: Florian Fainelli Link: https://lore.kernel.org/r/E1muvFO-00F6jY-1K@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/phy/phy-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c index 9412669b579c7..84064120918f0 100644 --- a/drivers/net/phy/phy-core.c +++ b/drivers/net/phy/phy-core.c @@ -128,11 +128,11 @@ static const struct phy_setting settings[] =3D { PHY_SETTING( 2500, FULL, 2500baseT_Full ), PHY_SETTING( 2500, FULL, 2500baseX_Full ), /* 1G */ - PHY_SETTING( 1000, FULL, 1000baseKX_Full ), PHY_SETTING( 1000, FULL, 1000baseT_Full ), PHY_SETTING( 1000, HALF, 1000baseT_Half ), PHY_SETTING( 1000, FULL, 1000baseT1_Full ), PHY_SETTING( 1000, FULL, 1000baseX_Full ), + PHY_SETTING( 1000, FULL, 1000baseKX_Full ), /* 100M */ PHY_SETTING( 100, FULL, 100baseT_Full ), PHY_SETTING( 100, FULL, 100baseT1_Full ), --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 403E4C433FE for ; Tue, 25 Jan 2022 02:36:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422188AbiAYCa3 (ORCPT ); Mon, 24 Jan 2022 21:30:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379455AbiAXULf (ORCPT ); Mon, 24 Jan 2022 15:11:35 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B2BC06F8EA; Mon, 24 Jan 2022 11:33:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9253261502; Mon, 24 Jan 2022 19:33:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55956C340E5; Mon, 24 Jan 2022 19:33:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052814; bh=0o1dRmrL+Pinxi7ZJCmm3u6/6Gkhhzo8HdcqSLllwjw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fXRdZkS7CYagkdrF0y2lKNSgTTDTJxIkeHFMRa2j3BGLCCznhiKgeomfj2hV/SPVU yYQ/pbXjeekJ6h180FSBEzIypLh0JsOJF+biokRmKxR1vNixQ9YFYHmlE4RFHAGMJU ivDjM959v10chQwaXz03FDUEkesGf3tnWRFsDefg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Iwona Winiarska , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.4 183/320] gpio: aspeed: Convert aspeed_gpio.lock to raw_spinlock Date: Mon, 24 Jan 2022 19:42:47 +0100 Message-Id: <20220124183959.884504044@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Iwona Winiarska [ Upstream commit 61a7904b6ace99b1bde0d0e867fa3097f5c8cee2 ] The gpio-aspeed driver implements an irq_chip which need to be invoked from hardirq context. Since spin_lock() can sleep with PREEMPT_RT, it is no longer legal to invoke it while interrupts are disabled. This also causes lockdep to complain about: [ 0.649797] [ BUG: Invalid wait context ] because aspeed_gpio.lock (spin_lock_t) is taken under irq_desc.lock (raw_spinlock_t). Let's use of raw_spinlock_t instead of spinlock_t. Signed-off-by: Iwona Winiarska Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpio/gpio-aspeed.c | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index 2820c59b5f071..22e0d6fcab1c4 100644 --- a/drivers/gpio/gpio-aspeed.c +++ b/drivers/gpio/gpio-aspeed.c @@ -53,7 +53,7 @@ struct aspeed_gpio_config { struct aspeed_gpio { struct gpio_chip chip; struct irq_chip irqc; - spinlock_t lock; + raw_spinlock_t lock; void __iomem *base; int irq; const struct aspeed_gpio_config *config; @@ -413,14 +413,14 @@ static void aspeed_gpio_set(struct gpio_chip *gc, uns= igned int offset, unsigned long flags; bool copro; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); copro =3D aspeed_gpio_copro_request(gpio, offset); =20 __aspeed_gpio_set(gc, offset, val); =20 if (copro) aspeed_gpio_copro_release(gpio, offset); - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); } =20 static int aspeed_gpio_dir_in(struct gpio_chip *gc, unsigned int offset) @@ -435,7 +435,7 @@ static int aspeed_gpio_dir_in(struct gpio_chip *gc, uns= igned int offset) if (!have_input(gpio, offset)) return -ENOTSUPP; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 reg =3D ioread32(addr); reg &=3D ~GPIO_BIT(offset); @@ -445,7 +445,7 @@ static int aspeed_gpio_dir_in(struct gpio_chip *gc, uns= igned int offset) if (copro) aspeed_gpio_copro_release(gpio, offset); =20 - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return 0; } @@ -463,7 +463,7 @@ static int aspeed_gpio_dir_out(struct gpio_chip *gc, if (!have_output(gpio, offset)) return -ENOTSUPP; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 reg =3D ioread32(addr); reg |=3D GPIO_BIT(offset); @@ -474,7 +474,7 @@ static int aspeed_gpio_dir_out(struct gpio_chip *gc, =20 if (copro) aspeed_gpio_copro_release(gpio, offset); - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return 0; } @@ -492,11 +492,11 @@ static int aspeed_gpio_get_direction(struct gpio_chip= *gc, unsigned int offset) if (!have_output(gpio, offset)) return 1; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 val =3D ioread32(bank_reg(gpio, bank, reg_dir)) & GPIO_BIT(offset); =20 - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return !val; =20 @@ -540,14 +540,14 @@ static void aspeed_gpio_irq_ack(struct irq_data *d) =20 status_addr =3D bank_reg(gpio, bank, reg_irq_status); =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); copro =3D aspeed_gpio_copro_request(gpio, offset); =20 iowrite32(bit, status_addr); =20 if (copro) aspeed_gpio_copro_release(gpio, offset); - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); } =20 static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set) @@ -566,7 +566,7 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d= , bool set) =20 addr =3D bank_reg(gpio, bank, reg_irq_enable); =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); copro =3D aspeed_gpio_copro_request(gpio, offset); =20 reg =3D ioread32(addr); @@ -578,7 +578,7 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d= , bool set) =20 if (copro) aspeed_gpio_copro_release(gpio, offset); - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); } =20 static void aspeed_gpio_irq_mask(struct irq_data *d) @@ -630,7 +630,7 @@ static int aspeed_gpio_set_type(struct irq_data *d, uns= igned int type) return -EINVAL; } =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); copro =3D aspeed_gpio_copro_request(gpio, offset); =20 addr =3D bank_reg(gpio, bank, reg_irq_type0); @@ -650,7 +650,7 @@ static int aspeed_gpio_set_type(struct irq_data *d, uns= igned int type) =20 if (copro) aspeed_gpio_copro_release(gpio, offset); - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 irq_set_handler_locked(d, handler); =20 @@ -720,7 +720,7 @@ static int aspeed_gpio_reset_tolerance(struct gpio_chip= *chip, =20 treg =3D bank_reg(gpio, to_bank(offset), reg_tolerance); =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); copro =3D aspeed_gpio_copro_request(gpio, offset); =20 val =3D readl(treg); @@ -734,7 +734,7 @@ static int aspeed_gpio_reset_tolerance(struct gpio_chip= *chip, =20 if (copro) aspeed_gpio_copro_release(gpio, offset); - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return 0; } @@ -860,7 +860,7 @@ static int enable_debounce(struct gpio_chip *chip, unsi= gned int offset, return rc; } =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 if (timer_allocation_registered(gpio, offset)) { rc =3D unregister_allocated_timer(gpio, offset); @@ -920,7 +920,7 @@ static int enable_debounce(struct gpio_chip *chip, unsi= gned int offset, configure_timer(gpio, offset, i); =20 out: - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return rc; } @@ -931,13 +931,13 @@ static int disable_debounce(struct gpio_chip *chip, u= nsigned int offset) unsigned long flags; int rc; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 rc =3D unregister_allocated_timer(gpio, offset); if (!rc) configure_timer(gpio, offset, 0); =20 - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); =20 return rc; } @@ -1019,7 +1019,7 @@ int aspeed_gpio_copro_grab_gpio(struct gpio_desc *des= c, return -EINVAL; bindex =3D offset >> 3; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 /* Sanity check, this shouldn't happen */ if (gpio->cf_copro_bankmap[bindex] =3D=3D 0xff) { @@ -1040,7 +1040,7 @@ int aspeed_gpio_copro_grab_gpio(struct gpio_desc *des= c, if (bit) *bit =3D GPIO_OFFSET(offset); bail: - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); return rc; } EXPORT_SYMBOL_GPL(aspeed_gpio_copro_grab_gpio); @@ -1064,7 +1064,7 @@ int aspeed_gpio_copro_release_gpio(struct gpio_desc *= desc) return -EINVAL; bindex =3D offset >> 3; =20 - spin_lock_irqsave(&gpio->lock, flags); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 /* Sanity check, this shouldn't happen */ if (gpio->cf_copro_bankmap[bindex] =3D=3D 0) { @@ -1078,7 +1078,7 @@ int aspeed_gpio_copro_release_gpio(struct gpio_desc *= desc) aspeed_gpio_change_cmd_source(gpio, bank, bindex, GPIO_CMDSRC_ARM); bail: - spin_unlock_irqrestore(&gpio->lock, flags); + raw_spin_unlock_irqrestore(&gpio->lock, flags); return rc; } EXPORT_SYMBOL_GPL(aspeed_gpio_copro_release_gpio); @@ -1151,7 +1151,7 @@ static int __init aspeed_gpio_probe(struct platform_d= evice *pdev) if (IS_ERR(gpio->base)) return PTR_ERR(gpio->base); =20 - spin_lock_init(&gpio->lock); + raw_spin_lock_init(&gpio->lock); =20 gpio_id =3D of_match_node(aspeed_gpio_of_table, pdev->dev.of_node); if (!gpio_id) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D436FC433EF for ; Mon, 24 Jan 2022 19:40:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354829AbiAXTjZ (ORCPT ); Mon, 24 Jan 2022 14:39:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56494 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344850AbiAXTdj (ORCPT ); Mon, 24 Jan 2022 14:33:39 -0500 Received: from smtp.kernel.org (relay.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 23DE3B8123D; Mon, 24 Jan 2022 19:33:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F510C340E5; Mon, 24 Jan 2022 19:33:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052816; bh=7j+0EPOqfiwnmF3g644Ln5eT1H0VN4xpzPxlRMVwvho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vomeabqA3rckczLurFNX8K4qDeCEO7pHxJL+dFcHDp0N1RpIYxFP/gJ70dmEGvm1Z qMGyVfBYQPDGYAUZkhnSHELlA75DCtv4301WNnKn5vs7LcxxBLTe2l9DJ0ceGZav4d WN4ZkZIqP6dbSDEWDEFCzUUvkXJTyFCPCqOAnywM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , Sasha Levin Subject: [PATCH 5.4 184/320] x86/mce: Mark mce_panic() noinstr Date: Mon, 24 Jan 2022 19:42:48 +0100 Message-Id: <20220124183959.914729760@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Borislav Petkov [ Upstream commit 3c7ce80a818fa7950be123cac80cd078e5ac1013 ] And allow instrumentation inside it because it does calls to other facilities which will not be tagged noinstr. Fixes vmlinux.o: warning: objtool: do_machine_check()+0xc73: call to mce_panic(= ) leaves .noinstr.text section Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20211208111343.8130-8-bp@alien8.de Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/x86/kernel/cpu/mce/core.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index c2a9762d278dd..290d64e04ab20 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -310,11 +310,17 @@ static void wait_for_panic(void) panic("Panicing machine check CPU died"); } =20 -static void mce_panic(const char *msg, struct mce *final, char *exp) +static noinstr void mce_panic(const char *msg, struct mce *final, char *ex= p) { - int apei_err =3D 0; struct llist_node *pending; struct mce_evt_llist *l; + int apei_err =3D 0; + + /* + * Allow instrumentation around external facilities usage. Not that it + * matters a whole lot since the machine is going to panic anyway. + */ + instrumentation_begin(); =20 if (!fake_panic) { /* @@ -329,7 +335,7 @@ static void mce_panic(const char *msg, struct mce *fina= l, char *exp) } else { /* Don't log too much for fake panic */ if (atomic_inc_return(&mce_fake_panicked) > 1) - return; + goto out; } pending =3D mce_gen_pool_prepare_records(); /* First print corrected ones that are still unlogged */ @@ -367,6 +373,9 @@ static void mce_panic(const char *msg, struct mce *fina= l, char *exp) panic(msg); } else pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg); + +out: + instrumentation_end(); } =20 /* Support code for software error injection */ --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A2B7C433FE for ; Mon, 24 Jan 2022 20:41:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355301AbiAXUjW (ORCPT ); Mon, 24 Jan 2022 15:39:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236888AbiAXULn (ORCPT ); Mon, 24 Jan 2022 15:11:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E75F5C06F8F9; Mon, 24 Jan 2022 11:33:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 86506614B8; Mon, 24 Jan 2022 19:33:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47EEBC340E5; Mon, 24 Jan 2022 19:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052820; bh=+JMII1/WLNgrn/UhD/fchGRwGgo2s8880QhuVgd4d5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o7FMlxVZF+WYqhnNfjyNMbrbckp7dq+wkbFVXXrbVybo7iPuPckYkYmB4BY/NLY4i PJEdoYgEWXrjbfQEzuQz9lT2Lpi+Mq6pQ07O+5/lAq2ll+E1uKeQ2OLMtg+nRKu4Lq 0A/aJUNk8V2pygpkqF8rES6Cki1oG/Q1Ilxboy2w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , Sasha Levin Subject: [PATCH 5.4 185/320] x86/mce: Mark mce_end() noinstr Date: Mon, 24 Jan 2022 19:42:49 +0100 Message-Id: <20220124183959.945114596@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Borislav Petkov [ Upstream commit b4813539d37fa31fed62cdfab7bd2dd8929c5b2e ] It is called by the #MC handler which is noinstr. Fixes vmlinux.o: warning: objtool: do_machine_check()+0xbd6: call to memset() l= eaves .noinstr.text section Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20211208111343.8130-9-bp@alien8.de Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/x86/kernel/cpu/mce/core.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 290d64e04ab20..a0f6c574c3783 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1080,10 +1080,13 @@ static int mce_start(int *no_way_out) * Synchronize between CPUs after main scanning loop. * This invokes the bulk of the Monarch processing. */ -static int mce_end(int order) +static noinstr int mce_end(int order) { - int ret =3D -1; u64 timeout =3D (u64)mca_cfg.monarch_timeout * NSEC_PER_USEC; + int ret =3D -1; + + /* Allow instrumentation around external facilities. */ + instrumentation_begin(); =20 if (!timeout) goto reset; @@ -1127,7 +1130,8 @@ static int mce_end(int order) /* * Don't reset anything. That's done by the Monarch. */ - return 0; + ret =3D 0; + goto out; } =20 /* @@ -1142,6 +1146,10 @@ reset: * Let others run again. */ atomic_set(&mce_executing, 0); + +out: + instrumentation_end(); + return ret; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8CD0C2BA4C for ; Mon, 24 Jan 2022 20:38:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387782AbiAXUhQ (ORCPT ); Mon, 24 Jan 2022 15:37:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379646AbiAXUME (ORCPT ); Mon, 24 Jan 2022 15:12:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E440EC0604CC; Mon, 24 Jan 2022 11:33:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A2A3EB8123F; Mon, 24 Jan 2022 19:33:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B49E1C340E8; Mon, 24 Jan 2022 19:33:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052826; bh=O1SAMCcuK67rzVRkR2DErJDeGgGNw2d29WnTxSsn70k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wZcH5UggiIWXMobnnTtHw9DIxbnfpFMRtB1QGeqowCiHkgpQKVgfcUitF8tFBrilY Pke2hje5X7pkUDYE4KcUwp8mo0fDEIpWvbhR/CyGGF5S9liIXbhw5APe3zFnY9NiGl lqPeI+H6/qozePedtSK8E31R0ZJ6fMLGDVJQJqVg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , Sasha Levin Subject: [PATCH 5.4 186/320] x86/mce: Mark mce_read_aux() noinstr Date: Mon, 24 Jan 2022 19:42:50 +0100 Message-Id: <20220124183959.976069776@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Borislav Petkov [ Upstream commit db6c996d6ce45dfb44891f0824a65ecec216f47a ] Fixes vmlinux.o: warning: objtool: do_machine_check()+0x681: call to mce_read_a= ux() leaves .noinstr.text section Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20211208111343.8130-10-bp@alien8.de Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/x86/kernel/cpu/mce/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index a0f6c574c3783..8a2b8e7913149 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -700,7 +700,7 @@ static struct notifier_block mce_default_nb =3D { /* * Read ADDR and MISC registers. */ -static void mce_read_aux(struct mce *m, int i) +static noinstr void mce_read_aux(struct mce *m, int i) { if (m->status & MCI_STATUS_MISCV) m->misc =3D mce_rdmsrl(msr_ops.misc(i)); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86AD4C41535 for ; Mon, 24 Jan 2022 20:38:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387766AbiAXUhO (ORCPT ); Mon, 24 Jan 2022 15:37:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379647AbiAXUME (ORCPT ); Mon, 24 Jan 2022 15:12:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9651BC028C1F; Mon, 24 Jan 2022 11:33:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3823861488; Mon, 24 Jan 2022 19:33:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F419CC340E5; Mon, 24 Jan 2022 19:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052829; bh=qGh2KMC0KjqVZsHyFocmreJrZNAvnD7Xei2FC+o7QDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G5/5TNIr+5uLd/tpBbBmTiPx9WxVfrpgSEDXCB6A4FpCzF5D1B4nTbUqT3qVLN8xx kqPx/kpW/55VA9nZDEU/bromFlscHu11MW0Adae6qdW3UEmlelUv4aNkl+gKD+wyi3 CaR1MmTqQsl4LFvzOfLAMJMrL6s9LicMl0NWZLi0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suresh Kumar , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 187/320] net: bonding: debug: avoid printing debug logs when bond is not notifying peers Date: Mon, 24 Jan 2022 19:42:51 +0100 Message-Id: <20220124184000.012353590@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Suresh Kumar [ Upstream commit fee32de284ac277ba434a2d59f8ce46528ff3946 ] Currently "bond_should_notify_peers: slave ..." messages are printed whenev= er "bond_should_notify_peers" function is called. +++ Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: (slave enp0s25): Received LACPDU on po= rt 1 Dec 12 12:33:26 node1 kernel: bond0: (slave enp0s25): Rx Machine: Port=3D1,= Last State=3D6, Curr State=3D6 Dec 12 12:33:26 node1 kernel: bond0: (slave enp0s25): partner sync=3D1 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 ... Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:30 node1 kernel: bond0: (slave enp4s3): Received LACPDU on por= t 2 Dec 12 12:33:30 node1 kernel: bond0: (slave enp4s3): Rx Machine: Port=3D2, = Last State=3D6, Curr State=3D6 Dec 12 12:33:30 node1 kernel: bond0: (slave enp4s3): partner sync=3D1 Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 +++ This is confusing and can also clutter up debug logs. Print logs only when the peer notification happens. Signed-off-by: Suresh Kumar Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/bonding/bond_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_mai= n.c index a7eaf80f500c0..ff50ccc7dceb1 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -792,9 +792,6 @@ static bool bond_should_notify_peers(struct bonding *bo= nd) slave =3D rcu_dereference(bond->curr_active_slave); rcu_read_unlock(); =20 - netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", - slave ? slave->dev->name : "NULL"); - if (!slave || !bond->send_peer_notif || bond->send_peer_notif % max(1, bond->params.peer_notif_delay) !=3D 0 || @@ -802,6 +799,9 @@ static bool bond_should_notify_peers(struct bonding *bo= nd) test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) return false; =20 + netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", + slave ? slave->dev->name : "NULL"); + return true; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78265C433FE for ; Mon, 24 Jan 2022 19:40:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354877AbiAXTjd (ORCPT ); Mon, 24 Jan 2022 14:39:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:32808 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350901AbiAXTdx (ORCPT ); Mon, 24 Jan 2022 14:33:53 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5183F61488; Mon, 24 Jan 2022 19:33:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25EB0C340E5; Mon, 24 Jan 2022 19:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052832; bh=tZM5TML74UbfSY7dpcQg47KWZMIdishfAIuWtvqaerk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XyS/jJCEXFQxvrCr/DY6Ulf9zZ+7hlFhckzP+6ORs7HzQJtOMleBApEENWrcbBDUp qCmA4W5QXFTXxJRc2QWuEGZdMTJAep/vto6FVFhlHmlAIw1p0uK+v4mIu3EdxuPKjw GWTmPQNIWfXhkEnheBuLI0cm2jgzzyvKgShtiQMI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Abeni , Daniel Borkmann , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Sasha Levin Subject: [PATCH 5.4 188/320] bpf: Do not WARN in bpf_warn_invalid_xdp_action() Date: Mon, 24 Jan 2022 19:42:52 +0100 Message-Id: <20220124184000.041545255@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Paolo Abeni [ Upstream commit 2cbad989033bff0256675c38f96f5faab852af4b ] The WARN_ONCE() in bpf_warn_invalid_xdp_action() can be triggered by any bugged program, and even attaching a correct program to a NIC not supporting the given action. The resulting splat, beyond polluting the logs, fouls automated tools: e.g. a syzkaller reproducers using an XDP program returning an unsupported action will never pass validation. Replace the WARN_ONCE with a less intrusive pr_warn_once(). Signed-off-by: Paolo Abeni Signed-off-by: Daniel Borkmann Acked-by: Toke H=C3=B8iland-J=C3=B8rgensen Link: https://lore.kernel.org/bpf/016ceec56e4817ebb2a9e35ce794d5c917df572c.= 1638189075.git.pabeni@redhat.com Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/core/filter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index b90c0b5a10112..92ce4d46f02e4 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -6912,9 +6912,9 @@ void bpf_warn_invalid_xdp_action(u32 act) { const u32 act_max =3D XDP_REDIRECT; =20 - WARN_ONCE(1, "%s XDP return value %u, expect packet loss!\n", - act > act_max ? "Illegal" : "Driver unsupported", - act); + pr_warn_once("%s XDP return value %u, expect packet loss!\n", + act > act_max ? "Illegal" : "Driver unsupported", + act); } EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B260C4321E for ; Mon, 24 Jan 2022 19:40:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355021AbiAXTjv (ORCPT ); Mon, 24 Jan 2022 14:39:51 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59192 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346860AbiAXTd6 (ORCPT ); Mon, 24 Jan 2022 14:33:58 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A06B60909; Mon, 24 Jan 2022 19:33:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 412DCC340E5; Mon, 24 Jan 2022 19:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052835; bh=pgsZHp9ixRySTOMnwePYjcM7jO08VdKO54ioWL4fvKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sekp9GWDIERD4sRv7gWYOYONOHL23qweS3Rdtt2a9ckZmIYNtWTmEjDjEbYhn0mLg RTFEtS6umF0MT6HPJ0Hx36uCYmNaf8SeoGFkSJA/ce4wcorGYsd3hHPRFl9WGFFhb3 zugbhWByFN6Z/1h/be1G0wzx84qwK2RVAzOz69pc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alistair Francis , Benjamin Tissoires , Sasha Levin Subject: [PATCH 5.4 189/320] HID: quirks: Allow inverting the absolute X/Y values Date: Mon, 24 Jan 2022 19:42:53 +0100 Message-Id: <20220124184000.070956590@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alistair Francis [ Upstream commit fd8d135b2c5e88662f2729e034913f183455a667 ] Add a HID_QUIRK_X_INVERT/HID_QUIRK_Y_INVERT quirk that can be used to invert the X/Y values. Signed-off-by: Alistair Francis [bentiss: silence checkpatch warning] Signed-off-by: Benjamin Tissoires Link: https://lore.kernel.org/r/20211208124045.61815-2-alistair@alistair23.= me Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/hid/hid-input.c | 6 ++++++ include/linux/hid.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index ea4c97f5b0736..749558aa27e78 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -1288,6 +1288,12 @@ void hidinput_hid_event(struct hid_device *hid, stru= ct hid_field *field, struct =20 input =3D field->hidinput->input; =20 + if (usage->type =3D=3D EV_ABS && + (((*quirks & HID_QUIRK_X_INVERT) && usage->code =3D=3D ABS_X) || + ((*quirks & HID_QUIRK_Y_INVERT) && usage->code =3D=3D ABS_Y))) { + value =3D field->logical_maximum - value; + } + if (usage->hat_min < usage->hat_max || usage->hat_dir) { int hat_dir =3D usage->hat_dir; if (!hat_dir) diff --git a/include/linux/hid.h b/include/linux/hid.h index ad46ed41e8836..d5f9bbf8afa51 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -344,6 +344,8 @@ struct hid_item { /* BIT(9) reserved for backward compatibility, was NO_INIT_INPUT_REPORTS */ #define HID_QUIRK_ALWAYS_POLL BIT(10) #define HID_QUIRK_INPUT_PER_APP BIT(11) +#define HID_QUIRK_X_INVERT BIT(12) +#define HID_QUIRK_Y_INVERT BIT(13) #define HID_QUIRK_SKIP_OUTPUT_REPORTS BIT(16) #define HID_QUIRK_SKIP_OUTPUT_REPORT_ID BIT(17) #define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4FCEC4332F for ; Mon, 24 Jan 2022 20:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387716AbiAXUhI (ORCPT ); Mon, 24 Jan 2022 15:37:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379733AbiAXUMU (ORCPT ); Mon, 24 Jan 2022 15:12:20 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA824C061748; Mon, 24 Jan 2022 11:33:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 79D8D61504; Mon, 24 Jan 2022 19:33:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E50CC340E5; Mon, 24 Jan 2022 19:33:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052838; bh=brX5qYXObnA5ZMaKED0orH5yXmiH2X/NMgB9WdDLijI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ICI2DdHMbZitXUrT0tZBuQ1R94iOoTakWjRNny/dE/CjCodtxQ4+x4ehR2HfEk42o OtGg1jzxj8mGvvay5iFIgrw6FoZzNwQy817S4xQ4YV37a/PdfssguubRwB5lQ5mDB/ dJY96oyvNnyXb3VCzSlXK9IUYHVTaI8c+0NK+YPU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 190/320] media: igorplugusb: receiver overflow should be reported Date: Mon, 24 Jan 2022 19:42:54 +0100 Message-Id: <20220124184000.102346977@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Young [ Upstream commit 8fede658e7ddb605bbd68ed38067ddb0af033db4 ] Without this, some IR will be missing mid-stream and we might decode something which never really occurred. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/rc/igorplugusb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c index b981f7290c1b2..1e8276040ea5b 100644 --- a/drivers/media/rc/igorplugusb.c +++ b/drivers/media/rc/igorplugusb.c @@ -64,9 +64,11 @@ static void igorplugusb_irdata(struct igorplugusb *ir, u= nsigned len) if (start >=3D len) { dev_err(ir->dev, "receive overflow invalid: %u", overflow); } else { - if (overflow > 0) + if (overflow > 0) { dev_warn(ir->dev, "receive overflow, at least %u lost", overflow); + ir_raw_event_reset(ir->rc); + } =20 do { rawir.duration =3D ir->buf_in[i] * 85333; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCDDFC433FE for ; Mon, 24 Jan 2022 20:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387700AbiAXUhG (ORCPT ); Mon, 24 Jan 2022 15:37:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379738AbiAXUMU (ORCPT ); Mon, 24 Jan 2022 15:12:20 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BE89C0604CE; Mon, 24 Jan 2022 11:34:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9B0D561504; Mon, 24 Jan 2022 19:34:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7662AC340E5; Mon, 24 Jan 2022 19:34:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052842; bh=PwjgCXsxBBNDaqdajnAiUXq66v/vFynQ/z8Ps+IVHK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cPB5HLfHwC4Fv1bZyMybjC+uk4o1gJfA9dUZ0vHHqKVDaP+s1a2MoY1DAz8VHocxo KlTn15WCFxhi8q76vU22CIs+5rAj0TxgjMFhqnJvbnfbcTUrmEhx/sXxAxLC0EDBJx 7ce/V0yeR8q4xfGtS/iCctXSGV2U3+L3u6IqsB7c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Qingyang , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 191/320] media: saa7146: hexium_gemini: Fix a NULL pointer dereference in hexium_attach() Date: Mon, 24 Jan 2022 19:42:55 +0100 Message-Id: <20220124184000.143564158@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhou Qingyang [ Upstream commit 3af86b046933ba513d08399dba0d4d8b50d607d0 ] In hexium_attach(dev, info), saa7146_vv_init() is called to allocate a new memory for dev->vv_data. saa7146_vv_release() will be called on failure of saa7146_register_device(). There is a dereference of dev->vv_data in saa7146_vv_release(), which could lead to a NULL pointer dereference on failure of saa7146_vv_init(). Fix this bug by adding a check of saa7146_vv_init(). This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_VIDEO_HEXIUM_GEMINI=3Dm show no new warnings, and our static analyzer no longer warns about this code. Link: https://lore.kernel.org/linux-media/20211203154030.111210-1-zhou1615@= umn.edu Signed-off-by: Zhou Qingyang Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/common/saa7146/saa7146_fops.c | 2 +- drivers/media/pci/saa7146/hexium_gemini.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/co= mmon/saa7146/saa7146_fops.c index aabb830e74689..4b332ea986168 100644 --- a/drivers/media/common/saa7146/saa7146_fops.c +++ b/drivers/media/common/saa7146/saa7146_fops.c @@ -525,7 +525,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa= 7146_ext_vv *ext_vv) ERR("out of memory. aborting.\n"); kfree(vv); v4l2_ctrl_handler_free(hdl); - return -1; + return -ENOMEM; } =20 saa7146_video_uops.init(dev,vv); diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/= saa7146/hexium_gemini.c index f962269306707..86d4e2abed82a 100644 --- a/drivers/media/pci/saa7146/hexium_gemini.c +++ b/drivers/media/pci/saa7146/hexium_gemini.c @@ -284,7 +284,12 @@ static int hexium_attach(struct saa7146_dev *dev, stru= ct saa7146_pci_extension_d hexium_set_input(hexium, 0); hexium->cur_input =3D 0; =20 - saa7146_vv_init(dev, &vv_data); + ret =3D saa7146_vv_init(dev, &vv_data); + if (ret) { + i2c_del_adapter(&hexium->i2c_adapter); + kfree(hexium); + return ret; + } =20 vv_data.vid_ops.vidioc_enum_input =3D vidioc_enum_input; vv_data.vid_ops.vidioc_g_input =3D vidioc_g_input; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61DB6C4167B for ; Mon, 24 Jan 2022 20:38:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386151AbiAXUfN (ORCPT ); Mon, 24 Jan 2022 15:35:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354861AbiAXUMv (ORCPT ); Mon, 24 Jan 2022 15:12:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E95CDC028C2B; Mon, 24 Jan 2022 11:34:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 82F396141C; Mon, 24 Jan 2022 19:34:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CBA8C340E5; Mon, 24 Jan 2022 19:34:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052844; bh=XtiamZuhFQg/KSWaToglrULMfVhgN5zJmScIv/wuNgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JHhe+c84IR0fW7CDCPmKgZtgfCslukwlWYO6Kf8DAoQfWiiwrOezC99RPpMvGlhRS SsVkdQ7NKh1iedZQAFet9EmWY+jDAAUo1j1x81m0OnZIDsoPjDCHiKmG3p6fCztPjH FXzZyxZ+gr1ZcuYdtjhEkZXEi5pu0ULe5bJo3jWI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "H. Nikolaus Schaller" , Ulf Hansson , Sasha Levin Subject: [PATCH 5.4 192/320] mmc: core: Fixup storing of OCR for MMC_QUIRK_NONSTD_SDIO Date: Mon, 24 Jan 2022 19:42:56 +0100 Message-Id: <20220124184000.180649765@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ulf Hansson [ Upstream commit 8c3e5b74b9e2146f564905e50ca716591c76d4f1 ] The mmc core takes a specific path to support initializing of a non-standard SDIO card. This is triggered by looking for the card-quirk, MMC_QUIRK_NONSTD_SDIO. In mmc_sdio_init_card() this gets rather messy, as it causes the code to bail out earlier, compared to the usual path. This leads to that the OCR doesn't get saved properly in card->ocr. Fortunately, only omap_hsmmc has been using the MMC_QUIRK_NONSTD_SDIO and is dealing with the issue, by assigning a hardcoded value (0x80) to card->ocr from an ->init_card() ops. To make the behaviour consistent, let's instead rely on the core to save the OCR in card->ocr during initialization. Reported-by: H. Nikolaus Schaller Signed-off-by: Ulf Hansson Signed-off-by: H. Nikolaus Schaller Link: https://lore.kernel.org/r/e7936cff7fc24d187ef2680d3b4edb0ade58f293.16= 36564631.git.hns@goldelico.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/mmc/core/sdio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 0bf33786fc5c5..9e0791332ef38 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -626,6 +626,8 @@ try_again: if (host->ops->init_card) host->ops->init_card(host, card); =20 + card->ocr =3D ocr_card; + /* * If the host and card support UHS-I mode request the card * to switch to 1.8V signaling level. No 1.8v signalling if @@ -738,7 +740,7 @@ try_again: goto mismatch; } } - card->ocr =3D ocr_card; + mmc_fixup_device(card, sdio_fixup_methods); =20 if (card->type =3D=3D MMC_TYPE_SD_COMBO) { --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E616C4321E for ; Mon, 24 Jan 2022 19:40:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355079AbiAXTj5 (ORCPT ); Mon, 24 Jan 2022 14:39:57 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33022 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349435AbiAXTeK (ORCPT ); Mon, 24 Jan 2022 14:34:10 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7B0D06141C; Mon, 24 Jan 2022 19:34:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 878CBC340E8; Mon, 24 Jan 2022 19:34:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052847; bh=Mux5XJTW3pJiVPcl/iFS7hUyFsEJtVaPya5qb4ckeX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O9ukjqbHFJI4u8EK1acklXuedqBmPLnXrLweHxEetECjZw82iZ4mMNVCasmYBYrr1 MBTvJLkCT8KO/moM68GiNrtPHZKITlHYxs45LsJfDexELOzbxZ5hzuHgnSjH3RoUX0 65gz8wDOWaHR28XHTHrRdZeQAxGGOU9IHucnPyIM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gaosheng Cui , Richard Guy Briggs , Paul Moore , Sasha Levin Subject: [PATCH 5.4 193/320] audit: ensure userspace is penalized the same as the kernel when under pressure Date: Mon, 24 Jan 2022 19:42:57 +0100 Message-Id: <20220124184000.210055259@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Moore [ Upstream commit 8f110f530635af44fff1f4ee100ecef0bac62510 ] Due to the audit control mutex necessary for serializing audit userspace messages we haven't been able to block/penalize userspace processes that attempt to send audit records while the system is under audit pressure. The result is that privileged userspace applications have a priority boost with respect to audit as they are not bound by the same audit queue throttling as the other tasks on the system. This patch attempts to restore some balance to the system when under audit pressure by blocking these privileged userspace tasks after they have finished their audit processing, and dropped the audit control mutex, but before they return to userspace. Reported-by: Gaosheng Cui Tested-by: Gaosheng Cui Reviewed-by: Richard Guy Briggs Signed-off-by: Paul Moore Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- kernel/audit.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/kernel/audit.c b/kernel/audit.c index d67fce9e3f8b8..146edff0c73ec 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1528,6 +1528,20 @@ static void audit_receive(struct sk_buff *skb) nlh =3D nlmsg_next(nlh, &len); } audit_ctl_unlock(); + + /* can't block with the ctrl lock, so penalize the sender now */ + if (audit_backlog_limit && + (skb_queue_len(&audit_queue) > audit_backlog_limit)) { + DECLARE_WAITQUEUE(wait, current); + + /* wake kauditd to try and flush the queue */ + wake_up_interruptible(&kauditd_wait); + + add_wait_queue_exclusive(&audit_backlog_wait, &wait); + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout(audit_backlog_wait_time); + remove_wait_queue(&audit_backlog_wait, &wait); + } } =20 /* Run custom bind function on netlink socket group connect or bind reques= ts. */ @@ -1772,7 +1786,9 @@ struct audit_buffer *audit_log_start(struct audit_con= text *ctx, gfp_t gfp_mask, * task_tgid_vnr() since auditd_pid is set in audit_receive_msg() * using a PID anchored in the caller's namespace * 2. generator holding the audit_cmd_mutex - we don't want to block - * while holding the mutex */ + * while holding the mutex, although we do penalize the sender + * later in audit_receive() when it is safe to block + */ if (!(auditd_test_task(current) || audit_ctl_owner_current())) { long stime =3D audit_backlog_wait_time; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 951EDC3527A for ; Mon, 24 Jan 2022 20:38:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386681AbiAXUfv (ORCPT ); Mon, 24 Jan 2022 15:35:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348595AbiAXUNT (ORCPT ); Mon, 24 Jan 2022 15:13:19 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B954C028C34; Mon, 24 Jan 2022 11:34:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 051A8B81232; Mon, 24 Jan 2022 19:34:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 362BBC340E5; Mon, 24 Jan 2022 19:34:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052850; bh=ix7wDqJn/RxHYwks4UqY3CjF4nw8nPf/m6csEMp6k/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PYoIjwYMu0bu0bluoxCv+20bSQneqjUEMCK5KdODzs8JHktjRhES4xMPKb6L6j2b6 g0IhHvtv3D5PST5+PHN8dEnb8/iIlBEyn3TiPULUpaV9sggb5Z6jvWb8ojV9TQQlyt nQrlYQqFvJ8lJCVNp7yKxUxJCfm7P8v11CYzfLYA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biwen Li , Li Yang , Shawn Guo , Sasha Levin Subject: [PATCH 5.4 194/320] arm64: dts: ls1028a-qds: move rtc node to the correct i2c bus Date: Mon, 24 Jan 2022 19:42:58 +0100 Message-Id: <20220124184000.244014223@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Biwen Li [ Upstream commit cbe9d948eadfe352ad45495a7cc5bf20a1b29d90 ] The i2c rtc is on i2c2 bus not i2c1 bus, so fix it in dts. Signed-off-by: Biwen Li Signed-off-by: Li Yang Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts b/arch/arm64= /boot/dts/freescale/fsl-ls1028a-qds.dts index 078a5010228cd..0b3a93c4155d2 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts @@ -161,11 +161,6 @@ vcc-supply =3D <&sb_3v3>; }; =20 - rtc@51 { - compatible =3D "nxp,pcf2129"; - reg =3D <0x51>; - }; - eeprom@56 { compatible =3D "atmel,24c512"; reg =3D <0x56>; @@ -209,6 +204,15 @@ =20 }; =20 +&i2c1 { + status =3D "okay"; + + rtc@51 { + compatible =3D "nxp,pcf2129"; + reg =3D <0x51>; + }; +}; + &enetc_port1 { phy-handle =3D <&qds_phy1>; phy-connection-type =3D "rgmii-id"; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3C3BC433FE for ; Mon, 24 Jan 2022 19:42:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349979AbiAXTmo (ORCPT ); Mon, 24 Jan 2022 14:42:44 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33078 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348370AbiAXTeO (ORCPT ); Mon, 24 Jan 2022 14:34:14 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0245D614DA; Mon, 24 Jan 2022 19:34:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 132E2C340E5; Mon, 24 Jan 2022 19:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052853; bh=LrpabL+wuM/+nyKF87fxZioZKj1x5/6s1eLkOzRY2fU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TI8YxfgyLtVTpnlopVBY9o34bsZzUNfE8xgjfm0RlcUnM9Zc/989kFdzGFc1zjAXo 0SIeF6MJE3DEBBhEUqo6QdlANhAMXSXQWJjBb53Jh1O0ktJiNPN8af8I1Ig0CtROcZ cf/FIhkomdfl5mxHecRUW4CVSJSwdwaV+Puak+5Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thierry Reding , Sasha Levin Subject: [PATCH 5.4 195/320] arm64: tegra: Adjust length of CCPLEX cluster MMIO region Date: Mon, 24 Jan 2022 19:42:59 +0100 Message-Id: <20220124184000.275002434@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thierry Reding [ Upstream commit 2b14cbd643feea5fc17c6e8bead4e71088c69acd ] The Tegra186 CCPLEX cluster register region is 4 MiB is length, not 4 MiB - 1. This was likely presumed to be the "limit" rather than length. Fix it up. Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm64/boot/dts/nvidia/tegra186.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/nvidia/tegra186.dtsi b/arch/arm64/boot/dts= /nvidia/tegra186.dtsi index 9abf0cb1dd67f..4457262750734 100644 --- a/arch/arm64/boot/dts/nvidia/tegra186.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra186.dtsi @@ -709,7 +709,7 @@ =20 ccplex@e000000 { compatible =3D "nvidia,tegra186-ccplex-cluster"; - reg =3D <0x0 0x0e000000 0x0 0x3fffff>; + reg =3D <0x0 0x0e000000 0x0 0x400000>; =20 nvidia,bpmp =3D <&bpmp>; }; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6845C433F5 for ; Mon, 24 Jan 2022 20:38:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386665AbiAXUfs (ORCPT ); Mon, 24 Jan 2022 15:35:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355136AbiAXUNU (ORCPT ); Mon, 24 Jan 2022 15:13:20 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D84DC028BE4; Mon, 24 Jan 2022 11:34:23 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E8796B810BD; Mon, 24 Jan 2022 19:34:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3A8DC340E5; Mon, 24 Jan 2022 19:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052860; bh=6dHo04fHFiPT6f+jP1NYlQtr50rOB45dS0uHn/hwoCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W7YvEEaqT7ho/FzM0nBmzUAIYuwvUtnEyfL7F7XX2bXkwxhlyhWMCwdmH8iHEfNLs fQiTRer3cCxTcPcia/tYFqWE4Furgts0eebbjY+AolxEIs+HlnOe8AksRvWhxz6ymP zh3e0jmOFOdlz+9O6DqXNlCj3MfF0diYbwg/POko= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Pandruvada , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.4 196/320] cpufreq: Fix initialization of min and max frequency QoS requests Date: Mon, 24 Jan 2022 19:43:00 +0100 Message-Id: <20220124184000.304813534@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki [ Upstream commit 521223d8b3ec078f670c7c35a1a04b1b2af07966 ] The min and max frequency QoS requests in the cpufreq core are initialized to whatever the current min and max frequency values are at the init time, but if any of these values change later (for example, cpuinfo.max_freq is updated by the driver), these initial request values will be limiting the CPU frequency unnecessarily unless they are changed by user space via sysfs. To address this, initialize min_freq_req and max_freq_req to FREQ_QOS_MIN_DEFAULT_VALUE and FREQ_QOS_MAX_DEFAULT_VALUE, respectively, so they don't really limit anything until user space updates them. Reported-by: Srinivas Pandruvada Tested-by: Srinivas Pandruvada Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/cpufreq/cpufreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index cb7949a2ac0ca..af9f348048629 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1393,7 +1393,7 @@ static int cpufreq_online(unsigned int cpu) =20 ret =3D freq_qos_add_request(&policy->constraints, policy->min_freq_req, FREQ_QOS_MIN, - policy->min); + FREQ_QOS_MIN_DEFAULT_VALUE); if (ret < 0) { /* * So we don't call freq_qos_remove_request() for an @@ -1413,7 +1413,7 @@ static int cpufreq_online(unsigned int cpu) =20 ret =3D freq_qos_add_request(&policy->constraints, policy->max_freq_req, FREQ_QOS_MAX, - policy->max); + FREQ_QOS_MAX_DEFAULT_VALUE); if (ret < 0) { policy->max_freq_req =3D NULL; goto out_destroy_policy; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09083C43219 for ; Mon, 24 Jan 2022 19:41:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355185AbiAXTkJ (ORCPT ); Mon, 24 Jan 2022 14:40:09 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59736 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347352AbiAXTeY (ORCPT ); Mon, 24 Jan 2022 14:34:24 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 54F3060917; Mon, 24 Jan 2022 19:34:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A362C340E5; Mon, 24 Jan 2022 19:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052863; bh=6+NvI3D2ofS6tpLj8IEjhMlFMf0PyRxXKA/Z7sc6oR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wW09XfjEhMqBl+MMMmVeKHbGzWyCoGrFSVMnI7OszdpdPNnptXKo/wFVzuiUoqiqL Rs4v3ST175j1GQ4XyHRXZMRAMEzknggpmF0zmh702jan9Vm41MWZjVoESIzkWUlGb6 1tS7MBcuVDZVN89gakeFQUKZR+cTydsPki4xwBxo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Kai-Heng Feng , Sasha Levin Subject: [PATCH 5.4 197/320] usb: hub: Add delay for SuperSpeed hub resume to let links transit to U0 Date: Mon, 24 Jan 2022 19:43:01 +0100 Message-Id: <20220124184000.335031832@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 00558586382891540c59c9febc671062425a6e47 ] When a new USB device gets plugged to nested hubs, the affected hub, which connects to usb 2-1.4-port2, doesn't report there's any change, hence the nested hubs go back to runtime suspend like nothing happened: [ 281.032951] usb usb2: usb wakeup-resume [ 281.032959] usb usb2: usb auto-resume [ 281.032974] hub 2-0:1.0: hub_resume [ 281.033011] usb usb2-port1: status 0263 change 0000 [ 281.033077] hub 2-0:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.049797] usb 2-1: usb wakeup-resume [ 281.069800] usb 2-1: Waited 0ms for CONNECT [ 281.069810] usb 2-1: finish resume [ 281.070026] hub 2-1:1.0: hub_resume [ 281.070250] usb 2-1-port4: status 0203 change 0000 [ 281.070272] usb usb2-port1: resume, status 0 [ 281.070282] hub 2-1:1.0: state 7 ports 4 chg 0010 evt 0000 [ 281.089813] usb 2-1.4: usb wakeup-resume [ 281.109792] usb 2-1.4: Waited 0ms for CONNECT [ 281.109801] usb 2-1.4: finish resume [ 281.109991] hub 2-1.4:1.0: hub_resume [ 281.110147] usb 2-1.4-port2: status 0263 change 0000 [ 281.110234] usb 2-1-port4: resume, status 0 [ 281.110239] usb 2-1-port4: status 0203, change 0000, 10.0 Gb/s [ 281.110266] hub 2-1.4:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.110426] hub 2-1.4:1.0: hub_suspend [ 281.110565] usb 2-1.4: usb auto-suspend, wakeup 1 [ 281.130998] hub 2-1:1.0: hub_suspend [ 281.137788] usb 2-1: usb auto-suspend, wakeup 1 [ 281.142935] hub 2-0:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.177828] usb 2-1: usb wakeup-resume [ 281.197839] usb 2-1: Waited 0ms for CONNECT [ 281.197850] usb 2-1: finish resume [ 281.197984] hub 2-1:1.0: hub_resume [ 281.198203] usb 2-1-port4: status 0203 change 0000 [ 281.198228] usb usb2-port1: resume, status 0 [ 281.198237] hub 2-1:1.0: state 7 ports 4 chg 0010 evt 0000 [ 281.217835] usb 2-1.4: usb wakeup-resume [ 281.237834] usb 2-1.4: Waited 0ms for CONNECT [ 281.237845] usb 2-1.4: finish resume [ 281.237990] hub 2-1.4:1.0: hub_resume [ 281.238067] usb 2-1.4-port2: status 0263 change 0000 [ 281.238148] usb 2-1-port4: resume, status 0 [ 281.238152] usb 2-1-port4: status 0203, change 0000, 10.0 Gb/s [ 281.238166] hub 2-1.4:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.238385] hub 2-1.4:1.0: hub_suspend [ 281.238523] usb 2-1.4: usb auto-suspend, wakeup 1 [ 281.258076] hub 2-1:1.0: hub_suspend [ 281.265744] usb 2-1: usb auto-suspend, wakeup 1 [ 281.285976] hub 2-0:1.0: hub_suspend [ 281.285988] usb usb2: bus auto-suspend, wakeup 1 USB 3.2 spec, 9.2.5.4 "Changing Function Suspend State" says that "If the link is in a non-U0 state, then the device must transition the link to U0 prior to sending the remote wake message", but the hub only transits the link to U0 after signaling remote wakeup. So be more forgiving and use a 20ms delay to let the link transit to U0 for remote wakeup. Suggested-by: Alan Stern Acked-by: Alan Stern Signed-off-by: Kai-Heng Feng Link: https://lore.kernel.org/r/20211215120108.336597-1-kai.heng.feng@canon= ical.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/usb/core/hub.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 69dd48f9507e5..4cf0dc7f330dd 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1108,7 +1108,10 @@ static void hub_activate(struct usb_hub *hub, enum h= ub_activation_type type) } else { hub_power_on(hub, true); } - } + /* Give some time on remote wakeup to let links to transit to U0 */ + } else if (hub_is_superspeed(hub->hdev)) + msleep(20); + init2: =20 /* --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5946C433F5 for ; Mon, 24 Jan 2022 20:38:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387344AbiAXUgq (ORCPT ); Mon, 24 Jan 2022 15:36:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355210AbiAXUNW (ORCPT ); Mon, 24 Jan 2022 15:13:22 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64FABC01D7C6; Mon, 24 Jan 2022 11:34:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 20793B811F9; Mon, 24 Jan 2022 19:34:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 484C7C340E7; Mon, 24 Jan 2022 19:34:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052866; bh=Y61sEYe89JMN62S2d5pSk0ZMtlqtnSfDmA0d2mMjqnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zOg5ghPi9P++ZIlF8nhfI1ZR/btNuxv0YTTR5CyW5RB9JmtV+YUnSTjN4O/+qr76u XS2WuZsh6lEqKziDIdUbZZfTmxxk+mlEpc+d0JjlypUMTrXlWM7w0Iepb2OZ8JXeAb K4If8OPKznMWKEviLAm2IOkOoDWzdD6ecuCh4Eeg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zekun Shen , Kalle Valo , Sasha Levin Subject: [PATCH 5.4 198/320] ath9k: Fix out-of-bound memcpy in ath9k_hif_usb_rx_stream Date: Mon, 24 Jan 2022 19:43:02 +0100 Message-Id: <20220124184000.365790613@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zekun Shen [ Upstream commit 6ce708f54cc8d73beca213cec66ede5ce100a781 ] Large pkt_len can lead to out-out-bound memcpy. Current ath9k_hif_usb_rx_stream allows combining the content of two urb inputs to one pkt. The first input can indicate the size of the pkt. Any remaining size is saved in hif_dev->rx_remain_len. While processing the next input, memcpy is used with rx_remain_len. 4-byte pkt_len can go up to 0xffff, while a single input is 0x4000 maximum in size (MAX_RX_BUF_SIZE). Thus, the patch adds a check for pkt_len which must not exceed 2 * MAX_RX_BUG_SIZE. BUG: KASAN: slab-out-of-bounds in ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_ht= c] Read of size 46393 at addr ffff888018798000 by task kworker/0:1/23 CPU: 0 PID: 23 Comm: kworker/0:1 Not tainted 5.6.0 #63 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.10.2-0-g5f4c7b1-prebuilt.qemu-project.org 04/01/2014 Workqueue: events request_firmware_work_func Call Trace: dump_stack+0x76/0xa0 print_address_description.constprop.0+0x16/0x200 ? ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_htc] ? ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_htc] __kasan_report.cold+0x37/0x7c ? ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_htc] kasan_report+0xe/0x20 check_memory_region+0x15a/0x1d0 memcpy+0x20/0x50 ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_htc] ? hif_usb_mgmt_cb+0x2d9/0x2d9 [ath9k_htc] ? _raw_spin_lock_irqsave+0x7b/0xd0 ? _raw_spin_trylock_bh+0x120/0x120 ? __usb_unanchor_urb+0x12f/0x210 __usb_hcd_giveback_urb+0x1e4/0x380 usb_giveback_urb_bh+0x241/0x4f0 ? __hrtimer_run_queues+0x316/0x740 ? __usb_hcd_giveback_urb+0x380/0x380 tasklet_action_common.isra.0+0x135/0x330 __do_softirq+0x18c/0x634 irq_exit+0x114/0x140 smp_apic_timer_interrupt+0xde/0x380 apic_timer_interrupt+0xf/0x20 I found the bug using a custome USBFuzz port. It's a research work to fuzz USB stack/drivers. I modified it to fuzz ath9k driver only, providing hand-crafted usb descriptors to QEMU. After fixing the value of pkt_tag to ATH_USB_RX_STREAM_MODE_TAG in QEMU emulation, I found the KASAN report. The bug is triggerable whenever pkt_len is above two MAX_RX_BUG_SIZE. I used the same input that crashes to test the driver works when applying the patch. Signed-off-by: Zekun Shen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YXsidrRuK6zBJicZ@10-18-43-117.dynapool.wire= less.nyu.edu Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/wireless/ath/ath9k/hif_usb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireles= s/ath/ath9k/hif_usb.c index 2ed98aaed6fb5..c8c7afe0e343e 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c @@ -590,6 +590,13 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_= usb *hif_dev, return; } =20 + if (pkt_len > 2 * MAX_RX_BUF_SIZE) { + dev_err(&hif_dev->udev->dev, + "ath9k_htc: invalid pkt_len (%x)\n", pkt_len); + RX_STAT_INC(skb_dropped); + return; + } + pad_len =3D 4 - (pkt_len & 0x3); if (pad_len =3D=3D 4) pad_len =3D 0; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA886C43219 for ; Mon, 24 Jan 2022 20:38:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386568AbiAXUfk (ORCPT ); Mon, 24 Jan 2022 15:35:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355214AbiAXUNW (ORCPT ); Mon, 24 Jan 2022 15:13:22 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B52EC01D7CA; Mon, 24 Jan 2022 11:34:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 53244B811FC; Mon, 24 Jan 2022 19:34:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71581C340E5; Mon, 24 Jan 2022 19:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052870; bh=TcxqqP3k9ttYzsoT+++OolzMeJ1YguBUZ1x8o29WZxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ku7Efkn0xzFgM22oLcm1cJ3gJf7aDlY/NQ5NMufPiVdUHsdDSoX0ORo5rWNp1PvPt iJVvhbqsEkw7DvenL4uHHrhEcckW5QkiFWVqwYxwKzcOiD7mFVrTgig2j+CaQIAZzS b5iOFG/oryM1Ld/VzDPPAYmv7WAIBQxuEKjlK6Zk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Luca Coelho , Sasha Levin Subject: [PATCH 5.4 199/320] iwlwifi: fix leaks/bad data after failed firmware load Date: Mon, 24 Jan 2022 19:43:03 +0100 Message-Id: <20220124184000.405209110@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg [ Upstream commit ab07506b0454bea606095951e19e72c282bfbb42 ] If firmware load fails after having loaded some parts of the firmware, e.g. the IML image, then this would leak. For the host command list we'd end up running into a WARN on the next attempt to load another firmware image. Fix this by calling iwl_dealloc_ucode() on failures, and make that also clear the data so we start fresh on the next round. Signed-off-by: Johannes Berg Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211210110539.1f742f0eb58a.I1315f2= 2f6aa632d94ae2069f85e1bca5e734dce0@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wir= eless/intel/iwlwifi/iwl-drv.c index e68366f248fe3..c1a2fb154fe91 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -183,6 +183,9 @@ static void iwl_dealloc_ucode(struct iwl_drv *drv) =20 for (i =3D 0; i < IWL_UCODE_TYPE_MAX; i++) iwl_free_fw_img(drv, drv->fw.img + i); + + /* clear the data for the aborted load case */ + memset(&drv->fw, 0, sizeof(drv->fw)); } =20 static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc, @@ -1338,6 +1341,7 @@ static void iwl_req_fw_callback(const struct firmware= *ucode_raw, void *context) int i; bool load_module =3D false; bool usniffer_images =3D false; + bool failure =3D true; =20 fw->ucode_capa.max_probe_length =3D IWL_DEFAULT_MAX_PROBE_LENGTH; fw->ucode_capa.standard_phy_calibration_size =3D @@ -1604,6 +1608,7 @@ static void iwl_req_fw_callback(const struct firmware= *ucode_raw, void *context) op->name, err); #endif } + failure =3D false; goto free; =20 try_again: @@ -1619,6 +1624,9 @@ static void iwl_req_fw_callback(const struct firmware= *ucode_raw, void *context) complete(&drv->request_firmware_complete); device_release_driver(drv->trans->dev); free: + if (failure) + iwl_dealloc_ucode(drv); + if (pieces) { for (i =3D 0; i < ARRAY_SIZE(pieces->img); i++) kfree(pieces->img[i].sec); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDBAEC433EF for ; Mon, 24 Jan 2022 20:38:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386546AbiAXUfi (ORCPT ); Mon, 24 Jan 2022 15:35:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355347AbiAXUNa (ORCPT ); Mon, 24 Jan 2022 15:13:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC501C06174E; Mon, 24 Jan 2022 11:34:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 54E62B811FC; Mon, 24 Jan 2022 19:34:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83B43C340E5; Mon, 24 Jan 2022 19:34:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052873; bh=5jWSEyoXOPCc+nJwcvUbZBzSLJhgsecoSxLzR5hVwFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=saNl67Fq3l52jnTQABG/5BqJ9nYI20DY3PaxyadRAMhn1F9+bp4dsJu0UMgSxNdk0 V+DZHLOvbqqKChBABfCNZUsZGm8wf/uFDbMmujwJuuQcnPv3F//n1ik+qPv3hst5mJ NVLZxDqDfj2bH7Hdqedk7rxThXuaSJ8AuYYUnH5k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Luca Coelho , Sasha Levin Subject: [PATCH 5.4 200/320] iwlwifi: remove module loading failure message Date: Mon, 24 Jan 2022 19:43:04 +0100 Message-Id: <20220124184000.439618211@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg [ Upstream commit 6518f83ffa51131daaf439b66094f684da3fb0ae ] When CONFIG_DEBUG_TEST_DRIVER_REMOVE is set, iwlwifi crashes when the opmode module cannot be loaded, due to completing the completion before using drv->dev, which can then already be freed. Fix this by removing the (fairly useless) message. Moving the completion later causes a deadlock instead, so that's not an option. Signed-off-by: Johannes Berg Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/20211210091245.289008-2-luca@coelho.fi Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wir= eless/intel/iwlwifi/iwl-drv.c index c1a2fb154fe91..83cb2ad03451b 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -1599,15 +1599,8 @@ static void iwl_req_fw_callback(const struct firmwar= e *ucode_raw, void *context) * else from proceeding if the module fails to load * or hangs loading. */ - if (load_module) { + if (load_module) request_module("%s", op->name); -#ifdef CONFIG_IWLWIFI_OPMODE_MODULAR - if (err) - IWL_ERR(drv, - "failed to load module %s (error %d), is dynamic loading enabled?\n", - op->name, err); -#endif - } failure =3D false; goto free; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D0B6C4332F for ; Mon, 24 Jan 2022 19:57:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351859AbiAXT46 (ORCPT ); Mon, 24 Jan 2022 14:56:58 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34480 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354545AbiAXTgp (ORCPT ); Mon, 24 Jan 2022 14:36:45 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 333F1614BB; Mon, 24 Jan 2022 19:36:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18618C340E5; Mon, 24 Jan 2022 19:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053004; bh=Wbkwr54W1ZE6NvANhIYMVi477GP/ssZByIQOh6Dkhg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aJfdZet5sHr+sw9ivVm1NjheeRgxfkR3q+dcspb06QImEkIPYMWT4GnVlnUGlYt+6 isLFE7sa+GrdBdVbFC6KZTmTEW/OAeiIXY+k+eRfmMdA+FUblVe06JfzhJsoYcq3PI TfQ4V2Do/pinxaCbKYQVPfG9CZpESr3H3AGGbF7g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilan Peer , Luca Coelho , Sasha Levin Subject: [PATCH 5.4 201/320] iwlwifi: mvm: Fix calculation of frame length Date: Mon, 24 Jan 2022 19:43:05 +0100 Message-Id: <20220124184000.477352922@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ilan Peer [ Upstream commit 40a0b38d7a7f91a6027287e0df54f5f547e8d27e ] The RADA might include in the Rx frame the MIC and CRC bytes. These bytes should be removed for non monitor interfaces and should not be passed to mac80211. Fix the Rx processing to remove the extra bytes on non monitor cases. Signed-off-by: Ilan Peer Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211219121514.098be12c801e.I1d8173= 3d8a75b84c3b20eb6e0d14ab3405ca6a86@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wi= reless/intel/iwlwifi/mvm/rxmq.c index a6e2a30eb3109..52c6edc621ced 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c @@ -177,12 +177,39 @@ static int iwl_mvm_create_skb(struct iwl_mvm *mvm, st= ruct sk_buff *skb, struct iwl_rx_mpdu_desc *desc =3D (void *)pkt->data; unsigned int headlen, fraglen, pad_len =3D 0; unsigned int hdrlen =3D ieee80211_hdrlen(hdr->frame_control); + u8 mic_crc_len =3D u8_get_bits(desc->mac_flags1, + IWL_RX_MPDU_MFLG1_MIC_CRC_LEN_MASK) << 1; =20 if (desc->mac_flags2 & IWL_RX_MPDU_MFLG2_PAD) { len -=3D 2; pad_len =3D 2; } =20 + /* + * For non monitor interface strip the bytes the RADA might not have + * removed. As monitor interface cannot exist with other interfaces + * this removal is safe. + */ + if (mic_crc_len && !ieee80211_hw_check(mvm->hw, RX_INCLUDES_FCS)) { + u32 pkt_flags =3D le32_to_cpu(pkt->len_n_flags); + + /* + * If RADA was not enabled then decryption was not performed so + * the MIC cannot be removed. + */ + if (!(pkt_flags & FH_RSCSR_RADA_EN)) { + if (WARN_ON(crypt_len > mic_crc_len)) + return -EINVAL; + + mic_crc_len -=3D crypt_len; + } + + if (WARN_ON(mic_crc_len > len)) + return -EINVAL; + + len -=3D mic_crc_len; + } + /* If frame is small enough to fit in skb->head, pull it completely. * If not, only pull ieee80211_hdr (including crypto if present, and * an additional 8 bytes for SNAP/ethertype, see below) so that --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06530C433FE for ; Mon, 24 Jan 2022 19:41:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353535AbiAXTlC (ORCPT ); Mon, 24 Jan 2022 14:41:02 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57382 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353574AbiAXTfA (ORCPT ); Mon, 24 Jan 2022 14:35:00 -0500 Received: from smtp.kernel.org (relay.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 8AF4BB81232; Mon, 24 Jan 2022 19:34:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99D6EC340E5; Mon, 24 Jan 2022 19:34:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052898; bh=YRtFLS33UvhcMXoutG1kpLoHx0Za8NOY2p3DeITTCGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UjRiddPw47MPHe99nV1Cz5xKTI7XU2FEAWBVHbQMo/1kwbtl1hV8YKAZ/RpNKel7q Vv/BpWpz9mOQ5IaZGYKrDO0B4aewG8qf950SZ86KfBkxal745DnUd/y+sOqYSEoLcq gRGfuqnrHvxwQg4tBOZCqcYlfi+eGxMKc0bug1MQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Jeff Dike , Richard Weinberger , Anton Ivanov , linux-um@lists.infradead.org, Sasha Levin Subject: [PATCH 5.4 202/320] um: registers: Rename function names to avoid conflicts and build problems Date: Mon, 24 Jan 2022 19:43:06 +0100 Message-Id: <20220124184000.509506732@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Randy Dunlap [ Upstream commit 077b7320942b64b0da182aefd83c374462a65535 ] The function names init_registers() and restore_registers() are used in several net/ethernet/ and gpu/drm/ drivers for other purposes (not calls to UML functions), so rename them. This fixes multiple build errors. Signed-off-by: Randy Dunlap Cc: Jeff Dike Cc: Richard Weinberger Cc: Anton Ivanov Cc: linux-um@lists.infradead.org Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/um/include/shared/registers.h | 4 ++-- arch/um/os-Linux/registers.c | 4 ++-- arch/um/os-Linux/start_up.c | 2 +- arch/x86/um/syscalls_64.c | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/um/include/shared/registers.h b/arch/um/include/shared/re= gisters.h index 0c50fa6e8a55b..fbb709a222839 100644 --- a/arch/um/include/shared/registers.h +++ b/arch/um/include/shared/registers.h @@ -16,8 +16,8 @@ extern int restore_fp_registers(int pid, unsigned long *f= p_regs); extern int save_fpx_registers(int pid, unsigned long *fp_regs); extern int restore_fpx_registers(int pid, unsigned long *fp_regs); extern int save_registers(int pid, struct uml_pt_regs *regs); -extern int restore_registers(int pid, struct uml_pt_regs *regs); -extern int init_registers(int pid); +extern int restore_pid_registers(int pid, struct uml_pt_regs *regs); +extern int init_pid_registers(int pid); extern void get_safe_registers(unsigned long *regs, unsigned long *fp_regs= ); extern unsigned long get_thread_reg(int reg, jmp_buf *buf); extern int get_fp_registers(int pid, unsigned long *regs); diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c index 2d9270508e156..b123955be7acc 100644 --- a/arch/um/os-Linux/registers.c +++ b/arch/um/os-Linux/registers.c @@ -21,7 +21,7 @@ int save_registers(int pid, struct uml_pt_regs *regs) return 0; } =20 -int restore_registers(int pid, struct uml_pt_regs *regs) +int restore_pid_registers(int pid, struct uml_pt_regs *regs) { int err; =20 @@ -36,7 +36,7 @@ int restore_registers(int pid, struct uml_pt_regs *regs) static unsigned long exec_regs[MAX_REG_NR]; static unsigned long exec_fp_regs[FP_SIZE]; =20 -int init_registers(int pid) +int init_pid_registers(int pid) { int err; =20 diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c index f79dc338279e6..b28373a2b8d2d 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c @@ -336,7 +336,7 @@ void __init os_early_checks(void) check_tmpexec(); =20 pid =3D start_ptraced_child(); - if (init_registers(pid)) + if (init_pid_registers(pid)) fatal("Failed to initialize default registers"); stop_ptraced_child(pid, 1, 1); } diff --git a/arch/x86/um/syscalls_64.c b/arch/x86/um/syscalls_64.c index 58f51667e2e4b..8249685b40960 100644 --- a/arch/x86/um/syscalls_64.c +++ b/arch/x86/um/syscalls_64.c @@ -11,6 +11,7 @@ #include #include /* XXX This should get the constants from libc */ #include +#include =20 long arch_prctl(struct task_struct *task, int option, unsigned long __user *arg2) @@ -35,7 +36,7 @@ long arch_prctl(struct task_struct *task, int option, switch (option) { case ARCH_SET_FS: case ARCH_SET_GS: - ret =3D restore_registers(pid, ¤t->thread.regs.regs); + ret =3D restore_pid_registers(pid, ¤t->thread.regs.regs); if (ret) return ret; break; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3927CC433F5 for ; Mon, 24 Jan 2022 19:48:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355909AbiAXTox (ORCPT ); Mon, 24 Jan 2022 14:44:53 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33890 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353906AbiAXTfd (ORCPT ); Mon, 24 Jan 2022 14:35:33 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ED8C3614B8; Mon, 24 Jan 2022 19:35:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC55DC340E5; Mon, 24 Jan 2022 19:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052932; bh=9RyE6ZLi77tUv4uCLRdOWWqq4WpjHFSm/tVZXOPXU14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gfoWxPA4qGCPDv3SG5RlfrDbEbKT76GEyTOtRS8D0YjDjTB1dYOp8mDLnpvF4PoVc yoDqmvQRAWTxbwEDwBIs6MCvb//IdkIj2QhLcbxECRcWBri+ZVD7YbzVCfODMEgpE9 jqsxwOy69Aq0KqW4uHtNYIGuy8NaqApLxLiomer8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kyeong Yoo , Richard Weinberger , Sasha Levin Subject: [PATCH 5.4 203/320] jffs2: GC deadlock reading a page that is used in jffs2_write_begin() Date: Mon, 24 Jan 2022 19:43:07 +0100 Message-Id: <20220124184000.541931930@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kyeong Yoo [ Upstream commit aa39cc675799bc92da153af9a13d6f969c348e82 ] GC task can deadlock in read_cache_page() because it may attempt to release a page that is actually allocated by another task in jffs2_write_begin(). The reason is that in jffs2_write_begin() there is a small window a cache page is allocated for use but not set Uptodate yet. This ends up with a deadlock between two tasks: 1) A task (e.g. file copy) - jffs2_write_begin() locks a cache page - jffs2_write_end() tries to lock "alloc_sem" from jffs2_reserve_space() <-- STUCK 2) GC task (jffs2_gcd_mtd3) - jffs2_garbage_collect_pass() locks "alloc_sem" - try to lock the same cache page in read_cache_page() <-- STUCK So to avoid this deadlock, hold "alloc_sem" in jffs2_write_begin() while reading data in a cache page. Signed-off-by: Kyeong Yoo Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/jffs2/file.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index f8fb89b10227c..34880a4c21732 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c @@ -135,20 +135,15 @@ static int jffs2_write_begin(struct file *filp, struc= t address_space *mapping, struct page *pg; struct inode *inode =3D mapping->host; struct jffs2_inode_info *f =3D JFFS2_INODE_INFO(inode); + struct jffs2_sb_info *c =3D JFFS2_SB_INFO(inode->i_sb); pgoff_t index =3D pos >> PAGE_SHIFT; uint32_t pageofs =3D index << PAGE_SHIFT; int ret =3D 0; =20 - pg =3D grab_cache_page_write_begin(mapping, index, flags); - if (!pg) - return -ENOMEM; - *pagep =3D pg; - jffs2_dbg(1, "%s()\n", __func__); =20 if (pageofs > inode->i_size) { /* Make new hole frag from old EOF to new page */ - struct jffs2_sb_info *c =3D JFFS2_SB_INFO(inode->i_sb); struct jffs2_raw_inode ri; struct jffs2_full_dnode *fn; uint32_t alloc_len; @@ -159,7 +154,7 @@ static int jffs2_write_begin(struct file *filp, struct = address_space *mapping, ret =3D jffs2_reserve_space(c, sizeof(ri), &alloc_len, ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); if (ret) - goto out_page; + goto out_err; =20 mutex_lock(&f->sem); memset(&ri, 0, sizeof(ri)); @@ -189,7 +184,7 @@ static int jffs2_write_begin(struct file *filp, struct = address_space *mapping, ret =3D PTR_ERR(fn); jffs2_complete_reservation(c); mutex_unlock(&f->sem); - goto out_page; + goto out_err; } ret =3D jffs2_add_full_dnode_to_inode(c, f, fn); if (f->metadata) { @@ -204,13 +199,26 @@ static int jffs2_write_begin(struct file *filp, struc= t address_space *mapping, jffs2_free_full_dnode(fn); jffs2_complete_reservation(c); mutex_unlock(&f->sem); - goto out_page; + goto out_err; } jffs2_complete_reservation(c); inode->i_size =3D pageofs; mutex_unlock(&f->sem); } =20 + /* + * While getting a page and reading data in, lock c->alloc_sem until + * the page is Uptodate. Otherwise GC task may attempt to read the same + * page in read_cache_page(), which causes a deadlock. + */ + mutex_lock(&c->alloc_sem); + pg =3D grab_cache_page_write_begin(mapping, index, flags); + if (!pg) { + ret =3D -ENOMEM; + goto release_sem; + } + *pagep =3D pg; + /* * Read in the page if it wasn't already present. Cannot optimize away * the whole page write case until jffs2_write_end can handle the @@ -220,15 +228,17 @@ static int jffs2_write_begin(struct file *filp, struc= t address_space *mapping, mutex_lock(&f->sem); ret =3D jffs2_do_readpage_nolock(inode, pg); mutex_unlock(&f->sem); - if (ret) - goto out_page; + if (ret) { + unlock_page(pg); + put_page(pg); + goto release_sem; + } } jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags); - return ret; =20 -out_page: - unlock_page(pg); - put_page(pg); +release_sem: + mutex_unlock(&c->alloc_sem); +out_err: return ret; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15DD6C433EF for ; Mon, 24 Jan 2022 19:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355966AbiAXTpA (ORCPT ); Mon, 24 Jan 2022 14:45:00 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58070 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354158AbiAXTgI (ORCPT ); Mon, 24 Jan 2022 14:36:08 -0500 Received: from smtp.kernel.org (relay.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 C0C12B810AF; Mon, 24 Jan 2022 19:36:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9AD4C340E5; Mon, 24 Jan 2022 19:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052965; bh=17uZWNwcuXXwaurrShXeLBZ0t+Jwvjam9BBI+xKfecg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QsCObvFyeFtQSKB2P5j/QDzrQ/02w3AEol8NWkA8I7OsyHK5OVMAi/cPFWxzg8+1q FlYyp+zpZ4+Jop5nyfK70XRunHYXwyqeLvdW7pLX//Rh29FPha0e1L4pGQoS+a704R U3q/b2ZYB/x9KhMpEmqt0Qr6aw3Qk9HP4grLMVaI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Langsdorf , Bob Moore , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.4 204/320] ACPICA: actypes.h: Expand the ACPI_ACCESS_ definitions Date: Mon, 24 Jan 2022 19:43:08 +0100 Message-Id: <20220124184000.573255237@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Langsdorf [ Upstream commit f81bdeaf816142e0729eea0cc84c395ec9673151 ] ACPICA commit bc02c76d518135531483dfc276ed28b7ee632ce1 The current ACPI_ACCESS_*_WIDTH defines do not provide a way to test that size is small enough to not cause an overflow when applied to a 32-bit integer. Rather than adding more magic numbers, add ACPI_ACCESS_*_SHIFT, ACPI_ACCESS_*_MAX, and ACPI_ACCESS_*_DEFAULT #defines and redefine ACPI_ACCESS_*_WIDTH in terms of the new #defines. This was inititally reported on Linux where a size of 102 in ACPI_ACCESS_BIT_WIDTH caused an overflow error in the SPCR initialization code. Link: https://github.com/acpica/acpica/commit/bc02c76d Signed-off-by: Mark Langsdorf Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- include/acpi/actypes.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 9373662cdb44f..ff5fecff51167 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -536,8 +536,14 @@ typedef u64 acpi_integer; * Can be used with access_width of struct acpi_generic_address and access= _size of * struct acpi_resource_generic_register. */ -#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + 2)) -#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) - 1)) +#define ACPI_ACCESS_BIT_SHIFT 2 +#define ACPI_ACCESS_BYTE_SHIFT -1 +#define ACPI_ACCESS_BIT_MAX (31 - ACPI_ACCESS_BIT_SHIFT) +#define ACPI_ACCESS_BYTE_MAX (31 - ACPI_ACCESS_BYTE_SHIFT) +#define ACPI_ACCESS_BIT_DEFAULT (8 - ACPI_ACCESS_BIT_SHIFT) +#define ACPI_ACCESS_BYTE_DEFAULT (8 - ACPI_ACCESS_BYTE_SHIFT) +#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BIT_SHIFT)) +#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BYTE_SHIF= T)) =20 /*************************************************************************= ****** * --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C1F0C433EF for ; Mon, 24 Jan 2022 20:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385887AbiAXUen (ORCPT ); Mon, 24 Jan 2022 15:34:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355444AbiAXUNl (ORCPT ); Mon, 24 Jan 2022 15:13:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAB41C06177B; Mon, 24 Jan 2022 11:36:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 66EA5B81240; Mon, 24 Jan 2022 19:36:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9101EC340E5; Mon, 24 Jan 2022 19:36:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052987; bh=DwA8F4zgidWixlK9aMmqBvtZBvHnXYpCKUEafJu47RM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZTvOOshk5hQ6UsvXBv0IMxJ8H/JwMw9S5qUue72dp292lcluK5Y4Oe6mKcTwBeXaD YtMyWJ3xnFfVYjkUDhMLNQjU2T2dBPuG6c4BXCIEj7LpftfD21BY2W1cpZnibwIcM8 rOSexMgxfDcduUsf4G3L+XoVqoMK11DfYpZuDPvY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Asselstine , "Rafael J. Wysocki" , Bob Moore , Sasha Levin Subject: [PATCH 5.4 205/320] ACPICA: Utilities: Avoid deleting the same object twice in a row Date: Mon, 24 Jan 2022 19:43:09 +0100 Message-Id: <20220124184000.602696831@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki [ Upstream commit 1cdfe9e346b4c5509ffe19ccde880fd259d9f7a3 ] ACPICA commit c11af67d8f7e3d381068ce7771322f2b5324d687 If original_count is 0 in acpi_ut_update_ref_count (), acpi_ut_delete_internal_obj () is invoked for the target object, which is incorrect, because that object has been deleted once already and the memory allocated to store it may have been reclaimed and allocated for a different purpose by the host OS. Moreover, a confusing debug message following the "Reference Count is already zero, cannot decrement" warning is printed in that case. To fix this issue, make acpi_ut_update_ref_count () return after finding that original_count is 0 and printing the above warning. Link: https://github.com/acpica/acpica/commit/c11af67d Link: https://github.com/acpica/acpica/pull/652 Reported-by: Mark Asselstine Signed-off-by: Rafael J. Wysocki Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/acpi/acpica/utdelete.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c index 72d2c0b656339..cb1750e7a6281 100644 --- a/drivers/acpi/acpica/utdelete.c +++ b/drivers/acpi/acpica/utdelete.c @@ -422,6 +422,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *obj= ect, u32 action) ACPI_WARNING((AE_INFO, "Obj %p, Reference Count is already zero, cannot decrement\n", object)); + return; } =20 ACPI_DEBUG_PRINT_RAW((ACPI_DB_ALLOCATIONS, --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21FC9C433F5 for ; Mon, 24 Jan 2022 19:48:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239165AbiAXTrt (ORCPT ); Mon, 24 Jan 2022 14:47:49 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34360 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354331AbiAXTgb (ORCPT ); Mon, 24 Jan 2022 14:36:31 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BC9A260909; Mon, 24 Jan 2022 19:36:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4013C340E5; Mon, 24 Jan 2022 19:36:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052990; bh=HouZgAats866R4r1zSh6Cjti9p5j8T6zOH2vHVEIsVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2ax1hrUYe5XNcuQ9TfXg/3wJMd4AQ1byLQt8D8yvq8hEDW9j2BnDMQyoQv1mXOAWu uDX8V/IDEhN1tpJMHpqUfAcixe/3jjJbAIcUZP95PX4Rhx6NRl7bu+8Gq/YXNWTC/J EWib6mFMuaaEYa1fDQ9KAclf7C73vZLqmMv0cD8Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lenny Szubowicz , "Rafael J. Wysocki" , Bob Moore , Sasha Levin Subject: [PATCH 5.4 206/320] ACPICA: Executer: Fix the REFCLASS_REFOF case in acpi_ex_opcode_1A_0T_1R() Date: Mon, 24 Jan 2022 19:43:10 +0100 Message-Id: <20220124184000.641096927@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki [ Upstream commit 24ea5f90ec9548044a6209685c5010edd66ffe8f ] ACPICA commit d984f12041392fa4156b52e2f7e5c5e7bc38ad9e If Operand[0] is a reference of the ACPI_REFCLASS_REFOF class, acpi_ex_opcode_1A_0T_1R () calls acpi_ns_get_attached_object () to obtain return_desc which may require additional resolution with the help of acpi_ex_read_data_from_field (). If the latter fails, the reference counter of the original return_desc is decremented which is incorrect, because acpi_ns_get_attached_object () does not increment the reference counter of the object returned by it. This issue may lead to premature deletion of the attached object while it is still attached and a use-after-free and crash in the host OS. For example, this may happen when on evaluation of ref_of() a local region field where there is no registered handler for the given Operation Region. Fix it by making acpi_ex_opcode_1A_0T_1R () return Status right away after a acpi_ex_read_data_from_field () failure. Link: https://github.com/acpica/acpica/commit/d984f120 Link: https://github.com/acpica/acpica/pull/685 Reported-by: Lenny Szubowicz Signed-off-by: Rafael J. Wysocki Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/acpi/acpica/exoparg1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c index 06e35ea098234..6d84618ba3871 100644 --- a/drivers/acpi/acpica/exoparg1.c +++ b/drivers/acpi/acpica/exoparg1.c @@ -1007,7 +1007,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_= state *walk_state) (walk_state, return_desc, &temp_desc); if (ACPI_FAILURE(status)) { - goto cleanup; + return_ACPI_STATUS + (status); } =20 return_desc =3D temp_desc; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DED9DC433F5 for ; Mon, 24 Jan 2022 20:02:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344715AbiAXUCO (ORCPT ); Mon, 24 Jan 2022 15:02:14 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34374 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354368AbiAXTge (ORCPT ); Mon, 24 Jan 2022 14:36:34 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AD0D960917; Mon, 24 Jan 2022 19:36:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92376C340E5; Mon, 24 Jan 2022 19:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052993; bh=cnN5xt6O7qL5pb9YX1Cpeo6wCDkG1nZj0Zoq4vNviYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QfvE2lFWj4zW5TnyK1EiJYxH89US52rTRoCPs+D1Uu3wkC/0/fzOnG2wMRQqnuDcl TnYy4o069AF2x5nRnrubgo97SG4YuAI/4WygmjFdoedh3JmKMjXGPTv1GcY9YKSv9p gfizCogelMShngAawKvHsrs8cpJ4JgMOcCHlqVHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sudeep Holla , Bob Moore , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.4 207/320] ACPICA: Fix wrong interpretation of PCC address Date: Mon, 24 Jan 2022 19:43:11 +0100 Message-Id: <20220124184000.674578975@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sudeep Holla [ Upstream commit 9a3b8655db1ada31c82189ae13f40eb25da48c35 ] ACPICA commit 41be6afacfdaec2dba3a5ed368736babc2a7aa5c With the PCC Opregion in the firmware and we are hitting below kernel crash: -->8 Unable to handle kernel NULL pointer dereference at virtual address 0000000= 000000010 Workqueue: pm pm_runtime_work pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) pc : __memcpy+0x54/0x260 lr : acpi_ex_write_data_to_field+0xb8/0x194 Call trace: __memcpy+0x54/0x260 acpi_ex_store_object_to_node+0xa4/0x1d4 acpi_ex_store+0x44/0x164 acpi_ex_opcode_1A_1T_1R+0x25c/0x508 acpi_ds_exec_end_op+0x1b4/0x44c acpi_ps_parse_loop+0x3a8/0x614 acpi_ps_parse_aml+0x90/0x2f4 acpi_ps_execute_method+0x11c/0x19c acpi_ns_evaluate+0x1ec/0x2b0 acpi_evaluate_object+0x170/0x2b0 acpi_device_set_power+0x118/0x310 acpi_dev_suspend+0xd4/0x180 acpi_subsys_runtime_suspend+0x28/0x38 __rpm_callback+0x74/0x328 rpm_suspend+0x2d8/0x624 pm_runtime_work+0xa4/0xb8 process_one_work+0x194/0x25c worker_thread+0x260/0x49c kthread+0x14c/0x30c ret_from_fork+0x10/0x20 Code: f9000006 f81f80a7 d65f03c0 361000c2 (b9400026) ---[ end trace 24d8a032fa77b68a ]--- The reason for the crash is that the PCC channel index passed via region.ad= dress in acpi_ex_store_object_to_node is interpreted as the channel subtype incorrectly. Assuming the PCC op_region support is not used by any other type, let us remove the subtype check as the AML has no access to the subtype informatio= n. Once we remove it, the kernel crash disappears and correctly complains about missing PCC Opregion handler. ACPI Error: No handler for Region [PFRM] ((____ptrval____)) [PCC] (20210730= /evregion-130) ACPI Error: Region PCC (ID=3D10) has no handler (20210730/exfldio-261) ACPI Error: Aborting method \_SB.ETH0._PS3 due to previous error (AE_NOT_EX= IST) (20210730/psparse-531) Link: https://github.com/acpica/acpica/commit/41be6afa Signed-off-by: Sudeep Holla Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/acpi/acpica/exfield.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index d3d2dbfba680c..cd3debefe990d 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c @@ -320,12 +320,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object = *source_desc, obj_desc->field.base_byte_offset, source_desc->buffer.pointer, data_length); =20 - if ((obj_desc->field.region_obj->region.address =3D=3D - PCC_MASTER_SUBSPACE - && MASTER_SUBSPACE_COMMAND(obj_desc->field. - base_byte_offset)) - || GENERIC_SUBSPACE_COMMAND(obj_desc->field. - base_byte_offset)) { + if (MASTER_SUBSPACE_COMMAND(obj_desc->field.base_byte_offset)) { =20 /* Perform the write */ =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4878AC47084 for ; Mon, 24 Jan 2022 19:57:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351723AbiAXT4s (ORCPT ); Mon, 24 Jan 2022 14:56:48 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33376 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354433AbiAXTgg (ORCPT ); Mon, 24 Jan 2022 14:36:36 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 86D6361488; Mon, 24 Jan 2022 19:36:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64D6AC340E5; Mon, 24 Jan 2022 19:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052996; bh=Rg17Dj64ENb9qLkvReuWQv612SCW6VQtuChYHLBUX6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UuSPG/zoP6sPaHDZYt90bUzPR5tBKo/SIplXW3pQh9ifLKdoDzKD8a4jl8MjH3xKA Za1sKrDZ1eUeQ/ystSnNyCCtdW5g1TSo57X2ggsFNgo1oNXLfuHpEIg2qAaw0YztMm Mbp3Jj1B2QVJuY1un1QAM0MRttkk7PFuiSAf4pyI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Kirill A. Shutemov" , "Rafael J. Wysocki" , Bob Moore , Sasha Levin Subject: [PATCH 5.4 208/320] ACPICA: Hardware: Do not flush CPU cache when entering S4 and S5 Date: Mon, 24 Jan 2022 19:43:12 +0100 Message-Id: <20220124184000.704367846@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kirill A. Shutemov [ Upstream commit 1d4e0b3abb168b2ee1eca99c527cffa1b80b6161 ] ACPICA commit 3dd7e1f3996456ef81bfe14cba29860e8d42949e According to ACPI 6.4, Section 16.2, the CPU cache flushing is required on entering to S1, S2, and S3, but the ACPICA code flushes the CPU cache regardless of the sleep state. Blind cache flush on entering S5 causes problems for TDX. Flushing happens with WBINVD that is not supported in the TDX environment. TDX only supports S5 and adjusting ACPICA code to conform to the spec more strictly fixes the issue. Link: https://github.com/acpica/acpica/commit/3dd7e1f3 Signed-off-by: Kirill A. Shutemov [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/acpi/acpica/hwesleep.c | 4 +++- drivers/acpi/acpica/hwsleep.c | 4 +++- drivers/acpi/acpica/hwxfsleep.c | 2 -- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c index aa502ae3b6b31..de0a59878e52d 100644 --- a/drivers/acpi/acpica/hwesleep.c +++ b/drivers/acpi/acpica/hwesleep.c @@ -104,7 +104,9 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state) =20 /* Flush caches, as per ACPI specification */ =20 - ACPI_FLUSH_CPU_CACHE(); + if (sleep_state < ACPI_STATE_S4) { + ACPI_FLUSH_CPU_CACHE(); + } =20 status =3D acpi_os_enter_sleep(sleep_state, sleep_control, 0); if (status =3D=3D AE_CTRL_TERMINATE) { diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index 5f7d63badbe9d..321aaad97e2f7 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c @@ -110,7 +110,9 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state) =20 /* Flush caches, as per ACPI specification */ =20 - ACPI_FLUSH_CPU_CACHE(); + if (sleep_state < ACPI_STATE_S4) { + ACPI_FLUSH_CPU_CACHE(); + } =20 status =3D acpi_os_enter_sleep(sleep_state, pm1a_control, pm1b_control); if (status =3D=3D AE_CTRL_TERMINATE) { diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfslee= p.c index 79731efbe8fe2..4e3398819718d 100644 --- a/drivers/acpi/acpica/hwxfsleep.c +++ b/drivers/acpi/acpica/hwxfsleep.c @@ -162,8 +162,6 @@ acpi_status acpi_enter_sleep_state_s4bios(void) return_ACPI_STATUS(status); } =20 - ACPI_FLUSH_CPU_CACHE(); - status =3D acpi_hw_write_port(acpi_gbl_FADT.smi_command, (u32)acpi_gbl_FADT.s4_bios_request, 8); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6FCAC433EF for ; Mon, 24 Jan 2022 20:34:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385717AbiAXUeI (ORCPT ); Mon, 24 Jan 2022 15:34:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355446AbiAXUNl (ORCPT ); Mon, 24 Jan 2022 15:13:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53F54C06177C; Mon, 24 Jan 2022 11:36:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1D0ABB81247; Mon, 24 Jan 2022 19:36:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 533F3C340E5; Mon, 24 Jan 2022 19:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052998; bh=f6NAM56Og1Yrc6Od3Am5rH5imViISDUzVvr7k4kzIP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KBCabPR4cWINd44h1jRLTDQyVcgo6EOGG/r+m1vZgF8MXMAfffGL/JzYNn1PwqcUB DW1Fed3jHfiWxISQf1UpKBZdr3O6dPZD9rVTAdUMPSBwuU6/KSnKdgkuucxNcw2SM1 zZXtQKjSddxiolWqAR4cGYd34SEnf++KBNkvqGSM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zongmin Zhou , Alex Deucher , Sasha Levin Subject: [PATCH 5.4 209/320] drm/amdgpu: fixup bad vram size on gmc v8 Date: Mon, 24 Jan 2022 19:43:13 +0100 Message-Id: <20220124184000.737133591@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zongmin Zhou [ Upstream commit 11544d77e3974924c5a9c8a8320b996a3e9b2f8b ] Some boards(like RX550) seem to have garbage in the upper 16 bits of the vram size register. Check for this and clamp the size properly. Fixes boards reporting bogus amounts of vram. after add this patch,the maximum GPU VRAM size is 64GB, otherwise only 64GB vram size will be used. Signed-off-by: Zongmin Zhou Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/am= dgpu/gmc_v8_0.c index ea764dd9245db..2975331a7b867 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c @@ -524,10 +524,10 @@ static void gmc_v8_0_mc_program(struct amdgpu_device = *adev) static int gmc_v8_0_mc_init(struct amdgpu_device *adev) { int r; + u32 tmp; =20 adev->gmc.vram_width =3D amdgpu_atombios_get_vram_width(adev); if (!adev->gmc.vram_width) { - u32 tmp; int chansize, numchan; =20 /* Get VRAM informations */ @@ -571,8 +571,15 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) adev->gmc.vram_width =3D numchan * chansize; } /* size in MB on si */ - adev->gmc.mc_vram_size =3D RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; - adev->gmc.real_vram_size =3D RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; + tmp =3D RREG32(mmCONFIG_MEMSIZE); + /* some boards may have garbage in the upper 16 bits */ + if (tmp & 0xffff0000) { + DRM_INFO("Probable bad vram size: 0x%08x\n", tmp); + if (tmp & 0xffff) + tmp &=3D 0xffff; + } + adev->gmc.mc_vram_size =3D tmp * 1024ULL * 1024ULL; + adev->gmc.real_vram_size =3D adev->gmc.mc_vram_size; =20 if (!(adev->flags & AMD_IS_APU)) { r =3D amdgpu_device_resize_fb_bar(adev); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E54FFC4167D for ; Mon, 24 Jan 2022 20:38:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385952AbiAXUet (ORCPT ); Mon, 24 Jan 2022 15:34:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355449AbiAXUNl (ORCPT ); Mon, 24 Jan 2022 15:13:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45665C06177D; Mon, 24 Jan 2022 11:36:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0C53AB80FA1; Mon, 24 Jan 2022 19:36:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3848AC340E5; Mon, 24 Jan 2022 19:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053001; bh=pAudh+TsOSpSnD0nYfPANG+aRUPcTOqHL2dBB7d7S30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0+Ca3MzlY+4e4erCPR5HI8bgVqtzrzIxCZwHR5tfN+NaWDIwKq/DmB4xFnzHBKiRi 8+E4zC69pxwT0RqQMF8zv2ABLwY8yrdX/LBUKSbSKsF8stoYQDPyIbmJoBLi/9wmbk cHWRSMDTgYvHDkIjG5SlpmqNt0sbf8AhX1RUwk7U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Hans de Goede , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.4 210/320] ACPI: battery: Add the ThinkPad "Not Charging" quirk Date: Mon, 24 Jan 2022 19:43:14 +0100 Message-Id: <20220124184000.766334316@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Wei=C3=9Fschuh [ Upstream commit e96c1197aca628f7d2480a1cc3214912b40b3414 ] The EC/ACPI firmware on Lenovo ThinkPads used to report a status of "Unknown" when the battery is between the charge start and charge stop thresholds. On Windows, it reports "Not Charging" so the quirk has been added to also report correctly. Now the "status" attribute returns "Not Charging" when the battery on ThinkPads is not physicaly charging. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/acpi/battery.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 6e96ed68b3379..4e0aea5f008e3 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -65,6 +65,7 @@ static int battery_bix_broken_package; static int battery_notification_delay_ms; static int battery_ac_is_broken; static int battery_check_pmic =3D 1; +static int battery_quirk_notcharging; static unsigned int cache_time =3D 1000; module_param(cache_time, uint, 0644); MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); @@ -233,6 +234,8 @@ static int acpi_battery_get_property(struct power_suppl= y *psy, val->intval =3D POWER_SUPPLY_STATUS_CHARGING; else if (acpi_battery_is_charged(battery)) val->intval =3D POWER_SUPPLY_STATUS_FULL; + else if (battery_quirk_notcharging) + val->intval =3D POWER_SUPPLY_STATUS_NOT_CHARGING; else val->intval =3D POWER_SUPPLY_STATUS_UNKNOWN; break; @@ -1337,6 +1340,12 @@ battery_do_not_check_pmic_quirk(const struct dmi_sys= tem_id *d) return 0; } =20 +static int __init battery_quirk_not_charging(const struct dmi_system_id *d) +{ + battery_quirk_notcharging =3D 1; + return 0; +} + static const struct dmi_system_id bat_dmi_table[] __initconst =3D { { /* NEC LZ750/LS */ @@ -1381,6 +1390,19 @@ static const struct dmi_system_id bat_dmi_table[] __= initconst =3D { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"), }, }, + { + /* + * On Lenovo ThinkPads the BIOS specification defines + * a state when the bits for charging and discharging + * are both set to 0. That state is "Not Charging". + */ + .callback =3D battery_quirk_not_charging, + .ident =3D "Lenovo ThinkPad", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), + }, + }, {}, }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11C59C433FE for ; Mon, 24 Jan 2022 20:32:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356774AbiAXUcj (ORCPT ); Mon, 24 Jan 2022 15:32:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355394AbiAXUNh (ORCPT ); Mon, 24 Jan 2022 15:13:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA58DC061759; Mon, 24 Jan 2022 11:35:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A2104B8122C; Mon, 24 Jan 2022 19:35:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF9FDC340E5; Mon, 24 Jan 2022 19:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052901; bh=VE7s1jTQ4vFtA3r5D31OJGay35QqQYg1y+cWP5Lbudg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qexgTIQgD1iCAaYVPn6B9VOMb6VQcmkI0n916dVugq02FK0zK4e60RJE9fzTDcqhN il4fOYCSs2UwdAS8SHmIHQbR0/+lTqYSmialsbtOs3PpzLfe7M4JJB2fuF3o0jOSPl 3BzcTUxCLLGuhuCKvAupvTYCNeXJ37/s1uG1nRsI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , David Sterba , Sasha Levin Subject: [PATCH 5.4 211/320] btrfs: remove BUG_ON() in find_parent_nodes() Date: Mon, 24 Jan 2022 19:43:15 +0100 Message-Id: <20220124184000.799097611@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Josef Bacik [ Upstream commit fcba0120edf88328524a4878d1d6f4ad39f2ec81 ] We search for an extent entry with .offset =3D -1, which shouldn't be a thing, but corruption happens. Add an ASSERT() for the developers, return -EUCLEAN for mortals. Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/btrfs/backref.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 7f644a58db511..9044e7282d0b2 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1208,7 +1208,12 @@ again: ret =3D btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 0); if (ret < 0) goto out; - BUG_ON(ret =3D=3D 0); + if (ret =3D=3D 0) { + /* This shouldn't happen, indicates a bug or fs corruption. */ + ASSERT(ret !=3D 0); + ret =3D -EUCLEAN; + goto out; + } =20 #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS if (trans && likely(trans->type !=3D __TRANS_DUMMY) && --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9B0CC433F5 for ; Mon, 24 Jan 2022 20:32:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356647AbiAXUcU (ORCPT ); Mon, 24 Jan 2022 15:32:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355389AbiAXUNh (ORCPT ); Mon, 24 Jan 2022 15:13:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F26ABC06175B; Mon, 24 Jan 2022 11:35:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9B1ABB8122C; Mon, 24 Jan 2022 19:35:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4694C340E5; Mon, 24 Jan 2022 19:35:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052904; bh=YMTmdgspCZHdunm2O2C28dMwUyvgjGcIM5w9bO9muWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DpiRk5FcO17xLe1ezQXBLK3xGzLsukQMYIktdhhGYSbeGsm5ItZcRYcUnoTbj7LhE Lt89OWZ4yaIWhGUjuHlkBOEjoX+YOQVb3n6fvRGAbYeQQAKLIERgyPK4l3K7dCrxz5 FbRB8aECi0W83QIm8ZjyzLD9mELdFRSCbPC39r8s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , David Sterba , Sasha Levin Subject: [PATCH 5.4 212/320] btrfs: remove BUG_ON(!eie) in find_parent_nodes Date: Mon, 24 Jan 2022 19:43:16 +0100 Message-Id: <20220124184000.839504289@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Josef Bacik [ Upstream commit 9f05c09d6baef789726346397438cca4ec43c3ee ] If we're looking for leafs that point to a data extent we want to record the extent items that point at our bytenr. At this point we have the reference and we know for a fact that this leaf should have a reference to our bytenr. However if there's some sort of corruption we may not find any references to our leaf, and thus could end up with eie =3D=3D NULL. Replace this BUG_ON() with an ASSERT() and then return -EUCLEAN for the mortals. Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/btrfs/backref.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 9044e7282d0b2..c701a19fac533 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1361,10 +1361,18 @@ again: goto out; if (!ret && extent_item_pos) { /* - * we've recorded that parent, so we must extend - * its inode list here + * We've recorded that parent, so we must extend + * its inode list here. + * + * However if there was corruption we may not + * have found an eie, return an error in this + * case. */ - BUG_ON(!eie); + ASSERT(eie); + if (!eie) { + ret =3D -EUCLEAN; + goto out; + } while (eie->next) eie =3D eie->next; eie->next =3D ref->inode_list; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68CF8C433EF for ; Mon, 24 Jan 2022 19:41:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345947AbiAXTlY (ORCPT ); Mon, 24 Jan 2022 14:41:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57448 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353662AbiAXTfK (ORCPT ); Mon, 24 Jan 2022 14:35:10 -0500 Received: from smtp.kernel.org (relay.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 D8B81B811FC; Mon, 24 Jan 2022 19:35:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E698CC340E5; Mon, 24 Jan 2022 19:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052907; bh=kd999wTU3fAGULJUDrGvKzHoIuOBNt+L72OBcGIqlCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IOC9Kxhlo0nc8qtXGuGVx3nPfqpsJgYwXINNi1Feghn0kb+dB5xSiVhV42mO7dicX BI5AnwOlVUFfZ8G0lHf85UswEgllMEQkM/0dQYlSSDiG0m9EzhRQPPTX/6Uni7AIzB /74z6NAwqWO+4Vi0jzc6SdKpsCXcYwCo2rpPSmGE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Bizon , Florian Fainelli , Andrew Lunn , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 213/320] net: mdio: Demote probed message to debug print Date: Mon, 24 Jan 2022 19:43:17 +0100 Message-Id: <20220124184000.880534322@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Fainelli [ Upstream commit 7590fc6f80ac2cbf23e6b42b668bbeded070850b ] On systems with large numbers of MDIO bus/muxes the message indicating that a given MDIO bus has been successfully probed is repeated for as many buses we have, which can eat up substantial boot time for no reason, demote to a debug print. Reported-by: Maxime Bizon Signed-off-by: Florian Fainelli Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20220103194024.2620-1-f.fainelli@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/phy/mdio_bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index bec73f0640d03..b0a439248ff69 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -433,7 +433,7 @@ int __mdiobus_register(struct mii_bus *bus, struct modu= le *owner) mdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device); =20 bus->state =3D MDIOBUS_REGISTERED; - pr_info("%s: probed\n", bus->name); + dev_dbg(&bus->dev, "probed\n"); return 0; =20 error: --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDFAAC433EF for ; Mon, 24 Jan 2022 19:41:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349430AbiAXTle (ORCPT ); Mon, 24 Jan 2022 14:41:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33720 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353674AbiAXTfL (ORCPT ); Mon, 24 Jan 2022 14:35:11 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2EB2A61451; Mon, 24 Jan 2022 19:35:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 134D0C340E5; Mon, 24 Jan 2022 19:35:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052910; bh=ETlyL1vGfKy3FMGxoeXWr/m02+CklHI/tETSSripquc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wje3IwTijTbw5kzip8f6qjRbimZvSAe/eBBCldSX45eIsXX4FPAVmh7ebyag0ZaOm 5gKEocJeF2RevB6/VBxuWIDrrn810rnF3DCam7VG/dhndhxsZ+ZaRSOY9WL0Ts+nhL SbeJDyCgOzDIaXOvao0LwKJpudYvqSdcP7NpaOWU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Goldwyn Rodrigues , Ping-Ke Shih , Johannes Berg , Sasha Levin Subject: [PATCH 5.4 214/320] mac80211: allow non-standard VHT MCS-10/11 Date: Mon, 24 Jan 2022 19:43:18 +0100 Message-Id: <20220124184000.920141368@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ping-Ke Shih [ Upstream commit 04be6d337d37400ad5b3d5f27ca87645ee5a18a3 ] Some AP can possibly try non-standard VHT rate and mac80211 warns and drops packets, and leads low TCP throughput. Rate marked as a VHT rate but data is invalid: MCS: 10, NSS: 2 WARNING: CPU: 1 PID: 7817 at net/mac80211/rx.c:4856 ieee80211_rx_list+0= x223/0x2f0 [mac8021 Since commit c27aa56a72b8 ("cfg80211: add VHT rate entries for MCS-10 and M= CS-11") has added, mac80211 adds this support as well. After this patch, throughput is good and iw can get the bitrate: rx bitrate: 975.1 MBit/s VHT-MCS 10 80MHz short GI VHT-NSS 2 or rx bitrate: 1083.3 MBit/s VHT-MCS 11 80MHz short GI VHT-NSS 2 Buglink: https://bugzilla.suse.com/show_bug.cgi?id=3D1192891 Reported-by: Goldwyn Rodrigues Signed-off-by: Ping-Ke Shih Link: https://lore.kernel.org/r/20220103013623.17052-1-pkshih@realtek.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/mac80211/rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 282bf336b15a4..464029892478f 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -4693,7 +4693,7 @@ void ieee80211_rx_napi(struct ieee80211_hw *hw, struc= t ieee80211_sta *pubsta, goto drop; break; case RX_ENC_VHT: - if (WARN_ONCE(status->rate_idx > 9 || + if (WARN_ONCE(status->rate_idx > 11 || !status->nss || status->nss > 8, "Rate marked as a VHT rate but data is invalid: MCS: %d, NSS: %d= \n", --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04EE2C433F5 for ; Mon, 24 Jan 2022 19:41:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355519AbiAXTlk (ORCPT ); Mon, 24 Jan 2022 14:41:40 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57544 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353696AbiAXTfQ (ORCPT ); Mon, 24 Jan 2022 14:35:16 -0500 Received: from smtp.kernel.org (relay.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 ED109B81235; Mon, 24 Jan 2022 19:35:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BCE0C340E5; Mon, 24 Jan 2022 19:35:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052913; bh=Up/mfvhONYj+Dx9dzEmZmji4FSEdxlZp4ge0yxhkITo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z0xwKFf8tQV6HtT5bfq8ru6gKzz/sCe1hxM0QQ9q3sYLA7Ej37faRqxAmOmEV/knO WNrp6svatwDyYIhrhT7X3ctGdbN0PzX0BzUZSfDCnPnHX18fbf1ZUM2xWqKKLVq9QQ N2W2DjHZdg5yGx77zC1Op0kYYSgk9fCjaCpBwzgk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Thornber , Mike Snitzer , Sasha Levin Subject: [PATCH 5.4 215/320] dm btree: add a defensive bounds check to insert_at() Date: Mon, 24 Jan 2022 19:43:19 +0100 Message-Id: <20220124184000.957089456@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joe Thornber [ Upstream commit 85bca3c05b6cca31625437eedf2060e846c4bbad ] Corrupt metadata could trigger an out of bounds write. Signed-off-by: Joe Thornber Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/md/persistent-data/dm-btree.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-= data/dm-btree.c index 8aae0624a2971..6383afb88f319 100644 --- a/drivers/md/persistent-data/dm-btree.c +++ b/drivers/md/persistent-data/dm-btree.c @@ -83,14 +83,16 @@ void inc_children(struct dm_transaction_manager *tm, st= ruct btree_node *n, } =20 static int insert_at(size_t value_size, struct btree_node *node, unsigned = index, - uint64_t key, void *value) - __dm_written_to_disk(value) + uint64_t key, void *value) + __dm_written_to_disk(value) { uint32_t nr_entries =3D le32_to_cpu(node->header.nr_entries); + uint32_t max_entries =3D le32_to_cpu(node->header.max_entries); __le64 key_le =3D cpu_to_le64(key); =20 if (index > nr_entries || - index >=3D le32_to_cpu(node->header.max_entries)) { + index >=3D max_entries || + nr_entries >=3D max_entries) { DMERR("too many entries in btree node for insert"); __dm_unbless_for_disk(value); return -ENOMEM; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53CDCC433FE for ; Mon, 24 Jan 2022 19:44:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235776AbiAXToZ (ORCPT ); Mon, 24 Jan 2022 14:44:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57572 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353746AbiAXTfT (ORCPT ); Mon, 24 Jan 2022 14:35:19 -0500 Received: from smtp.kernel.org (relay.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 2BEE2B8121C; Mon, 24 Jan 2022 19:35:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57F64C340E5; Mon, 24 Jan 2022 19:35:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052916; bh=Bf2KpLKl42cxGt39Tk6pcrnnOXoTk3V933L/qa6WQzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n/Sp8akf+NfLGVPpgv69FDqtG7vE8pgdS/F+nIvntrWhpJr8DppL0Gkyrkbz+4Jpw aQSPjcSvygtaZvH1hIntEpTEnsAmSGlyPFOcECDEVGDV561Q1dqDY89wqGm7iOQ6rI IXAEBm+hUlEpL732upXRuTTaqEZQsO3Z3XwiSuuc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Thornber , Mike Snitzer , Sasha Levin Subject: [PATCH 5.4 216/320] dm space map common: add bounds check to sm_ll_lookup_bitmap() Date: Mon, 24 Jan 2022 19:43:20 +0100 Message-Id: <20220124184000.992054632@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joe Thornber [ Upstream commit cba23ac158db7f3cd48a923d6861bee2eb7a2978 ] Corrupted metadata could warrant returning error from sm_ll_lookup_bitmap(). Signed-off-by: Joe Thornber Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/md/persistent-data/dm-space-map-common.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/= persistent-data/dm-space-map-common.c index a213bf11738fb..85853ab629717 100644 --- a/drivers/md/persistent-data/dm-space-map-common.c +++ b/drivers/md/persistent-data/dm-space-map-common.c @@ -281,6 +281,11 @@ int sm_ll_lookup_bitmap(struct ll_disk *ll, dm_block_t= b, uint32_t *result) struct disk_index_entry ie_disk; struct dm_block *blk; =20 + if (b >=3D ll->nr_blocks) { + DMERR_LIMIT("metadata block out of bounds"); + return -EINVAL; + } + b =3D do_div(index, ll->entries_per_block); r =3D ll->load_ie(ll, index, &ie_disk); if (r < 0) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A983C433EF for ; Mon, 24 Jan 2022 19:41:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344262AbiAXTlp (ORCPT ); Mon, 24 Jan 2022 14:41:45 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58052 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353760AbiAXTfU (ORCPT ); Mon, 24 Jan 2022 14:35:20 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8AD9D614A8; Mon, 24 Jan 2022 19:35:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BD58C340E5; Mon, 24 Jan 2022 19:35:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052920; bh=Sk1WZXtFuBPyZnc9AewrErQqj3ABhbI/oQ/pZG0TFls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WQcOlHDBxFnbpx3qypRFweMEEe3U2ohsM5y3+Ry5KVeS4ie0x0MrOrCdqyNNcM+r4 UyBGGihcHznEZHpbJ2ss0+Y6v7oitQaMaNFr/R0Wmku21lkLEgs8zlxQ3N7O/CyWaO ETkLyHRkGFVPASN5E0lVDdMKADWSJz05NcxGnPmE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Corentin Labbe , "Russell King (Oracle)" , Andrew Lunn , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 217/320] net: phy: marvell: configure RGMII delays for 88E1118 Date: Mon, 24 Jan 2022 19:43:21 +0100 Message-Id: <20220124184001.023155581@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Russell King (Oracle) [ Upstream commit f22725c95ececb703c3f741e8f946d23705630b7 ] Corentin Labbe reports that the SSI 1328 does not work when allowing the PHY to operate at gigabit speeds, but does work with the generic PHY driver. This appears to be because m88e1118_config_init() writes a fixed value to the MSCR register, claiming that this is to enable 1G speeds. However, this always sets bits 4 and 5, enabling RGMII transmit and receive delays. The suspicion is that the original board this was added for required the delays to make 1G speeds work. Add the necessary configuration for RGMII delays for the 88E1118 to bring this into line with the requirements for RGMII support, and thus make the SSI 1328 work. Corentin Labbe has tested this on gemini-ssi1328 and gemini-ns2502. Reported-by: Corentin Labbe Tested-by: Corentin Labbe Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/phy/marvell.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 9dbe625ad4477..a69317e944229 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -917,6 +917,12 @@ static int m88e1118_config_init(struct phy_device *phy= dev) if (err < 0) return err; =20 + if (phy_interface_is_rgmii(phydev)) { + err =3D m88e1121_config_aneg_rgmii_delays(phydev); + if (err < 0) + return err; + } + /* Adjust LED Control */ if (phydev->dev_flags & MARVELL_PHY_M1118_DNS323_LEDS) err =3D phy_write(phydev, 0x10, 0x1100); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9491C433F5 for ; Mon, 24 Jan 2022 19:47:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344492AbiAXTob (ORCPT ); Mon, 24 Jan 2022 14:44:31 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57606 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353810AbiAXTf0 (ORCPT ); Mon, 24 Jan 2022 14:35:26 -0500 Received: from smtp.kernel.org (relay.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 4F8A2B811F9; Mon, 24 Jan 2022 19:35:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E0FCC340E5; Mon, 24 Jan 2022 19:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052923; bh=WpGQNYxdLM7SQgZfdwnO1Afb2o+Mu2rm+buoGrLP4vM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kjoGCMsiRgtkYH6WVBNqFIfkBe7wbjKmuPNaLb7rX46fvMnj+1OwuoH7ntXlUElOf TVnVwSyr9w7BnzU5bYV2eQnTn3gULaju4dg6usRDQhWEVJRPYYljGWuetUvxtA++75 zgdyadaRh5hg1Yfry4iICEJrrZIZzqIpqi8G5m/A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Russell King (Oracle)" , Linus Walleij , Corentin Labbe , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 218/320] net: gemini: allow any RGMII interface mode Date: Mon, 24 Jan 2022 19:43:22 +0100 Message-Id: <20220124184001.062525668@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Russell King (Oracle) [ Upstream commit 4e4f325a0a55907b14f579e6b1a38c53755e3de2 ] The four RGMII interface modes take care of the required RGMII delay configuration at the PHY and should not be limited by the network MAC driver. Sadly, gemini was only permitting RGMII mode with no delays, which would require the required delay to be inserted via PCB tracking or by the MAC. However, there are designs that require the PHY to add the delay, which is impossible without Gemini permitting the other three PHY interface modes. Fix the driver to allow these. Signed-off-by: Russell King (Oracle) Reviewed-by: Linus Walleij Tested-by: Corentin Labbe Link: https://lore.kernel.org/r/E1n4mpT-002PLd-Ha@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/cortina/gemini.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/c= ortina/gemini.c index c9fb1ec625d8b..a8a8b77c1611e 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -304,21 +304,21 @@ static void gmac_speed_set(struct net_device *netdev) switch (phydev->speed) { case 1000: status.bits.speed =3D GMAC_SPEED_1000; - if (phydev->interface =3D=3D PHY_INTERFACE_MODE_RGMII) + if (phy_interface_mode_is_rgmii(phydev->interface)) status.bits.mii_rmii =3D GMAC_PHY_RGMII_1000; netdev_dbg(netdev, "connect %s to RGMII @ 1Gbit\n", phydev_name(phydev)); break; case 100: status.bits.speed =3D GMAC_SPEED_100; - if (phydev->interface =3D=3D PHY_INTERFACE_MODE_RGMII) + if (phy_interface_mode_is_rgmii(phydev->interface)) status.bits.mii_rmii =3D GMAC_PHY_RGMII_100_10; netdev_dbg(netdev, "connect %s to RGMII @ 100 Mbit\n", phydev_name(phydev)); break; case 10: status.bits.speed =3D GMAC_SPEED_10; - if (phydev->interface =3D=3D PHY_INTERFACE_MODE_RGMII) + if (phy_interface_mode_is_rgmii(phydev->interface)) status.bits.mii_rmii =3D GMAC_PHY_RGMII_100_10; netdev_dbg(netdev, "connect %s to RGMII @ 10 Mbit\n", phydev_name(phydev)); @@ -388,6 +388,9 @@ static int gmac_setup_phy(struct net_device *netdev) status.bits.mii_rmii =3D GMAC_PHY_GMII; break; case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_TXID: + case PHY_INTERFACE_MODE_RGMII_RXID: netdev_dbg(netdev, "RGMII: set GMAC0 and GMAC1 to MII/RGMII mode\n"); status.bits.mii_rmii =3D GMAC_PHY_RGMII_100_10; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 340EAC43217 for ; Mon, 24 Jan 2022 23:24:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848600AbiAXXWx (ORCPT ); Mon, 24 Jan 2022 18:22:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587835AbiAXW3r (ORCPT ); Mon, 24 Jan 2022 17:29:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4057FC06175C; Mon, 24 Jan 2022 11:35:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C6439614FC; Mon, 24 Jan 2022 19:35:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 860EBC340E5; Mon, 24 Jan 2022 19:35:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052926; bh=TXPLGBjX08lx8iCQganWvEMrURi0yL0ybuyo+NimSgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0MLekpsrmir8t2NNXkyDO9ewW+WhcqZt1IW6opIsuSf6WPWh6DNsXpHAkHd+rClKi 2KMxBAgDEN2AlW1w5BTHWpunCuMyeg8EeAPuNHMnFRlZg2Ts+gzJrSMssooIYj1/HA axr8uxClK6TZ+2ELj4eD6Dn3+a3aWYGGaAA099d4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Mark Brown , Sasha Levin Subject: [PATCH 5.4 219/320] regulator: qcom_smd: Align probe function with rpmh-regulator Date: Mon, 24 Jan 2022 19:43:23 +0100 Message-Id: <20220124184001.100691766@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 14e2976fbabdacb01335d7f91eeebbc89c67ddb1 ] The RPMh regulator driver is much newer and gets more attention, which in consequence makes it do a few things better. Update qcom_smd-regulator's probe function to mimic what rpmh-regulator does to address a couple of issues: - Probe defer now works correctly, before it used to, well, kinda just die.. This fixes reliable probing on (at least) PM8994, because Linux apparently cannot deal with supply map dependencies yet.. - Regulator data is now matched more sanely: regulator data is matched against each individual regulator node name and throwing an -EINVAL if data is missing, instead of just assuming everything is fine and iterating over all subsequent array members. - status =3D "disabled" will now work for disabling individual regulators in DT. Previously it didn't seem to do much if anything at all. Signed-off-by: Konrad Dybcio Link: https://lore.kernel.org/r/20211230023442.1123424-1-konrad.dybcio@soma= inline.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/regulator/qcom_smd-regulator.c | 100 +++++++++++++++++-------- 1 file changed, 70 insertions(+), 30 deletions(-) diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qco= m_smd-regulator.c index 3b0828c79e2b5..e6601c28ab431 100644 --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c @@ -9,6 +9,7 @@ #include #include #include +#include #include =20 struct qcom_rpm_reg { @@ -776,52 +777,91 @@ static const struct of_device_id rpm_of_match[] =3D { }; MODULE_DEVICE_TABLE(of, rpm_of_match); =20 -static int rpm_reg_probe(struct platform_device *pdev) +/** + * rpm_regulator_init_vreg() - initialize all attributes of a qcom_smd-reg= ulator + * @vreg: Pointer to the individual qcom_smd-regulator resource + * @dev: Pointer to the top level qcom_smd-regulator PMIC device + * @node: Pointer to the individual qcom_smd-regulator resource + * device node + * @rpm: Pointer to the rpm bus node + * @pmic_rpm_data: Pointer to a null-terminated array of qcom_smd-regulator + * resources defined for the top level PMIC device + * + * Return: 0 on success, errno on failure + */ +static int rpm_regulator_init_vreg(struct qcom_rpm_reg *vreg, struct devic= e *dev, + struct device_node *node, struct qcom_smd_rpm *rpm, + const struct rpm_regulator_data *pmic_rpm_data) { - const struct rpm_regulator_data *reg; - const struct of_device_id *match; - struct regulator_config config =3D { }; + struct regulator_config config =3D {}; + const struct rpm_regulator_data *rpm_data; struct regulator_dev *rdev; + int ret; + + for (rpm_data =3D pmic_rpm_data; rpm_data->name; rpm_data++) + if (of_node_name_eq(node, rpm_data->name)) + break; + + if (!rpm_data->name) { + dev_err(dev, "Unknown regulator %pOFn\n", node); + return -EINVAL; + } + + vreg->dev =3D dev; + vreg->rpm =3D rpm; + vreg->type =3D rpm_data->type; + vreg->id =3D rpm_data->id; + + memcpy(&vreg->desc, rpm_data->desc, sizeof(vreg->desc)); + vreg->desc.name =3D rpm_data->name; + vreg->desc.supply_name =3D rpm_data->supply; + vreg->desc.owner =3D THIS_MODULE; + vreg->desc.type =3D REGULATOR_VOLTAGE; + vreg->desc.of_match =3D rpm_data->name; + + config.dev =3D dev; + config.of_node =3D node; + config.driver_data =3D vreg; + + rdev =3D devm_regulator_register(dev, &vreg->desc, &config); + if (IS_ERR(rdev)) { + ret =3D PTR_ERR(rdev); + dev_err(dev, "%pOFn: devm_regulator_register() failed, ret=3D%d\n", node= , ret); + return ret; + } + + return 0; +} + +static int rpm_reg_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + const struct rpm_regulator_data *vreg_data; + struct device_node *node; struct qcom_rpm_reg *vreg; struct qcom_smd_rpm *rpm; + int ret; =20 rpm =3D dev_get_drvdata(pdev->dev.parent); if (!rpm) { - dev_err(&pdev->dev, "unable to retrieve handle to rpm\n"); + dev_err(&pdev->dev, "Unable to retrieve handle to rpm\n"); return -ENODEV; } =20 - match =3D of_match_device(rpm_of_match, &pdev->dev); - if (!match) { - dev_err(&pdev->dev, "failed to match device\n"); + vreg_data =3D of_device_get_match_data(dev); + if (!vreg_data) return -ENODEV; - } =20 - for (reg =3D match->data; reg->name; reg++) { + for_each_available_child_of_node(dev->of_node, node) { vreg =3D devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); if (!vreg) return -ENOMEM; =20 - vreg->dev =3D &pdev->dev; - vreg->type =3D reg->type; - vreg->id =3D reg->id; - vreg->rpm =3D rpm; - - memcpy(&vreg->desc, reg->desc, sizeof(vreg->desc)); - - vreg->desc.id =3D -1; - vreg->desc.owner =3D THIS_MODULE; - vreg->desc.type =3D REGULATOR_VOLTAGE; - vreg->desc.name =3D reg->name; - vreg->desc.supply_name =3D reg->supply; - vreg->desc.of_match =3D reg->name; - - config.dev =3D &pdev->dev; - config.driver_data =3D vreg; - rdev =3D devm_regulator_register(&pdev->dev, &vreg->desc, &config); - if (IS_ERR(rdev)) { - dev_err(&pdev->dev, "failed to register %s\n", reg->name); - return PTR_ERR(rdev); + ret =3D rpm_regulator_init_vreg(vreg, dev, node, rpm, vreg_data); + + if (ret < 0) { + of_node_put(node); + return ret; } } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C82DC4332F for ; Mon, 24 Jan 2022 19:47:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351269AbiAXTor (ORCPT ); Mon, 24 Jan 2022 14:44:47 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33860 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353863AbiAXTfa (ORCPT ); Mon, 24 Jan 2022 14:35:30 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F08896121F; Mon, 24 Jan 2022 19:35:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B86DBC340E5; Mon, 24 Jan 2022 19:35:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052929; bh=ybTUdVpSs4tP9fA30UA8SByCPb6Bm5xSjfuBftAAKl0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IoGVSyYM6Nq0EDzcXOpJtNUDY1URjnw91tt4xxjAyFXxUNsZF+SZBDHyUYMe4SjT3 cd5ISitkjRuNGszUgktNJMzZdkp5UOqzCWWLmLJaE01Q45KgrFqj8FkGW9ftIFKA7R OHqdzQ941dDr+oVWECfDitngTtjlDpBjnNw+nwnA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Lukas Wunner , Sasha Levin Subject: [PATCH 5.4 220/320] serial: pl010: Drop CR register reset on set_termios Date: Mon, 24 Jan 2022 19:43:24 +0100 Message-Id: <20220124184001.139499978@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Wunner [ Upstream commit 08a0c6dff91c965e39905cf200d22db989203ccb ] pl010_set_termios() briefly resets the CR register to zero. Where does this register write come from? The PL010 driver's IRQ handler ambauart_int() originally modified the CR register without holding the port spinlock. ambauart_set_termios() also modified that register. To prevent concurrent read-modify-writes by the IRQ handler and to prevent transmission while changing baudrate, ambauart_set_termios() had to disable interrupts. That is achieved by writing zero to the CR register. However in 2004 the PL010 driver was amended to acquire the port spinlock in the IRQ handler, obviating the need to disable interrupts in ->set_termios(): https://git.kernel.org/history/history/c/157c0342e591 That rendered the CR register write obsolete. Drop it. Cc: Russell King Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/fcaff16e5b1abb4cc3da5a2879ac13f278b99ed0.16= 41128728.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/tty/serial/amba-pl010.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl01= 0.c index 2c37d11726aba..13f882e5e7b76 100644 --- a/drivers/tty/serial/amba-pl010.c +++ b/drivers/tty/serial/amba-pl010.c @@ -452,14 +452,11 @@ pl010_set_termios(struct uart_port *port, struct kter= mios *termios, if ((termios->c_cflag & CREAD) =3D=3D 0) uap->port.ignore_status_mask |=3D UART_DUMMY_RSR_RX; =20 - /* first, disable everything */ old_cr =3D readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; =20 if (UART_ENABLE_MS(port, termios->c_cflag)) old_cr |=3D UART010_CR_MSIE; =20 - writel(0, uap->port.membase + UART010_CR); - /* Set baud rate */ quot -=3D 1; writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F144C43217 for ; Mon, 24 Jan 2022 19:48:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355875AbiAXTot (ORCPT ); Mon, 24 Jan 2022 14:44:49 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33930 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353941AbiAXTfg (ORCPT ); Mon, 24 Jan 2022 14:35:36 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2342961502; Mon, 24 Jan 2022 19:35:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 032ECC340E5; Mon, 24 Jan 2022 19:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052935; bh=3/QdR6SGlH1mYgnJ4NwJ66sQHw5xtbVGngxoo/WjW6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jBfhDZJ9p+km6S4QYFs4gMnrcHK2YMjq3uIWADZf2tO5BSk35IpkpI9sUb64jKs58 jvaie+Vv/vv/DrJr6FlJtl2kt/FjZ/ekIkRWJW0ERErNKFH2iCZVJtOJysryORZ/mI bGc1hfMaLzCRJJVIVWOZN1Pp0SJ948B3ZWAnOMMc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Sasha Levin Subject: [PATCH 5.4 221/320] serial: core: Keep mctrl register state and cached copy in sync Date: Mon, 24 Jan 2022 19:43:25 +0100 Message-Id: <20220124184001.178038152@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Wunner [ Upstream commit 93a770b7e16772530196674ffc79bb13fa927dc6 ] struct uart_port contains a cached copy of the Modem Control signals. It is used to skip register writes in uart_update_mctrl() if the new signal state equals the old signal state. It also avoids a register read to obtain the current state of output signals. When a uart_port is registered, uart_configure_port() changes signal state but neglects to keep the cached copy in sync. That may cause a subsequent register write to be incorrectly skipped. Fix it before it trips somebody up. This behavior has been present ever since the serial core was introduced in 2002: https://git.kernel.org/history/history/c/33c0d1b0c3eb So far it was never an issue because the cached copy is initialized to 0 by kzalloc() and when uart_configure_port() is executed, at most DTR has been set by uart_set_options() or sunsu_console_setup(). Therefore, a stable designation seems unnecessary. Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/bceeaba030b028ed810272d55d5fc6f3656ddddb.16= 41129752.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/tty/serial/serial_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_c= ore.c index aad640b9e3f4b..c8a047ba76ebe 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2395,7 +2395,8 @@ uart_configure_port(struct uart_driver *drv, struct u= art_state *state, * We probably don't need a spinlock around this, but */ spin_lock_irqsave(&port->lock, flags); - port->ops->set_mctrl(port, port->mctrl & TIOCM_DTR); + port->mctrl &=3D TIOCM_DTR; + port->ops->set_mctrl(port, port->mctrl); spin_unlock_irqrestore(&port->lock, flags); =20 /* --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A42FC4321E for ; Mon, 24 Jan 2022 23:29:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850201AbiAXX1g (ORCPT ); Mon, 24 Jan 2022 18:27:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588101AbiAXWbZ (ORCPT ); Mon, 24 Jan 2022 17:31:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E45AC06175F; Mon, 24 Jan 2022 11:35:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F2ECA614FC; Mon, 24 Jan 2022 19:35:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF8CFC340E5; Mon, 24 Jan 2022 19:35:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052938; bh=x0fzf8FlFRZXZhlR8ylc17SgQ+HQ3whKwwhRnI/v+fE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dm6wvxQS65FURRn4o9oPxuHFVGXVUVcMYCAnukXESXs6iTgQRf9f7fYwK+iZ59vFc 6Iqmc0BHLDAH8O9+ZMv8iD3KsE38zvhqAPdXyQQx12aZLsdED5ljNUHUz328AT+bcj N4M5FhXKpLHZFGkxYt3oV4jU26CqSY945Hy6EUAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dominik Brodowski , "Jason A. Donenfeld" , Sasha Levin Subject: [PATCH 5.4 222/320] random: do not throw away excess input to crng_fast_load Date: Mon, 24 Jan 2022 19:43:26 +0100 Message-Id: <20220124184001.207698415@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 73c7733f122e8d0107f88655a12011f68f69e74b ] When crng_fast_load() is called by add_hwgenerator_randomness(), we currently will advance to crng_init=3D=3D1 once we've acquired 64 bytes, and then throw away the rest of the buffer. Usually, that is not a problem: When add_hwgenerator_randomness() gets called via EFI or DT during setup_arch(), there won't be any IRQ randomness. Therefore, the 64 bytes passed by EFI exactly matches what is needed to advance to crng_init=3D=3D1. Usually, DT seems to pass 64 bytes as well -- with one notable exception being kexec, which hands over 128 bytes of entropy to the kexec'd kernel. In that case, we'll advance to crng_init=3D=3D1 once 64 of those bytes are consumed by crng_fast_load(), but won't continue onward feeding in bytes to progress to crng_init=3D=3D2. This commit fixes the issue by feeding any leftover bytes into the next phase in add_hwgenerator_randomness(). [linux@dominikbrodowski.net: rewrite commit message] Signed-off-by: Dominik Brodowski Signed-off-by: Jason A. Donenfeld Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/char/random.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 60b39af1279a4..19bfbaf135989 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -975,12 +975,14 @@ static struct crng_state *select_crng(void) =20 /* * crng_fast_load() can be called by code in the interrupt service - * path. So we can't afford to dilly-dally. + * path. So we can't afford to dilly-dally. Returns the number of + * bytes processed from cp. */ -static int crng_fast_load(const char *cp, size_t len) +static size_t crng_fast_load(const char *cp, size_t len) { unsigned long flags; char *p; + size_t ret =3D 0; =20 if (!spin_trylock_irqsave(&primary_crng.lock, flags)) return 0; @@ -991,7 +993,7 @@ static int crng_fast_load(const char *cp, size_t len) p =3D (unsigned char *) &primary_crng.state[4]; while (len > 0 && crng_init_cnt < CRNG_INIT_CNT_THRESH) { p[crng_init_cnt % CHACHA_KEY_SIZE] ^=3D *cp; - cp++; crng_init_cnt++; len--; + cp++; crng_init_cnt++; len--; ret++; } spin_unlock_irqrestore(&primary_crng.lock, flags); if (crng_init_cnt >=3D CRNG_INIT_CNT_THRESH) { @@ -1000,7 +1002,7 @@ static int crng_fast_load(const char *cp, size_t len) wake_up_interruptible(&crng_init_wait); pr_notice("random: fast init done\n"); } - return 1; + return ret; } =20 /* @@ -1353,7 +1355,7 @@ void add_interrupt_randomness(int irq, int irq_flags) if (unlikely(crng_init =3D=3D 0)) { if ((fast_pool->count >=3D 64) && crng_fast_load((char *) fast_pool->pool, - sizeof(fast_pool->pool))) { + sizeof(fast_pool->pool)) > 0) { fast_pool->count =3D 0; fast_pool->last =3D now; } @@ -2501,8 +2503,11 @@ void add_hwgenerator_randomness(const char *buffer, = size_t count, struct entropy_store *poolp =3D &input_pool; =20 if (unlikely(crng_init =3D=3D 0)) { - crng_fast_load(buffer, count); - return; + size_t ret =3D crng_fast_load(buffer, count); + count -=3D ret; + buffer +=3D ret; + if (!count || crng_init =3D=3D 0) + return; } =20 /* Suspend writing if we're above the trickle threshold. --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19C6FC433EF for ; Mon, 24 Jan 2022 19:48:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355934AbiAXTo5 (ORCPT ); Mon, 24 Jan 2022 14:44:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57812 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353985AbiAXTfn (ORCPT ); Mon, 24 Jan 2022 14:35:43 -0500 Received: from smtp.kernel.org (relay.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 97DC8B8122A; Mon, 24 Jan 2022 19:35:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE896C340E7; Mon, 24 Jan 2022 19:35:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052941; bh=Z6LnLnvpzRXBhuAU39DeUE7li7MEBSuYocwLtie5v+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UJoHSb0WWm4pv0sW0A01Nvkc6yoWvHsDaOQNhDQ9ULKBbQ/YmZzhkoEPZCbJG+cIU 92Eb/kTLXbnACWxZTxLiIOjQ1xN+wf4+8d77eTBkjUmCfnHWUEPMKClmORUhq7kV7R 9VcNqWaqMTy1jplCGOvdbidHUPemzGAMW4u/4tH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John David Anglin , Helge Deller , Sasha Levin Subject: [PATCH 5.4 223/320] parisc: Avoid calling faulthandler_disabled() twice Date: Mon, 24 Jan 2022 19:43:27 +0100 Message-Id: <20220124184001.578089440@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 David Anglin [ Upstream commit 9e9d4b460f23bab61672eae397417d03917d116c ] In handle_interruption(), we call faulthandler_disabled() to check whether = the fault handler is not disabled. If the fault handler is disabled, we immedia= tely call do_page_fault(). It then calls faulthandler_disabled(). If disabled, do_page_fault() attempts to fixup the exception by jumping to no_context: no_context: if (!user_mode(regs) && fixup_exception(regs)) { return; } parisc_terminate("Bad Address (null pointer deref?)", regs, code, a= ddress); Apart from the error messages, the two blocks of code perform the same function. We can avoid two calls to faulthandler_disabled() by a simple revision to the code in handle_interruption(). Note: I didn't try to fix the formatting of this code block. Signed-off-by: John David Anglin Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/parisc/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c index 82fc011894889..2a1060d747a5d 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c @@ -783,7 +783,7 @@ void notrace handle_interruption(int code, struct pt_re= gs *regs) * unless pagefault_disable() was called before. */ =20 - if (fault_space =3D=3D 0 && !faulthandler_disabled()) + if (faulthandler_disabled() || fault_space =3D=3D 0) { /* Clean up and return if in exception table. */ if (fixup_exception(regs)) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2CD4C433EF for ; Mon, 24 Jan 2022 20:02:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345996AbiAXUCY (ORCPT ); Mon, 24 Jan 2022 15:02:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57844 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354020AbiAXTfq (ORCPT ); Mon, 24 Jan 2022 14:35:46 -0500 Received: from smtp.kernel.org (relay.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 A7C7BB81238; Mon, 24 Jan 2022 19:35:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE938C340E5; Mon, 24 Jan 2022 19:35:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052944; bh=ETddzE3Lq3EU9bMSDlE2ShnRd8iiKQWFS2i5TL7wyWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uDouDohxeLZIRD//iDkQ7g+t1TKCYLIbl+fQNhqd6V17UL9MicLWcEbtHs8Ybfw1b gfoZCr+syRAtHz0z4c0gQQhWhmVZpId7hrP/fblgPacYGYPpy+L0Zp/pOkr7xhx6Ra 9gfWqR1c7eHYQfOjRERka3NSvhDo/6Yri90RUNII= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 224/320] powerpc/6xx: add missing of_node_put Date: Mon, 24 Jan 2022 19:43:28 +0100 Message-Id: <20220124184001.607075988@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Julia Lawall [ Upstream commit f6e82647ff71d427d4148964b71f239fba9d7937 ] for_each_compatible_node performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ expression e; local idexpression n; @@ @@ local idexpression n; expression e; @@ for_each_compatible_node(n,...) { ... ( of_node_put(n); | e =3D n | + of_node_put(n); ? break; ) ... } ... when !=3D n // Signed-off-by: Julia Lawall Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1448051604-25256-2-git-send-email-Julia.Law= all@lip6.fr Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/p= latforms/embedded6xx/hlwd-pic.c index a1b7f79a8a152..de10c13de15c6 100644 --- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c +++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c @@ -215,6 +215,7 @@ void hlwd_pic_probe(void) irq_set_chained_handler(cascade_virq, hlwd_pic_irq_cascade); hlwd_irq_host =3D host; + of_node_put(np); break; } } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0739C433FE for ; Mon, 24 Jan 2022 20:32:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348698AbiAXUct (ORCPT ); Mon, 24 Jan 2022 15:32:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352212AbiAXUNi (ORCPT ); Mon, 24 Jan 2022 15:13:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F5C2C061760; Mon, 24 Jan 2022 11:35:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1EC70614FC; Mon, 24 Jan 2022 19:35:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF66CC340E5; Mon, 24 Jan 2022 19:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052947; bh=KUsfQVHU2x96z/Fe4VrNN/7LI2bKQv8NRmV2m8PqQuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ss65pz7gvH0Kl51OtAOYXOuoY3JbN58w7KmC7orChKCDBxFG6Rbq1FMwid9Ku5X5S gMYEQqvoLJIAbqsOaryt0WdLj9QqCMhBKVCE0O0nkczcsnedEf6tKfxE58jnXAP8lR SG0UUGGY7TVFHl0mwbvE46bkUom5/6hoeP7PadLA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 225/320] powerpc/powernv: add missing of_node_put Date: Mon, 24 Jan 2022 19:43:29 +0100 Message-Id: <20220124184001.645205945@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Julia Lawall [ Upstream commit 7d405a939ca960162eb30c1475759cb2fdf38f8c ] for_each_compatible_node performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ local idexpression n; expression e; @@ for_each_compatible_node(n,...) { ... ( of_node_put(n); | e =3D n | + of_node_put(n); ? break; ) ... } ... when !=3D n // Signed-off-by: Julia Lawall Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1448051604-25256-4-git-send-email-Julia.Law= all@lip6.fr Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/powerpc/platforms/powernv/opal-lpc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platf= orms/powernv/opal-lpc.c index 608569082ba0b..123a0e799b7bd 100644 --- a/arch/powerpc/platforms/powernv/opal-lpc.c +++ b/arch/powerpc/platforms/powernv/opal-lpc.c @@ -396,6 +396,7 @@ void __init opal_lpc_init(void) if (!of_get_property(np, "primary", NULL)) continue; opal_lpc_chip_id =3D of_get_ibm_chip_id(np); + of_node_put(np); break; } if (opal_lpc_chip_id < 0) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2171AC433EF for ; Mon, 24 Jan 2022 20:33:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348641AbiAXUdD (ORCPT ); Mon, 24 Jan 2022 15:33:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355416AbiAXUNi (ORCPT ); Mon, 24 Jan 2022 15:13:38 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18AADC061762; Mon, 24 Jan 2022 11:35:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D380CB8123D; Mon, 24 Jan 2022 19:35:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BEDDC340E5; Mon, 24 Jan 2022 19:35:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052950; bh=RV+GZ1lMaOyQ7OYXWIqi5CS12JZeAKVD0W8zLOYkvQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ldVc8QYuoXWXE4MjuaD6BCSIjZ9iXlk9RPA26csyipxbQLbZ16bwyWsOUzjBe1DBY nHSiFsfnZfBOXG7OmRJFYdcxglKaHFIRTwsGPffr5dEPQavDYcj98WbR2wA2L0lN1f ZV3en8+52FwwuM9Meo51T8ZPUmgejgtgEYWA340E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 226/320] powerpc/cell: add missing of_node_put Date: Mon, 24 Jan 2022 19:43:30 +0100 Message-Id: <20220124184001.677544745@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Julia Lawall [ Upstream commit a841fd009e51c8c0a8f07c942e9ab6bb48da8858 ] for_each_node_by_name performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ expression e,e1; local idexpression n; @@ for_each_node_by_name(n, e1) { ... when !=3D of_node_put(n) when !=3D e =3D n ( return n; | + of_node_put(n); ? return ...; ) ... } // Signed-off-by: Julia Lawall Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1448051604-25256-7-git-send-email-Julia.Law= all@lip6.fr Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/powerpc/platforms/cell/iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/c= ell/iommu.c index ca9ffc1c8685d..a6a60e2b8f453 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c @@ -976,6 +976,7 @@ static int __init cell_iommu_fixed_mapping_init(void) if (hbase < dbase || (hend > (dbase + dsize))) { pr_debug("iommu: hash window doesn't fit in" "real DMA window\n"); + of_node_put(np); return -1; } } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD5B1C433F5 for ; Mon, 24 Jan 2022 23:29:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1850185AbiAXX1f (ORCPT ); Mon, 24 Jan 2022 18:27:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588098AbiAXWbZ (ORCPT ); Mon, 24 Jan 2022 17:31:25 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F572C061763; Mon, 24 Jan 2022 11:35:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BB2CEB810AF; Mon, 24 Jan 2022 19:35:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0104C340E5; Mon, 24 Jan 2022 19:35:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052953; bh=TeOybPCuy899VcWCsri2XttiCdSsunaa++ru/kz8Neo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=imesMN+gxO+5qg3tp9fA/nqqu62q6LVX6WeTm6P3CMbGmM4R8b5dhJ5Fv3EE4EuFB UI5UcU/8umST89iLQcQYiCuXzghCKUs7YfsCgqdb9fhVK7CwC+SY9B4MQW4uqxjYgw gziwlWzxVJs+benjtbArd1FNYQYcg0FG8pGn0rfY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 227/320] powerpc/btext: add missing of_node_put Date: Mon, 24 Jan 2022 19:43:31 +0100 Message-Id: <20220124184001.709378667@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Julia Lawall [ Upstream commit a1d2b210ffa52d60acabbf7b6af3ef7e1e69cda0 ] for_each_node_by_type performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ local idexpression n; expression e; @@ for_each_node_by_type(n,...) { ... ( of_node_put(n); | e =3D n | + of_node_put(n); ? break; ) ... } ... when !=3D n // Signed-off-by: Julia Lawall Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1448051604-25256-6-git-send-email-Julia.Law= all@lip6.fr Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/powerpc/kernel/btext.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index 6dfceaa820e42..b0e0b3cd91eec 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c @@ -250,8 +250,10 @@ int __init btext_find_display(int allow_nonstdout) rc =3D btext_initialize(np); printk("result: %d\n", rc); } - if (rc =3D=3D 0) + if (rc =3D=3D 0) { + of_node_put(np); break; + } } return rc; } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94492C433EF for ; Mon, 24 Jan 2022 20:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357003AbiAXUdo (ORCPT ); Mon, 24 Jan 2022 15:33:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349334AbiAXUNj (ORCPT ); Mon, 24 Jan 2022 15:13:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C5B0C061765; Mon, 24 Jan 2022 11:35:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0BFB7614FC; Mon, 24 Jan 2022 19:35:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3356C340E5; Mon, 24 Jan 2022 19:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052956; bh=fqghv2tM9KQdZtwnpamw7ZoE6favq2oByT6WYmfaJKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u4r6HlSDzXweTuTb2eNTILEfjgfGJ8oyVtGra3tkhSXsGLC8LjgIRcOMz6h2ZleiW LRGQY4JHBlJEnuhjMzAz840sYAtzOqt72h0laZf1eeYzrl9g5eFIHXIygXFG9uUIr2 GlIUVcGNlxLSBurDZNUUh+lFvkpwpEMs14/2AYX8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Laurent Dufour , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 228/320] powerpc/watchdog: Fix missed watchdog reset due to memory ordering race Date: Mon, 24 Jan 2022 19:43:32 +0100 Message-Id: <20220124184001.741509727@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicholas Piggin [ Upstream commit 5dad4ba68a2483fc80d70b9dc90bbe16e1f27263 ] It is possible for all CPUs to miss the pending cpumask becoming clear, and then nobody resetting it, which will cause the lockup detector to stop working. It will eventually expire, but watchdog_smp_panic will avoid doing anything if the pending mask is clear and it will never be reset. Order the cpumask clear vs the subsequent test to close this race. Add an extra check for an empty pending mask when the watchdog fires and finds its bit still clear, to try to catch any other possible races or bugs here and keep the watchdog working. The extra test in arch_touch_nmi_watchdog is required to prevent the new warning from firing off. Signed-off-by: Nicholas Piggin Reviewed-by: Laurent Dufour Debugged-by: Laurent Dufour Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211110025056.2084347-2-npiggin@gmail.com Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/powerpc/kernel/watchdog.c | 41 +++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c index af3c15a1d41eb..75b2a6c4db5a5 100644 --- a/arch/powerpc/kernel/watchdog.c +++ b/arch/powerpc/kernel/watchdog.c @@ -132,6 +132,10 @@ static void set_cpumask_stuck(const struct cpumask *cp= umask, u64 tb) { cpumask_or(&wd_smp_cpus_stuck, &wd_smp_cpus_stuck, cpumask); cpumask_andnot(&wd_smp_cpus_pending, &wd_smp_cpus_pending, cpumask); + /* + * See wd_smp_clear_cpu_pending() + */ + smp_mb(); if (cpumask_empty(&wd_smp_cpus_pending)) { wd_smp_last_reset_tb =3D tb; cpumask_andnot(&wd_smp_cpus_pending, @@ -217,13 +221,44 @@ static void wd_smp_clear_cpu_pending(int cpu, u64 tb) =20 cpumask_clear_cpu(cpu, &wd_smp_cpus_stuck); wd_smp_unlock(&flags); + } else { + /* + * The last CPU to clear pending should have reset the + * watchdog so we generally should not find it empty + * here if our CPU was clear. However it could happen + * due to a rare race with another CPU taking the + * last CPU out of the mask concurrently. + * + * We can't add a warning for it. But just in case + * there is a problem with the watchdog that is causing + * the mask to not be reset, try to kick it along here. + */ + if (unlikely(cpumask_empty(&wd_smp_cpus_pending))) + goto none_pending; } return; } + cpumask_clear_cpu(cpu, &wd_smp_cpus_pending); + + /* + * Order the store to clear pending with the load(s) to check all + * words in the pending mask to check they are all empty. This orders + * with the same barrier on another CPU. This prevents two CPUs + * clearing the last 2 pending bits, but neither seeing the other's + * store when checking if the mask is empty, and missing an empty + * mask, which ends with a false positive. + */ + smp_mb(); if (cpumask_empty(&wd_smp_cpus_pending)) { unsigned long flags; =20 +none_pending: + /* + * Double check under lock because more than one CPU could see + * a clear mask with the lockless check after clearing their + * pending bits. + */ wd_smp_lock(&flags); if (cpumask_empty(&wd_smp_cpus_pending)) { wd_smp_last_reset_tb =3D tb; @@ -314,8 +349,12 @@ void arch_touch_nmi_watchdog(void) { unsigned long ticks =3D tb_ticks_per_usec * wd_timer_period_ms * 1000; int cpu =3D smp_processor_id(); - u64 tb =3D get_tb(); + u64 tb; =20 + if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) + return; + + tb =3D get_tb(); if (tb - per_cpu(wd_timer_tb, cpu) >=3D ticks) { per_cpu(wd_timer_tb, cpu) =3D tb; wd_smp_clear_cpu_pending(cpu, tb); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43B75C433FE for ; Mon, 24 Jan 2022 20:34:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385684AbiAXUd6 (ORCPT ); Mon, 24 Jan 2022 15:33:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355424AbiAXUNj (ORCPT ); Mon, 24 Jan 2022 15:13:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 135B1C061768; Mon, 24 Jan 2022 11:36:02 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D02ACB81239; Mon, 24 Jan 2022 19:36:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0835DC340E5; Mon, 24 Jan 2022 19:35:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052959; bh=Fu2rLzeUDaVElkoc6+b62pdiMdE6f0wRxHkWDfpMuv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RUtVEXsEdZ/1gbxOTVxDRJjg10Gpy31EGE5qN6Ib4d7OsqR7BPE7i5fOCJkVB2cB6 eguJpOc6N8/aAZDfd1YjSqwiWamYs6d5+cpmDfld9pK2iE9UPavGXc+cunvInh0lPi IugevJAdI7peSQMRzxVwl+IvqmRo+TRUwz7sySwA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiner Kallweit , Jean Delvare , Wolfram Sang , Sasha Levin Subject: [PATCH 5.4 229/320] i2c: i801: Dont silently correct invalid transfer size Date: Mon, 24 Jan 2022 19:43:33 +0100 Message-Id: <20220124184001.775036885@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Heiner Kallweit [ Upstream commit effa453168a7eeb8a562ff4edc1dbf9067360a61 ] If an invalid block size is provided, reject it instead of silently changing it to a supported value. Especially critical I see the case of a write transfer with block length 0. In this case we have no guarantee that the byte we would write is valid. When silently reducing a read to 32 bytes then we don't return an error and the caller may falsely assume that we returned the full requested data. If this change should break any (broken) caller, then I think we should fix the caller. Signed-off-by: Heiner Kallweit Reviewed-by: Jean Delvare Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/i2c/busses/i2c-i801.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index a959062ded4f8..4e6d0b722ddcd 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -785,6 +785,11 @@ static int i801_block_transaction(struct i801_priv *pr= iv, int result =3D 0; unsigned char hostc; =20 + if (read_write =3D=3D I2C_SMBUS_READ && command =3D=3D I2C_SMBUS_BLOCK_DA= TA) + data->block[0] =3D I2C_SMBUS_BLOCK_MAX; + else if (data->block[0] < 1 || data->block[0] > I2C_SMBUS_BLOCK_MAX) + return -EPROTO; + if (command =3D=3D I2C_SMBUS_I2C_BLOCK_DATA) { if (read_write =3D=3D I2C_SMBUS_WRITE) { /* set I2C_EN bit in configuration register */ @@ -798,16 +803,6 @@ static int i801_block_transaction(struct i801_priv *pr= iv, } } =20 - if (read_write =3D=3D I2C_SMBUS_WRITE - || command =3D=3D I2C_SMBUS_I2C_BLOCK_DATA) { - if (data->block[0] < 1) - data->block[0] =3D 1; - if (data->block[0] > I2C_SMBUS_BLOCK_MAX) - data->block[0] =3D I2C_SMBUS_BLOCK_MAX; - } else { - data->block[0] =3D 32; /* max for SMBus block reads */ - } - /* Experience has shown that the block buffer can only be used for SMBus (not I2C) block transactions, even though the datasheet doesn't mention this limitation. */ --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A130FC433F5 for ; Mon, 24 Jan 2022 19:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355949AbiAXTo6 (ORCPT ); Mon, 24 Jan 2022 14:44:58 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58044 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354135AbiAXTgF (ORCPT ); Mon, 24 Jan 2022 14:36:05 -0500 Received: from smtp.kernel.org (relay.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 DE1D7B8122C; Mon, 24 Jan 2022 19:36:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19EAEC340E5; Mon, 24 Jan 2022 19:36:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052962; bh=xX+HrHhYId0Tfufo3/43Ld1U2JB46Xat28lK7sWeS/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YHFeCgFVzqRrNp0Z890erP8tkknqpzg5PLZ6aogOTdf/VgcxznKe+YHTl1mB5Ieu6 RyQSmeDK1M3s1EEzKDqzn5YR8r/HCy2alg/w3EJWNbW+bnBrByPLHvPlz91oTRa+OE 99PiluY44XVE+PvCZjf2Def+I9PlbNDZ+Ilf34+4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 230/320] powerpc/smp: Move setup_profiling_timer() under CONFIG_PROFILING Date: Mon, 24 Jan 2022 19:43:34 +0100 Message-Id: <20220124184001.805656409@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Michael Ellerman [ Upstream commit a4ac0d249a5db80e79d573db9e4ad29354b643a8 ] setup_profiling_timer() is only needed when CONFIG_PROFILING is enabled. Fixes the following W=3D1 warning when CONFIG_PROFILING=3Dn: linux/arch/powerpc/kernel/smp.c:1638:5: error: no previous prototype for = =E2=80=98setup_profiling_timer=E2=80=99 Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211124093254.1054750-5-mpe@ellerman.id.au Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/powerpc/kernel/smp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index c06cac543f188..82dff003a7fd6 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -1296,10 +1296,12 @@ void start_secondary(void *unused) BUG(); } =20 +#ifdef CONFIG_PROFILING int setup_profiling_timer(unsigned int multiplier) { return 0; } +#endif =20 #ifdef CONFIG_SCHED_SMT /* cpumask of CPUs with asymetric SMT dependancy */ --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28F07C433FE for ; Mon, 24 Jan 2022 19:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356027AbiAXTpE (ORCPT ); Mon, 24 Jan 2022 14:45:04 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58092 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354186AbiAXTgL (ORCPT ); Mon, 24 Jan 2022 14:36:11 -0500 Received: from smtp.kernel.org (relay.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 D8F29B8122F; Mon, 24 Jan 2022 19:36:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AE20C340E5; Mon, 24 Jan 2022 19:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052968; bh=sTCekZEw9uEAHrjdVyISUfUMGWrR2PuYEye6KgK+SL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RSbWWf0elt2hxWRUfHajIgtQviTqewavZWRsjFhP9L5guZD8xudsDNBNK6mxSsIAA tE7cj9p4P/OvvQN3HQ6xZjXnpp1GwBODe1apYJgDPKDs6p6q8w7dT5HitAwfpmGe0Z mScAfNZmptIH145JJWQlb0zN1pdpYshEhY90CtHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joakim Tjernlund , Scott Wood , Wolfram Sang , Sasha Levin Subject: [PATCH 5.4 231/320] i2c: mpc: Correct I2C reset procedure Date: Mon, 24 Jan 2022 19:43:35 +0100 Message-Id: <20220124184001.845220854@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joakim Tjernlund [ Upstream commit ebe82cf92cd4825c3029434cabfcd2f1780e64be ] Current I2C reset procedure is broken in two ways: 1) It only generate 1 START instead of 9 STARTs and STOP. 2) It leaves the bus Busy so every I2C xfer after the first fixup calls the reset routine again, for every xfer there after. This fixes both errors. Signed-off-by: Joakim Tjernlund Acked-by: Scott Wood Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/i2c/busses/i2c-mpc.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index af349661fd769..8de8296d25831 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c @@ -105,23 +105,30 @@ static irqreturn_t mpc_i2c_isr(int irq, void *dev_id) /* Sometimes 9th clock pulse isn't generated, and slave doesn't release * the bus, because it wants to send ACK. * Following sequence of enabling/disabling and sending start/stop generat= es - * the 9 pulses, so it's all OK. + * the 9 pulses, each with a START then ending with STOP, so it's all OK. */ static void mpc_i2c_fixup(struct mpc_i2c *i2c) { int k; - u32 delay_val =3D 1000000 / i2c->real_clk + 1; - - if (delay_val < 2) - delay_val =3D 2; + unsigned long flags; =20 for (k =3D 9; k; k--) { writeccr(i2c, 0); - writeccr(i2c, CCR_MSTA | CCR_MTX | CCR_MEN); + writeb(0, i2c->base + MPC_I2C_SR); /* clear any status bits */ + writeccr(i2c, CCR_MEN | CCR_MSTA); /* START */ + readb(i2c->base + MPC_I2C_DR); /* init xfer */ + udelay(15); /* let it hit the bus */ + local_irq_save(flags); /* should not be delayed further */ + writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSTA); /* delay SDA */ readb(i2c->base + MPC_I2C_DR); - writeccr(i2c, CCR_MEN); - udelay(delay_val << 1); + if (k !=3D 1) + udelay(5); + local_irq_restore(flags); } + writeccr(i2c, CCR_MEN); /* Initiate STOP */ + readb(i2c->base + MPC_I2C_DR); + udelay(15); /* Let STOP propagate */ + writeccr(i2c, 0); } =20 static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43D92C43219 for ; Mon, 24 Jan 2022 23:24:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848622AbiAXXWz (ORCPT ); Mon, 24 Jan 2022 18:22:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588100AbiAXWbZ (ORCPT ); Mon, 24 Jan 2022 17:31:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3C72C061769; Mon, 24 Jan 2022 11:36:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 50AF26131E; Mon, 24 Jan 2022 19:36:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E2E1C340E5; Mon, 24 Jan 2022 19:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052971; bh=m7JLj5kTr3Bfw//9CcyMcWKFqW+mZabH4MBRc9mSyek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZF1n8P1BdqHUbRwUB9O91haSRITQmwYcf/4bdjuQneytWAJYmXL0u7EIxwvo7QmyT fhWRhKF7PuqmrW576fTaWYwku8RoDwSyaK9y2aF17naivb+1uqP04NN20ArGdZZvb9 5mw0U7KFfbbOuXZgfDMOTSjbafQisUugwWny1HDE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Hewitt , Martin Blumenstingl , Jerome Brunet , Sasha Levin Subject: [PATCH 5.4 232/320] clk: meson: gxbb: Fix the SDM_EN bit for MPLL0 on GXBB Date: Mon, 24 Jan 2022 19:43:36 +0100 Message-Id: <20220124184001.874867416@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Martin Blumenstingl [ Upstream commit ff54938dd190d85f740b9bf9dde59b550936b621 ] There are reports that 48kHz audio does not work on the WeTek Play 2 (which uses a GXBB SoC), while 44.1kHz audio works fine on the same board. There are also reports of 48kHz audio working fine on GXL and GXM SoCs, which are using an (almost) identical AIU (audio controller). Experimenting has shown that MPLL0 is causing this problem. In the .dts we have by default: assigned-clocks =3D <&clkc CLKID_MPLL0>, <&clkc CLKID_MPLL1>, <&clkc CLKID_MPLL2>; assigned-clock-rates =3D <294912000>, <270950400>, <393216000>; The MPLL0 rate is divisible by 48kHz without remainder and the MPLL1 rate is divisible by 44.1kHz without remainder. Swapping these two clock rates "fixes" 48kHz audio but breaks 44.1kHz audio. Everything looks normal when looking at the info provided by the common clock framework while playing 48kHz audio (via I2S with mclk-fs =3D 256): mpll_prediv 1 1 0 2000000000 mpll0_div 1 1 0 294909641 mpll0 1 1 0 294909641 cts_amclk_sel 1 1 0 294909641 cts_amclk_div 1 1 0 12287902 cts_amclk 1 1 0 12287902 meson-clk-msr however shows that the actual MPLL0 clock is off by more than 38MHz: mp0_out 333322917 +/-10416Hz The rate seen by meson-clk-msr is very close to what we would get when SDM (the fractional part) was ignored: (2000000000Hz * 16384) / ((16384 * 6) =3D 333.33MHz If SDM was considered the we should get close to: (2000000000Hz * 16384) / ((16384 * 6) + 12808) =3D 294.9MHz Further experimenting shows that HHI_MPLL_CNTL7[15] does not have any effect on the rate of MPLL0 as seen my meson-clk-msr (regardless of whether that bit is zero or one the rate is always the same according to meson-clk-msr). Using HHI_MPLL_CNTL[25] on the other hand as SDM_EN results in SDM being considered for the rate output by the hardware. The rate - as seen by meson-clk-msr - matches with what we expect when SDM_EN is enabled (fractional part is being considered, resulting in a 294.9MHz output) or disable (fractional part being ignored, resulting in a 333.33MHz output). Reported-by: Christian Hewitt Tested-by: Christian Hewitt Signed-off-by: Martin Blumenstingl Signed-off-by: Jerome Brunet Link: https://lore.kernel.org/r/20211031135006.1508796-1-martin.blumensting= l@googlemail.com Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/clk/meson/gxbb.c | 44 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index 1f9c056e684ce..e8e36ec70b27f 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -712,6 +712,35 @@ static struct clk_regmap gxbb_mpll_prediv =3D { }; =20 static struct clk_regmap gxbb_mpll0_div =3D { + .data =3D &(struct meson_clk_mpll_data){ + .sdm =3D { + .reg_off =3D HHI_MPLL_CNTL7, + .shift =3D 0, + .width =3D 14, + }, + .sdm_en =3D { + .reg_off =3D HHI_MPLL_CNTL, + .shift =3D 25, + .width =3D 1, + }, + .n2 =3D { + .reg_off =3D HHI_MPLL_CNTL7, + .shift =3D 16, + .width =3D 9, + }, + .lock =3D &meson_clk_lock, + }, + .hw.init =3D &(struct clk_init_data){ + .name =3D "mpll0_div", + .ops =3D &meson_clk_mpll_ops, + .parent_hws =3D (const struct clk_hw *[]) { + &gxbb_mpll_prediv.hw + }, + .num_parents =3D 1, + }, +}; + +static struct clk_regmap gxl_mpll0_div =3D { .data =3D &(struct meson_clk_mpll_data){ .sdm =3D { .reg_off =3D HHI_MPLL_CNTL7, @@ -748,7 +777,16 @@ static struct clk_regmap gxbb_mpll0 =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "mpll0", .ops =3D &clk_regmap_gate_ops, - .parent_hws =3D (const struct clk_hw *[]) { &gxbb_mpll0_div.hw }, + .parent_data =3D &(const struct clk_parent_data) { + /* + * Note: + * GXL and GXBB have different SDM_EN registers. We + * fallback to the global naming string mechanism so + * mpll0_div picks up the appropriate one. + */ + .name =3D "mpll0_div", + .index =3D -1, + }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, }, @@ -3036,7 +3074,7 @@ static struct clk_hw_onecell_data gxl_hw_onecell_data= =3D { [CLKID_VAPB_1] =3D &gxbb_vapb_1.hw, [CLKID_VAPB_SEL] =3D &gxbb_vapb_sel.hw, [CLKID_VAPB] =3D &gxbb_vapb.hw, - [CLKID_MPLL0_DIV] =3D &gxbb_mpll0_div.hw, + [CLKID_MPLL0_DIV] =3D &gxl_mpll0_div.hw, [CLKID_MPLL1_DIV] =3D &gxbb_mpll1_div.hw, [CLKID_MPLL2_DIV] =3D &gxbb_mpll2_div.hw, [CLKID_MPLL_PREDIV] =3D &gxbb_mpll_prediv.hw, @@ -3430,7 +3468,7 @@ static struct clk_regmap *const gxl_clk_regmaps[] =3D= { &gxbb_mpll0, &gxbb_mpll1, &gxbb_mpll2, - &gxbb_mpll0_div, + &gxl_mpll0_div, &gxbb_mpll1_div, &gxbb_mpll2_div, &gxbb_cts_amclk_div, --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1B92C433EF for ; Mon, 24 Jan 2022 19:48:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356088AbiAXTpM (ORCPT ); Mon, 24 Jan 2022 14:45:12 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58162 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354238AbiAXTgS (ORCPT ); Mon, 24 Jan 2022 14:36:18 -0500 Received: from smtp.kernel.org (relay.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 2AD13B8123F; Mon, 24 Jan 2022 19:36:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C1FCC340E5; Mon, 24 Jan 2022 19:36:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052974; bh=Y9TME6GlDVGP6wYbQYgCTOaBbsZDcv5Z3Juog3mJdW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z84osmP1Hq/rz7cZLGAYfAfeBHbq7mDXgbis3VgbkVwmEThBU1REOnfRltPaxWjm+ hcOd3PxV7uyN9HUdq7ABEDAng9kwrBuIJg7MPsgqGwz6Vy+q6dh7zudNOcPTHGUOiI 7sV+MOUX7Ml2XlS759bD44+n1UO/5bCh/1WzyAhc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Erhard Furtner , Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 233/320] powerpc/powermac: Add missing lockdep_register_key() Date: Mon, 24 Jan 2022 19:43:37 +0100 Message-Id: <20220124184001.905370240@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy [ Upstream commit df1f679d19edb9eeb67cc2f96b29375f21991945 ] KeyWest i2c @0xf8001003 irq 42 /uni-n@f8000000/i2c@f8001000 BUG: key c2d00cbc has not been registered! Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee ------------[ cut here ]------------ DEBUG_LOCKS_WARN_ON(1) WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:4801 lockdep_init_map_ty= pe+0x4c0/0xb4c Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.5-gentoo-PowerMacG4 #9 NIP: c01a9428 LR: c01a9428 CTR: 00000000 REGS: e1033cf0 TRAP: 0700 Not tainted (5.15.5-gentoo-PowerMacG4) MSR: 00029032 CR: 24002002 XER: 00000000 GPR00: c01a9428 e1033db0 c2d1cf20 00000016 00000004 00000001 c01c0630 e1033= a73 GPR08: 00000000 00000000 00000000 e1033db0 24002004 00000000 f8729377 00000= 003 GPR16: c1829a9c 00000000 18305357 c1416fc0 c1416f80 c006ac60 c2d00ca8 c1416= f00 GPR24: 00000000 c21586f0 c2160000 00000000 c2d00cbc c2170000 c216e1a0 c2160= 000 NIP [c01a9428] lockdep_init_map_type+0x4c0/0xb4c LR [c01a9428] lockdep_init_map_type+0x4c0/0xb4c Call Trace: [e1033db0] [c01a9428] lockdep_init_map_type+0x4c0/0xb4c (unreliable) [e1033df0] [c1c177b8] kw_i2c_add+0x334/0x424 [e1033e20] [c1c18294] pmac_i2c_init+0x9ec/0xa9c [e1033e80] [c1c1a790] smp_core99_probe+0xbc/0x35c [e1033eb0] [c1c03cb0] kernel_init_freeable+0x190/0x5a4 [e1033f10] [c000946c] kernel_init+0x28/0x154 [e1033f30] [c0035148] ret_from_kernel_thread+0x14/0x1c Add missing lockdep_register_key() Reported-by: Erhard Furtner Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/69e4f55565bb45ebb0843977801b245af0c666fe.16= 38264741.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin --- arch/powerpc/platforms/powermac/low_i2c.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platf= orms/powermac/low_i2c.c index a366233d8ac2d..210435a43bf95 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c @@ -582,6 +582,7 @@ static void __init kw_i2c_add(struct pmac_i2c_host_kw *= host, bus->close =3D kw_i2c_close; bus->xfer =3D kw_i2c_xfer; mutex_init(&bus->mutex); + lockdep_register_key(&bus->lock_key); lockdep_set_class(&bus->mutex, &bus->lock_key); if (controller =3D=3D busnode) bus->flags =3D pmac_i2c_multibus; --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66AD9C433F5 for ; Mon, 24 Jan 2022 20:33:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385658AbiAXUdx (ORCPT ); Mon, 24 Jan 2022 15:33:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355430AbiAXUNj (ORCPT ); Mon, 24 Jan 2022 15:13:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EB48C06176A; Mon, 24 Jan 2022 11:36:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A0FEA6141C; Mon, 24 Jan 2022 19:36:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57271C340E5; Mon, 24 Jan 2022 19:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052978; bh=DJwUah2wb4mGa/stOhablhtuouRRLYBx1Hq4he3e6dE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2syqsrfWaeeXOk6P5o37PNNaf6m2JyPBV22UXoUegp2TIxoTpaBK2wnno5ih4g1EG D0Bmsd55mq2HSIuWDFiVI64y/rqHTHImQKP8kkSYJ+nMXQmPBufklyM9JbWw6nExk8 Cpfp7mHNdMfRA5pQzAsbpTlenlgQIGentScrPVRs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kardashevskiy , Fabiano Rosas , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 234/320] KVM: PPC: Book3S: Suppress failed alloc warning in H_COPY_TOFROM_GUEST Date: Mon, 24 Jan 2022 19:43:38 +0100 Message-Id: <20220124184001.940082249@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexey Kardashevskiy [ Upstream commit 792020907b11c6f9246c21977cab3bad985ae4b6 ] H_COPY_TOFROM_GUEST is an hcall for an upper level VM to access its nested VMs memory. The userspace can trigger WARN_ON_ONCE(!(gfp & __GFP_NOWARN)) in __alloc_pages() by constructing a tiny VM which only does H_COPY_TOFROM_GUEST with a too big GPR9 (number of bytes to copy). This silences the warning by adding __GFP_NOWARN. Spotted by syzkaller. Signed-off-by: Alexey Kardashevskiy Reviewed-by: Fabiano Rosas Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20210901084550.1658699-1-aik@ozlabs.ru Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/powerpc/kvm/book3s_hv_nested.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_= hv_nested.c index 9906d203d9d39..613d24b707abe 100644 --- a/arch/powerpc/kvm/book3s_hv_nested.c +++ b/arch/powerpc/kvm/book3s_hv_nested.c @@ -510,7 +510,7 @@ long kvmhv_copy_tofrom_guest_nested(struct kvm_vcpu *vc= pu) if (eaddr & (0xFFFUL << 52)) return H_PARAMETER; =20 - buf =3D kzalloc(n, GFP_KERNEL); + buf =3D kzalloc(n, GFP_KERNEL | __GFP_NOWARN); if (!buf) return H_NO_MEM; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6C75C433F5 for ; Mon, 24 Jan 2022 20:38:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385809AbiAXUeg (ORCPT ); Mon, 24 Jan 2022 15:34:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355438AbiAXUNl (ORCPT ); Mon, 24 Jan 2022 15:13:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75D8CC061777; Mon, 24 Jan 2022 11:36:23 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F5D8B81240; Mon, 24 Jan 2022 19:36:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7139CC340E5; Mon, 24 Jan 2022 19:36:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052981; bh=eIli/jZZdbrp+7cIzVhZHbCgnb9mpafPIXG0izMYOVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zE27nK49nnXFx/96M1VM1Iz8gMlO3RI+SsQKd/vFnt0fdb/Ecc6ELmEdREGpjFxZ3 Qo0+YPZ/DzX1O84KhGg0REyp2V9zkz+r9HU9XAH8Y4cqY/kDWgErQlxBVVmWfAYjLK GwtZHWRPQO/tVFNt7u08dl7UqjdISAHN4Xu8bzLQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Christophe Leroy , Sasha Levin Subject: [PATCH 5.4 235/320] w1: Misuse of get_user()/put_user() reported by sparse Date: Mon, 24 Jan 2022 19:43:39 +0100 Message-Id: <20220124184001.980402858@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy [ Upstream commit 33dc3e3e99e626ce51f462d883b05856c6c30b1d ] sparse warnings: (new ones prefixed by >>) >> drivers/w1/slaves/w1_ds28e04.c:342:13: sparse: sparse: incorrect type in= initializer (different address spaces) @@ expected char [noderef] __us= er *_pu_addr @@ got char *buf @@ drivers/w1/slaves/w1_ds28e04.c:342:13: sparse: expected char [nodere= f] __user *_pu_addr drivers/w1/slaves/w1_ds28e04.c:342:13: sparse: got char *buf >> drivers/w1/slaves/w1_ds28e04.c:356:13: sparse: sparse: incorrect type in= initializer (different address spaces) @@ expected char const [noderef= ] __user *_gu_addr @@ got char const *buf @@ drivers/w1/slaves/w1_ds28e04.c:356:13: sparse: expected char const [= noderef] __user *_gu_addr drivers/w1/slaves/w1_ds28e04.c:356:13: sparse: got char const *buf The buffer buf is a failsafe buffer in kernel space, it's not user memory hence doesn't deserve the use of get_user() or put_user(). Access 'buf' content directly. Link: https://lore.kernel.org/lkml/202111190526.K5vb7NWC-lkp@intel.com/T/ Reported-by: kernel test robot Signed-off-by: Christophe Leroy Link: https://lore.kernel.org/r/d14ed8d71ad4372e6839ae427f91441d3ba0e94d.16= 37946316.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/w1/slaves/w1_ds28e04.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/drivers/w1/slaves/w1_ds28e04.c b/drivers/w1/slaves/w1_ds28e04.c index 8a640f1590784..06a9966f8c933 100644 --- a/drivers/w1/slaves/w1_ds28e04.c +++ b/drivers/w1/slaves/w1_ds28e04.c @@ -32,7 +32,7 @@ static int w1_strong_pullup =3D 1; module_param_named(strong_pullup, w1_strong_pullup, int, 0); =20 /* enable/disable CRC checking on DS28E04-100 memory accesses */ -static char w1_enable_crccheck =3D 1; +static bool w1_enable_crccheck =3D true; =20 #define W1_EEPROM_SIZE 512 #define W1_PAGE_COUNT 16 @@ -339,32 +339,18 @@ static BIN_ATTR_RW(pio, 1); static ssize_t crccheck_show(struct device *dev, struct device_attribute *= attr, char *buf) { - if (put_user(w1_enable_crccheck + 0x30, buf)) - return -EFAULT; - - return sizeof(w1_enable_crccheck); + return sysfs_emit(buf, "%d\n", w1_enable_crccheck); } =20 static ssize_t crccheck_store(struct device *dev, struct device_attribute = *attr, const char *buf, size_t count) { - char val; - - if (count !=3D 1 || !buf) - return -EINVAL; + int err =3D kstrtobool(buf, &w1_enable_crccheck); =20 - if (get_user(val, buf)) - return -EFAULT; + if (err) + return err; =20 - /* convert to decimal */ - val =3D val - 0x30; - if (val !=3D 0 && val !=3D 1) - return -EINVAL; - - /* set the new value */ - w1_enable_crccheck =3D val; - - return sizeof(w1_enable_crccheck); + return count; } =20 static DEVICE_ATTR_RW(crccheck); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DF3AC2BA4C for ; Mon, 24 Jan 2022 20:38:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386032AbiAXUe5 (ORCPT ); Mon, 24 Jan 2022 15:34:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355441AbiAXUNl (ORCPT ); Mon, 24 Jan 2022 15:13:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD9EAC06177A; Mon, 24 Jan 2022 11:36:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 648BAB81239; Mon, 24 Jan 2022 19:36:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73F75C340E5; Mon, 24 Jan 2022 19:36:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052984; bh=kH5gr8b1BThPsKuYxjw5b3QRMMbMoAjYI1p+XaHELZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F/BGVKbcV9gazL3A9YkDNEwukInEL3wlfr/PgQ6bpxQcqLSW7x9dWxcFGGzvdUHID 8qtOLaEfmlIxs/UERMhW5NSsPb8b2y1/d14xm1E80VEIt0sdwoCOiq7561iCvl3Bg/ 63l+66xEQlh/+OMRmuSlt9ER2u4+4TVCVnzYuwlw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.4 236/320] scsi: lpfc: Trigger SLI4 firmware dump before doing driver cleanup Date: Mon, 24 Jan 2022 19:43:40 +0100 Message-Id: <20220124184002.011801274@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit 7dd2e2a923173d637c272e483966be8e96a72b64 ] Extraneous teardown routines are present in the firmware dump path causing altered states in firmware captures. When a firmware dump is requested via sysfs, trigger the dump immediately without tearing down structures and changing adapter state. The driver shall rely on pre-existing firmware error state clean up handlers to restore the adapter. Link: https://lore.kernel.org/r/20211204002644.116455-6-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/scsi/lpfc/lpfc.h | 2 +- drivers/scsi/lpfc/lpfc_attr.c | 62 ++++++++++++++++++++------------ drivers/scsi/lpfc/lpfc_hbadisc.c | 8 ++++- drivers/scsi/lpfc/lpfc_sli.c | 6 ---- 4 files changed, 48 insertions(+), 30 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 8943d42fc406e..0b69f4f713778 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -735,7 +735,6 @@ struct lpfc_hba { #define HBA_DEVLOSS_TMO 0x2000 /* HBA in devloss timeout */ #define HBA_RRQ_ACTIVE 0x4000 /* process the rrq active list */ #define HBA_IOQ_FLUSH 0x8000 /* FCP/NVME I/O queues being flushed */ -#define HBA_FW_DUMP_OP 0x10000 /* Skips fn reset before FW dump */ #define HBA_RECOVERABLE_UE 0x20000 /* Firmware supports recoverable UE */ #define HBA_FORCED_LINK_SPEED 0x40000 /* * Firmware supports Forced Link Speed @@ -744,6 +743,7 @@ struct lpfc_hba { #define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */ #define HBA_DEFER_FLOGI 0x800000 /* Defer FLOGI till read_sparm cmpl */ =20 + struct completion *fw_dump_cmpl; /* cmpl event tracker for fw_dump */ uint32_t fcp_ring_in_use; /* When polling test if intr-hndlr active*/ struct lpfc_dmabuf slim2p; =20 diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index f0ecfe565660a..1c541a600149b 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -1537,25 +1537,25 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, u= int32_t opcode) before_fc_flag =3D phba->pport->fc_flag; sriov_nr_virtfn =3D phba->cfg_sriov_nr_virtfn; =20 - /* Disable SR-IOV virtual functions if enabled */ - if (phba->cfg_sriov_nr_virtfn) { - pci_disable_sriov(pdev); - phba->cfg_sriov_nr_virtfn =3D 0; - } + if (opcode =3D=3D LPFC_FW_DUMP) { + init_completion(&online_compl); + phba->fw_dump_cmpl =3D &online_compl; + } else { + /* Disable SR-IOV virtual functions if enabled */ + if (phba->cfg_sriov_nr_virtfn) { + pci_disable_sriov(pdev); + phba->cfg_sriov_nr_virtfn =3D 0; + } =20 - if (opcode =3D=3D LPFC_FW_DUMP) - phba->hba_flag |=3D HBA_FW_DUMP_OP; + status =3D lpfc_do_offline(phba, LPFC_EVT_OFFLINE); =20 - status =3D lpfc_do_offline(phba, LPFC_EVT_OFFLINE); + if (status !=3D 0) + return status; =20 - if (status !=3D 0) { - phba->hba_flag &=3D ~HBA_FW_DUMP_OP; - return status; + /* wait for the device to be quiesced before firmware reset */ + msleep(100); } =20 - /* wait for the device to be quiesced before firmware reset */ - msleep(100); - reg_val =3D readl(phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); =20 @@ -1584,24 +1584,42 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, u= int32_t opcode) lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "3153 Fail to perform the requested " "access: x%x\n", reg_val); + if (phba->fw_dump_cmpl) + phba->fw_dump_cmpl =3D NULL; return rc; } =20 /* keep the original port state */ - if (before_fc_flag & FC_OFFLINE_MODE) - goto out; - - init_completion(&online_compl); - job_posted =3D lpfc_workq_post_event(phba, &status, &online_compl, - LPFC_EVT_ONLINE); - if (!job_posted) + if (before_fc_flag & FC_OFFLINE_MODE) { + if (phba->fw_dump_cmpl) + phba->fw_dump_cmpl =3D NULL; goto out; + } =20 - wait_for_completion(&online_compl); + /* Firmware dump will trigger an HA_ERATT event, and + * lpfc_handle_eratt_s4 routine already handles bringing the port back + * online. + */ + if (opcode =3D=3D LPFC_FW_DUMP) { + wait_for_completion(phba->fw_dump_cmpl); + } else { + init_completion(&online_compl); + job_posted =3D lpfc_workq_post_event(phba, &status, &online_compl, + LPFC_EVT_ONLINE); + if (!job_posted) + goto out; =20 + wait_for_completion(&online_compl); + } out: /* in any case, restore the virtual functions enabled as before */ if (sriov_nr_virtfn) { + /* If fw_dump was performed, first disable to clean up */ + if (opcode =3D=3D LPFC_FW_DUMP) { + pci_disable_sriov(pdev); + phba->cfg_sriov_nr_virtfn =3D 0; + } + sriov_err =3D lpfc_sli_probe_sriov_nr_virtfn(phba, sriov_nr_virtfn); if (!sriov_err) diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbad= isc.c index 0dc1d56ff4709..0abce779fbb13 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -628,10 +628,16 @@ lpfc_work_done(struct lpfc_hba *phba) if (phba->pci_dev_grp =3D=3D LPFC_PCI_DEV_OC) lpfc_sli4_post_async_mbox(phba); =20 - if (ha_copy & HA_ERATT) + if (ha_copy & HA_ERATT) { /* Handle the error attention event */ lpfc_handle_eratt(phba); =20 + if (phba->fw_dump_cmpl) { + complete(phba->fw_dump_cmpl); + phba->fw_dump_cmpl =3D NULL; + } + } + if (ha_copy & HA_MBATT) lpfc_sli_handle_mb_event(phba); =20 diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 51bab0979527b..bd908dd273078 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -4498,12 +4498,6 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba) phba->fcf.fcf_flag =3D 0; spin_unlock_irq(&phba->hbalock); =20 - /* SLI4 INTF 2: if FW dump is being taken skip INIT_PORT */ - if (phba->hba_flag & HBA_FW_DUMP_OP) { - phba->hba_flag &=3D ~HBA_FW_DUMP_OP; - return rc; - } - /* Now physically reset the device */ lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0389 Performing PCI function reset!\n"); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A152C433EF for ; Mon, 24 Jan 2022 20:39:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388535AbiAXUjL (ORCPT ); Mon, 24 Jan 2022 15:39:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355301AbiAXUSF (ORCPT ); Mon, 24 Jan 2022 15:18:05 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1B85C0A893D; Mon, 24 Jan 2022 11:38:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5043F6153A; Mon, 24 Jan 2022 19:38:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2318AC340E5; Mon, 24 Jan 2022 19:38:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053109; bh=khj1TPKAGtqZ8SRnFW3L1kpEHrsWYchWuXRxLdSbLMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pyl1MVjUxR8JMIfZNRyFtJZXhWi7AdZoaeF95FqTu152HIJ27N8dPJ+yBqowcZufK eOpHzIh1qIOan2nYGZn7bpP4r0n0wDbpgvUfZQ8n8KFgDpcVYVQkDfpbxB/8wUe+Ny BJZss1dW0+oR295n6S6s7dcqsGdHvZsLVkzjIGZw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zqiang , syzbot+bb950e68b400ab4f65f8@syzkaller.appspotmail.com, Takashi Iwai , Sasha Levin Subject: [PATCH 5.4 237/320] ALSA: seq: Set upper limit of processed events Date: Mon, 24 Jan 2022 19:43:41 +0100 Message-Id: <20220124184002.049031441@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit 6fadb494a638d8b8a55864ecc6ac58194f03f327 ] Currently ALSA sequencer core tries to process the queued events as much as possible when they become dispatchable. If applications try to queue too massive events to be processed at the very same timing, the sequencer core would still try to process such all events, either in the interrupt context or via some notifier; in either away, it might be a cause of RCU stall or such problems. As a potential workaround for those problems, this patch adds the upper limit of the amount of events to be processed. The remaining events are processed in the next batch, so they won't be lost. For the time being, it's limited up to 1000 events per queue, which should be high enough for any normal usages. Reported-by: Zqiang Reported-by: syzbot+bb950e68b400ab4f65f8@syzkaller.appspotmail.com Link: https://lore.kernel.org/r/20211102033222.3849-1-qiang.zhang1211@gmail= .com Link: https://lore.kernel.org/r/20211207165146.2888-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- sound/core/seq/seq_queue.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c index 71a6ea62c3be7..4ff0b927230c2 100644 --- a/sound/core/seq/seq_queue.c +++ b/sound/core/seq/seq_queue.c @@ -234,12 +234,15 @@ struct snd_seq_queue *snd_seq_queue_find_name(char *n= ame) =20 /* -------------------------------------------------------- */ =20 +#define MAX_CELL_PROCESSES_IN_QUEUE 1000 + void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) { unsigned long flags; struct snd_seq_event_cell *cell; snd_seq_tick_time_t cur_tick; snd_seq_real_time_t cur_time; + int processed =3D 0; =20 if (q =3D=3D NULL) return; @@ -262,6 +265,8 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int a= tomic, int hop) if (!cell) break; snd_seq_dispatch_event(cell, atomic, hop); + if (++processed >=3D MAX_CELL_PROCESSES_IN_QUEUE) + goto out; /* the rest processed at the next batch */ } =20 /* Process time queue... */ @@ -271,14 +276,19 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int= atomic, int hop) if (!cell) break; snd_seq_dispatch_event(cell, atomic, hop); + if (++processed >=3D MAX_CELL_PROCESSES_IN_QUEUE) + goto out; /* the rest processed at the next batch */ } =20 + out: /* free lock */ spin_lock_irqsave(&q->check_lock, flags); if (q->check_again) { q->check_again =3D 0; - spin_unlock_irqrestore(&q->check_lock, flags); - goto __again; + if (processed < MAX_CELL_PROCESSES_IN_QUEUE) { + spin_unlock_irqrestore(&q->check_lock, flags); + goto __again; + } } q->check_blocked =3D 0; spin_unlock_irqrestore(&q->check_lock, flags); --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3343CC433EF for ; Mon, 24 Jan 2022 19:48:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239752AbiAXTrw (ORCPT ); Mon, 24 Jan 2022 14:47:52 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58390 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354593AbiAXTgu (ORCPT ); Mon, 24 Jan 2022 14:36:50 -0500 Received: from smtp.kernel.org (relay.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 C7F4FB81229; Mon, 24 Jan 2022 19:36:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E17A4C340E5; Mon, 24 Jan 2022 19:36:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053007; bh=+4Y45NR2lyzG41zk6KY232Sml1e0lHoiQZKzYnmhRPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IkT13YGt2JSQZs78+o4bBK6HiXy0YMsbysQIhIv9A7ddgjNMJaqchQxSXcWCED2R1 UhWsPlJzYfK8eQUpjb3J4DALJbF7/Y5O+6rpMWa9dcVZcuinALaORJj3p2t4WbgPm9 zTe6/je2d6IlCwmaFe79vC6RtJ85NcUXmkArh5bw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Hari Bathini , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 238/320] powerpc: handle kdump appropriately with crash_kexec_post_notifiers option Date: Mon, 24 Jan 2022 19:43:42 +0100 Message-Id: <20220124184002.088618195@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hari Bathini [ Upstream commit 219572d2fc4135b5ce65c735d881787d48b10e71 ] Kdump can be triggered after panic_notifers since commit f06e5153f4ae2 ("kernel/panic.c: add "crash_kexec_post_notifiers" option for kdump after panic_notifers") introduced crash_kexec_post_notifiers option. But using this option would mean smp_send_stop(), that marks all other CPUs as offline, gets called before kdump is triggered. As a result, kdump routines fail to save other CPUs' registers. To fix this, kdump friendly crash_smp_send_stop() function was introduced with kernel commit 0ee59413c967 ("x86/panic: replace smp_send_stop() with kdump friendly version in panic path"). Override this kdump friendly weak function to handle crash_kexec_post_notifiers option appropriately on powerpc. Reported-by: kernel test robot Signed-off-by: Hari Bathini [Fixed signature of crash_stop_this_cpu() - reported by lkp@intel.com] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211207103719.91117-1-hbathini@linux.ibm.c= om Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/powerpc/kernel/smp.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 82dff003a7fd6..4de63ec2e1551 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -582,6 +582,36 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct = pt_regs *)) } #endif =20 +#ifdef CONFIG_NMI_IPI +static void crash_stop_this_cpu(struct pt_regs *regs) +#else +static void crash_stop_this_cpu(void *dummy) +#endif +{ + /* + * Just busy wait here and avoid marking CPU as offline to ensure + * register data is captured appropriately. + */ + while (1) + cpu_relax(); +} + +void crash_smp_send_stop(void) +{ + static bool stopped =3D false; + + if (stopped) + return; + + stopped =3D true; + +#ifdef CONFIG_NMI_IPI + smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, crash_stop_this_cpu, 1000000); +#else + smp_call_function(crash_stop_this_cpu, NULL, 0); +#endif /* CONFIG_NMI_IPI */ +} + #ifdef CONFIG_NMI_IPI static void nmi_stop_this_cpu(struct pt_regs *regs) { --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76EA7C433F5 for ; Mon, 24 Jan 2022 20:01:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376443AbiAXUBq (ORCPT ); Mon, 24 Jan 2022 15:01:46 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34880 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352064AbiAXThW (ORCPT ); Mon, 24 Jan 2022 14:37:22 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5DB9D6153C; Mon, 24 Jan 2022 19:37:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C913C34106; Mon, 24 Jan 2022 19:37:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053039; bh=DgL0M9pJ+5hLvwUAh76NXDtoQtsqUyxfMwlZsYc7D1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p92n6uhRTGDEcdnRZ8ekt0nGqU3vh7Rj8VqKRxTtrpuoX/ycpjifppOUGS3vQxOim Y6rmS444GAZPFFMNYZoTbHtBsj8TuqyjjiNeXwbCmIvfUdqxymAGKc1VI8tL9klv9P FVf59je3EEjbgxLL8wCJ3QGn1X9cHrNn/IjiMgsw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Ye Guojin , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.4 239/320] MIPS: OCTEON: add put_device() after of_find_device_by_node() Date: Mon, 24 Jan 2022 19:43:43 +0100 Message-Id: <20220124184002.119676205@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ye Guojin [ Upstream commit 858779df1c0787d3fec827fb705708df9ebdb15b ] This was found by coccicheck: ./arch/mips/cavium-octeon/octeon-platform.c, 332, 1-7, ERROR missing put_device; call of_find_device_by_node on line 324, but without a corresponding object release within this function. ./arch/mips/cavium-octeon/octeon-platform.c, 395, 1-7, ERROR missing put_device; call of_find_device_by_node on line 387, but without a corresponding object release within this function. ./arch/mips/cavium-octeon/octeon-usb.c, 512, 3-9, ERROR missing put_device; call of_find_device_by_node on line 515, but without a corresponding object release within this function. ./arch/mips/cavium-octeon/octeon-usb.c, 543, 1-7, ERROR missing put_device; call of_find_device_by_node on line 515, but without a corresponding object release within this function. Reported-by: Zeal Robot Signed-off-by: Ye Guojin Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/mips/cavium-octeon/octeon-platform.c | 2 ++ arch/mips/cavium-octeon/octeon-usb.c | 1 + 2 files changed, 3 insertions(+) diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-o= cteon/octeon-platform.c index 51685f893eab0..c214fe4e678bb 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -328,6 +328,7 @@ static int __init octeon_ehci_device_init(void) =20 pd->dev.platform_data =3D &octeon_ehci_pdata; octeon_ehci_hw_start(&pd->dev); + put_device(&pd->dev); =20 return ret; } @@ -391,6 +392,7 @@ static int __init octeon_ohci_device_init(void) =20 pd->dev.platform_data =3D &octeon_ohci_pdata; octeon_ohci_hw_start(&pd->dev); + put_device(&pd->dev); =20 return ret; } diff --git a/arch/mips/cavium-octeon/octeon-usb.c b/arch/mips/cavium-octeon= /octeon-usb.c index 4017398519cf9..e092d86e63581 100644 --- a/arch/mips/cavium-octeon/octeon-usb.c +++ b/arch/mips/cavium-octeon/octeon-usb.c @@ -544,6 +544,7 @@ static int __init dwc3_octeon_device_init(void) devm_iounmap(&pdev->dev, base); devm_release_mem_region(&pdev->dev, res->start, resource_size(res)); + put_device(&pdev->dev); } } while (node !=3D NULL); =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C614FC433EF for ; Mon, 24 Jan 2022 20:01:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344135AbiAXUBL (ORCPT ); Mon, 24 Jan 2022 15:01:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59048 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354774AbiAXTh4 (ORCPT ); Mon, 24 Jan 2022 14:37:56 -0500 Received: from smtp.kernel.org (relay.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 13C6DB8124C; Mon, 24 Jan 2022 19:37:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D1D6C340E5; Mon, 24 Jan 2022 19:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053073; bh=esUmQol+H/4d9Hgo8Aa5Ag4uakS/BpjuUbGvpirtm4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EQbMB21ncrpR77OT/C4XuM1nOrneLfNMzhL6XnTIUlHTz7y415pmiP0TfHYvoMHgO fSbz5hsuGcEoV/qN/3q5EsliWv4F+fI36cOYXkDwDrsD8M4GkkKGE4if4vnxhkd/2Y q1yJJL8yROzqYXDBz4i3CNwXOMr8nN1iOVWGN0No= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , Lakshmi Sowjanya D , Andy Shevchenko , Jarkko Nikula , Sasha Levin Subject: [PATCH 5.4 240/320] i2c: designware-pci: Fix to change data types of hcnt and lcnt parameters Date: Mon, 24 Jan 2022 19:43:44 +0100 Message-Id: <20220124184002.149396816@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lakshmi Sowjanya D [ Upstream commit d52097010078c1844348dc0e467305e5f90fd317 ] The data type of hcnt and lcnt in the struct dw_i2c_dev is of type u16. It's better to have same data type in struct dw_scl_sda_cfg as well. Reported-by: Wolfram Sang Signed-off-by: Lakshmi Sowjanya D Signed-off-by: Andy Shevchenko Signed-off-by: Jarkko Nikula Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/i2c/busses/i2c-designware-pcidrv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busse= s/i2c-designware-pcidrv.c index 05b35ac33ce33..735326e5eb8cf 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -37,10 +37,10 @@ enum dw_pci_ctl_id_t { }; =20 struct dw_scl_sda_cfg { - u32 ss_hcnt; - u32 fs_hcnt; - u32 ss_lcnt; - u32 fs_lcnt; + u16 ss_hcnt; + u16 fs_hcnt; + u16 ss_lcnt; + u16 fs_lcnt; u32 sda_hold; }; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F5BDC433EF for ; Mon, 24 Jan 2022 20:41:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388784AbiAXUkG (ORCPT ); Mon, 24 Jan 2022 15:40:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380332AbiAXUQK (ORCPT ); Mon, 24 Jan 2022 15:16:10 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44438C01D7E0; Mon, 24 Jan 2022 11:38:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D4CF96154A; Mon, 24 Jan 2022 19:38:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2FA2C340E5; Mon, 24 Jan 2022 19:38:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053091; bh=Qf6XnIzeElSZlaTPE0+w9iFReX52uTDmquC2axMPOMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OTcGpv+U3vVVMP6IptEVcSy1u6Ww2b9VSEUNdUwwDExXm5ETLYAJTE9aDu6CsiYG7 vjmlBTOKXcxL4PEJASqJkZCmC+eDg4N/+yz8+RBvIOz9/2NPad9aHSjJb8CXAGQFKr em5b4fj8yplrQJLP1NeeJ12QmI4lsDTl6fcZPO5k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianjia Zhang , Nathan Chancellor , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.4 241/320] MIPS: Octeon: Fix build errors using clang Date: Mon, 24 Jan 2022 19:43:45 +0100 Message-Id: <20220124184002.188735294@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Tianjia Zhang [ Upstream commit 95339b70677dc6f9a2d669c4716058e71b8dc1c7 ] A large number of the following errors is reported when compiling with clang: cvmx-bootinfo.h:326:3: error: adding 'int' to a string does not append to= the string [-Werror,-Wstring-plus-int] ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NULL) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cvmx-bootinfo.h:321:20: note: expanded from macro 'ENUM_BRD_TYPE_CASE' case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ ~~~^~~~ cvmx-bootinfo.h:326:3: note: use array indexing to silence this warning cvmx-bootinfo.h:321:20: note: expanded from macro 'ENUM_BRD_TYPE_CASE' case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ ^ Follow the prompts to use the address operator '&' to fix this error. Signed-off-by: Tianjia Zhang Reviewed-by: Nathan Chancellor Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/mips/include/asm/octeon/cvmx-bootinfo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/asm/octeon/cvmx-bootinfo.h b/arch/mips/inclu= de/asm/octeon/cvmx-bootinfo.h index 62787765575ef..ce6e5fddce0bf 100644 --- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h +++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h @@ -315,7 +315,7 @@ enum cvmx_chip_types_enum { =20 /* Functions to return string based on type */ #define ENUM_BRD_TYPE_CASE(x) \ - case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ + case x: return (&#x[16]); /* Skip CVMX_BOARD_TYPE_ */ static inline const char *cvmx_board_type_to_string(enum cvmx_board_types_enum type) { @@ -404,7 +404,7 @@ static inline const char *cvmx_board_type_to_string(enum } =20 #define ENUM_CHIP_TYPE_CASE(x) \ - case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */ + case x: return (&#x[15]); /* Skip CVMX_CHIP_TYPE */ static inline const char *cvmx_chip_type_to_string(enum cvmx_chip_types_enum type) { --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E5A8C433F5 for ; Mon, 24 Jan 2022 19:48:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349985AbiAXTse (ORCPT ); Mon, 24 Jan 2022 14:48:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35730 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348643AbiAXTiP (ORCPT ); Mon, 24 Jan 2022 14:38:15 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A844D6152B; Mon, 24 Jan 2022 19:38:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CFEFC340E5; Mon, 24 Jan 2022 19:38:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053094; bh=SO3cHiV5I28ThnTZPDoMcc4LPiomENv4E0MOcsvj+qg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g/AjQLa+O5bQuEBXygm/0vpXJSucQDiue2/kWWR7YqtoOHxJtivrwPG9S+aDijxke 1DDNKWg5zW8GthO2uWgro/y3FJC2lTlSnyOsf3SCykRGp6xPwjg9YmpAFzX2rahahc 5RdGxVoAsMlGs/ibOu0SGIIpY/0jg1IyQMVJ6exM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baoquan He , Christoph Hellwig , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.4 242/320] scsi: sr: Dont use GFP_DMA Date: Mon, 24 Jan 2022 19:43:46 +0100 Message-Id: <20220124184002.221437620@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit d94d94969a4ba07a43d62429c60372320519c391 ] The allocated buffers are used as a command payload, for which the block layer and/or DMA API do the proper bounce buffering if needed. Link: https://lore.kernel.org/r/20211222090842.920724-1-hch@lst.de Reported-by: Baoquan He Reviewed-by: Baoquan He Signed-off-by: Christoph Hellwig Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/scsi/sr.c | 2 +- drivers/scsi/sr_vendor.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 279dea628620d..310da62cda263 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -887,7 +887,7 @@ static void get_capabilities(struct scsi_cd *cd) =20 =20 /* allocate transfer buffer */ - buffer =3D kmalloc(512, GFP_KERNEL | GFP_DMA); + buffer =3D kmalloc(512, GFP_KERNEL); if (!buffer) { sr_printk(KERN_ERR, cd, "out of memory.\n"); return; diff --git a/drivers/scsi/sr_vendor.c b/drivers/scsi/sr_vendor.c index b9db2ec6d0361..996bccadd3866 100644 --- a/drivers/scsi/sr_vendor.c +++ b/drivers/scsi/sr_vendor.c @@ -113,7 +113,7 @@ int sr_set_blocklength(Scsi_CD *cd, int blocklength) if (cd->vendor =3D=3D VENDOR_TOSHIBA) density =3D (blocklength > 2048) ? 0x81 : 0x83; =20 - buffer =3D kmalloc(512, GFP_KERNEL | GFP_DMA); + buffer =3D kmalloc(512, GFP_KERNEL); if (!buffer) return -ENOMEM; =20 @@ -161,7 +161,7 @@ int sr_cd_check(struct cdrom_device_info *cdi) if (cd->cdi.mask & CDC_MULTI_SESSION) return 0; =20 - buffer =3D kmalloc(512, GFP_KERNEL | GFP_DMA); + buffer =3D kmalloc(512, GFP_KERNEL); if (!buffer) return -ENOMEM; =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3142AC433F5 for ; Mon, 24 Jan 2022 19:49:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350553AbiAXTsu (ORCPT ); Mon, 24 Jan 2022 14:48:50 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59342 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348676AbiAXTiU (ORCPT ); Mon, 24 Jan 2022 14:38:20 -0500 Received: from smtp.kernel.org (relay.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 28A60B810AF; Mon, 24 Jan 2022 19:38:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FCBEC340E5; Mon, 24 Jan 2022 19:38:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053096; bh=IsB6GP+yJnWzUkvkzrdDk9FmxGEtrdhq6Spim46u5qY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H1W8TrEx1SAI7kSJTQmqbYDqAkDRNNpGW0WHf/HcqzcUspol/iXUF+jhruR68ZAgq wiPb7xMvKyotpMJqxy4ZgHIhg+MeQOcDXXZO19o02NmQVNlyVUI+soceDp2IHTQsbS FC/tmiTsWd8kKguHN9layYWUmSCMvut4FFdLjl/I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tzung-Bi Shih , Mark Brown , Sasha Levin Subject: [PATCH 5.4 243/320] ASoC: mediatek: mt8173: fix device_node leak Date: Mon, 24 Jan 2022 19:43:47 +0100 Message-Id: <20220124184002.252762017@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tzung-Bi Shih [ Upstream commit 493433785df0075afc0c106ab65f10a605d0b35d ] Fixes the device_node leak. Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20211224064719.2031210-2-tzungbi@google.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- sound/soc/mediatek/mt8173/mt8173-max98090.c | 3 +++ sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | 2 ++ sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 2 ++ sound/soc/mediatek/mt8173/mt8173-rt5650.c | 2 ++ 4 files changed, 9 insertions(+) diff --git a/sound/soc/mediatek/mt8173/mt8173-max98090.c b/sound/soc/mediat= ek/mt8173/mt8173-max98090.c index 22c00600c999f..de1410c2c446f 100644 --- a/sound/soc/mediatek/mt8173/mt8173-max98090.c +++ b/sound/soc/mediatek/mt8173/mt8173-max98090.c @@ -180,6 +180,9 @@ static int mt8173_max98090_dev_probe(struct platform_de= vice *pdev) if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); + + of_node_put(codec_node); + of_node_put(platform_node); return ret; } =20 diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c b/sound/soc/m= ediatek/mt8173/mt8173-rt5650-rt5514.c index 8717e87bfe264..6f8542329bab9 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c @@ -218,6 +218,8 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platfo= rm_device *pdev) if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); + + of_node_put(platform_node); return ret; } =20 diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c b/sound/soc/m= ediatek/mt8173/mt8173-rt5650-rt5676.c index 9d4dd97211548..727ff0f7f20b1 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c @@ -285,6 +285,8 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platfo= rm_device *pdev) if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); + + of_node_put(platform_node); return ret; } =20 diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek= /mt8173/mt8173-rt5650.c index ef6f236752867..21e7d4d3ded5a 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c @@ -309,6 +309,8 @@ static int mt8173_rt5650_dev_probe(struct platform_devi= ce *pdev) if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); + + of_node_put(platform_node); return ret; } =20 --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64EF1C433EF for ; Mon, 24 Jan 2022 19:48:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344589AbiAXTsm (ORCPT ); Mon, 24 Jan 2022 14:48:42 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35862 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348707AbiAXTiU (ORCPT ); Mon, 24 Jan 2022 14:38:20 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A59361542; Mon, 24 Jan 2022 19:38:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57F5EC340F2; Mon, 24 Jan 2022 19:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053099; bh=czH9XBhxjWjGG03F484H/P9l8nncul0Wz3+TzAgzUM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ehIhafkHmxRnfryTpC6volZ8mozWKmFYfnfy36zIQk6IirgxG9F2tn8A2ZNwZjxjg u2zmLl8OoccW3c4F8gbLSbffqQCVIbHLqTZJAxDrgPPW+GPJXGiHHR8sJrXFFjRRlH rj4OLAfJGSqYlktX+mlXlJTgxu9WSWnZiHCdAy9M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yauhen Kharuzhy , Hans de Goede , Sebastian Reichel , Sasha Levin Subject: [PATCH 5.4 244/320] power: bq25890: Enable continuous conversion for ADC at charging Date: Mon, 24 Jan 2022 19:43:48 +0100 Message-Id: <20220124184002.288511565@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yauhen Kharuzhy [ Upstream commit 80211be1b9dec04cc2805d3d81e2091ecac289a1 ] Instead of one shot run of ADC at beginning of charging, run continuous conversion to ensure that all charging-related values are monitored properly (input voltage, input current, themperature etc.). Signed-off-by: Yauhen Kharuzhy Reviewed-by: Hans de Goede Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/power/supply/bq25890_charger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/= bq25890_charger.c index 9d1ec8d677de6..5afe55119fe65 100644 --- a/drivers/power/supply/bq25890_charger.c +++ b/drivers/power/supply/bq25890_charger.c @@ -531,12 +531,12 @@ static void bq25890_handle_state_change(struct bq2589= 0_device *bq, =20 if (!new_state->online) { /* power removed */ /* disable ADC */ - ret =3D bq25890_field_write(bq, F_CONV_START, 0); + ret =3D bq25890_field_write(bq, F_CONV_RATE, 0); if (ret < 0) goto error; } else if (!old_state.online) { /* power inserted */ /* enable ADC, to have control of charge current/voltage */ - ret =3D bq25890_field_write(bq, F_CONV_START, 1); + ret =3D bq25890_field_write(bq, F_CONV_RATE, 1); if (ret < 0) goto error; } --=20 2.34.1 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B594AC433FE for ; Mon, 24 Jan 2022 20:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353210AbiAXUBD (ORCPT ); Mon, 24 Jan 2022 15:01:03 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59476 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345635AbiAXTi1 (ORCPT ); Mon, 24 Jan 2022 14:38:27 -0500 Received: from smtp.kernel.org (relay.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 899F8B81250; Mon, 24 Jan 2022 19:38:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75D27C33A1C; Mon, 24 Jan 2022 19:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053103; bh=n3NJfTp/Pp/vZAidsmeEXWJbiKjAhzMri3BOT8j4izQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eb/TLW80kcVwjGSQZuZyX7NphQuOpdp2yrtV2ANz0G0P2rvkxbfVUXwrGi/4ND9vq BZbRm2aRqnLwbsQLIfOUkxUISQgsq+0gZicFZ36yLaqlm0zLh9zacCT5Orv/NSzpR3 ourm7WXkjZzhdEabKKfQe7GWfkuplFp/jq2h3MuU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Andersson , Arnaud Pouliquen , Mathieu Poirier Subject: [PATCH 5.4 245/320] rpmsg: core: Clean up resources on announce_create failure. Date: Mon, 24 Jan 2022 19:43:49 +0100 Message-Id: <20220124184002.321537839@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnaud Pouliquen commit 8066c615cb69b7da8a94f59379847b037b3a5e46 upstream. During the rpmsg_dev_probe, if rpdev->ops->announce_create returns an error, the rpmsg device and default endpoint should be freed before exiting the function. Fixes: 5e619b48677c ("rpmsg: Split rpmsg core and virtio backend") Suggested-by: Bjorn Andersson Signed-off-by: Arnaud Pouliquen Reviewed-by: Bjorn Andersson Cc: stable Link: https://lore.kernel.org/r/20211206190758.10004-1-arnaud.pouliquen@fos= s.st.com Signed-off-by: Mathieu Poirier Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/rpmsg/rpmsg_core.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) --- a/drivers/rpmsg/rpmsg_core.c +++ b/drivers/rpmsg/rpmsg_core.c @@ -473,13 +473,25 @@ static int rpmsg_dev_probe(struct device err =3D rpdrv->probe(rpdev); if (err) { dev_err(dev, "%s: failed: %d\n", __func__, err); - if (ept) - rpmsg_destroy_ept(ept); - goto out; + goto destroy_ept; } =20 - if (ept && rpdev->ops->announce_create) + if (ept && rpdev->ops->announce_create) { err =3D rpdev->ops->announce_create(rpdev); + if (err) { + dev_err(dev, "failed to announce creation\n"); + goto remove_rpdev; + } + } + + return 0; + +remove_rpdev: + if (rpdrv->remove) + rpdrv->remove(rpdev); +destroy_ept: + if (ept) + rpmsg_destroy_ept(ept); out: return err; } From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EA8BC43219 for ; Mon, 24 Jan 2022 19:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358968AbiAXT4F (ORCPT ); Mon, 24 Jan 2022 14:56:05 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59542 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348213AbiAXTi3 (ORCPT ); Mon, 24 Jan 2022 14:38:29 -0500 Received: from smtp.kernel.org (relay.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 09E81B81247; Mon, 24 Jan 2022 19:38:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2217EC33D63; Mon, 24 Jan 2022 19:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053106; bh=or6XJy6yo9zuglFE+mcPkKgZhy2eM7wUlvB3E6iEwSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kLUJOLEB3I1xzNlOvRuI0Xc6DrkLZYIV9rlnbJcJi2CsYcOXRHEhFHJ9UDoBrvp0n jhX5ZTugudQ0QPeJjjc1sYnD0qQA5yo3/Oe5Fazxln8dVCzAg/jl6CIgxVXb2ki5ig NCYqeovUEhgiy8LcODl7oAONDUid4sqlWKDoNvCc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiner Kallweit , Herbert Xu Subject: [PATCH 5.4 246/320] crypto: omap-aes - Fix broken pm_runtime_and_get() usage Date: Mon, 24 Jan 2022 19:43:50 +0100 Message-Id: <20220124184002.365104869@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Heiner Kallweit commit c2aec59be093bd44627bc4f6bc67e4614a93a7b6 upstream. This fix is basically the same as 3d6b661330a7 ("crypto: stm32 - Revert broken pm_runtime_resume_and_get changes"), just for the omap driver. If the return value isn't used, then pm_runtime_get_sync() has to be used for ensuring that the usage count is balanced. Fixes: 1f34cc4a8da3 ("crypto: omap-aes - Fix PM reference leak on omap-aes.= c") Cc: stable@vger.kernel.org Signed-off-by: Heiner Kallweit Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/crypto/omap-aes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/crypto/omap-aes.c +++ b/drivers/crypto/omap-aes.c @@ -1318,7 +1318,7 @@ static int omap_aes_suspend(struct devic =20 static int omap_aes_resume(struct device *dev) { - pm_runtime_resume_and_get(dev); + pm_runtime_get_sync(dev); return 0; } #endif From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5BBDC433FE for ; Mon, 24 Jan 2022 19:48:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350497AbiAXTrz (ORCPT ); Mon, 24 Jan 2022 14:47:55 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57292 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354617AbiAXTgx (ORCPT ); Mon, 24 Jan 2022 14:36:53 -0500 Received: from smtp.kernel.org (relay.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 A7007B8119D; Mon, 24 Jan 2022 19:36:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B55AC340E7; Mon, 24 Jan 2022 19:36:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053010; bh=OZWrIYlmNnJeEG49q0gkOrjQAqbKYs8wTiNAlmZYCOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l/6rC2AADJeNwy/1WEL5C6PawFECLFilfmEAhJVXJsKKcIIP6WWgM3wszNxVxqJvr 7yf/I1LLZaMMFLS1AacRYtQi8Lh1u9JmvEYN0FfypNlMaIj5cW0SjtxJs9i3zK55aD ij6aLFJhQ+lapsy61Y0nNCA+3wYq2vZz9Izjgv/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Alexandre Torgue , Fabien Dessenne , Herbert Xu , Lionel Debieve , Nicolas Toromanoff , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Nicolas Toromanoff Subject: [PATCH 5.4 247/320] crypto: stm32/crc32 - Fix kernel BUG triggered in probe() Date: Mon, 24 Jan 2022 19:43:51 +0100 Message-Id: <20220124184002.395346406@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marek Vasut commit 29009604ad4e3ef784fd9b9fef6f23610ddf633d upstream. The include/linux/crypto.h struct crypto_alg field cra_driver_name descript= ion states "Unique name of the transformation provider. " ... " this contains t= he name of the chip or provider and the name of the transformation algorithm." In case of the stm32-crc driver, field cra_driver_name is identical for all registered transformation providers and set to the name of the driver itsel= f, which is incorrect. This patch fixes it by assigning a unique cra_driver_na= me to each registered transformation provider. The kernel crash is triggered when the driver calls crypto_register_shashes= () which calls crypto_register_shash(), which calls crypto_register_alg(), whi= ch calls __crypto_register_alg(), which returns -EEXIST, which is propagated back through this call chain. Upon -EEXIST from crypto_register_shash(), the crypto_register_shashes() starts unregistering the providers back, and calls crypto_unregister_shash(), which calls crypto_unregister_alg(), and this is where the BUG() triggers due to incorrect cra_refcnt. Fixes: b51dbe90912a ("crypto: stm32 - Support for STM32 CRC32 crypto module= ") Signed-off-by: Marek Vasut Cc: # 4.12+ Cc: Alexandre Torgue Cc: Fabien Dessenne Cc: Herbert Xu Cc: Lionel Debieve Cc: Nicolas Toromanoff Cc: linux-arm-kernel@lists.infradead.org Cc: linux-stm32@st-md-mailman.stormreply.com To: linux-crypto@vger.kernel.org Acked-by: Nicolas Toromanoff Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/crypto/stm32/stm32-crc32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/crypto/stm32/stm32-crc32.c +++ b/drivers/crypto/stm32/stm32-crc32.c @@ -230,7 +230,7 @@ static struct shash_alg algs[] =3D { .digestsize =3D CHKSUM_DIGEST_SIZE, .base =3D { .cra_name =3D "crc32", - .cra_driver_name =3D DRIVER_NAME, + .cra_driver_name =3D "stm32-crc32-crc32", .cra_priority =3D 200, .cra_flags =3D CRYPTO_ALG_OPTIONAL_KEY, .cra_blocksize =3D CHKSUM_BLOCK_SIZE, @@ -252,7 +252,7 @@ static struct shash_alg algs[] =3D { .digestsize =3D CHKSUM_DIGEST_SIZE, .base =3D { .cra_name =3D "crc32c", - .cra_driver_name =3D DRIVER_NAME, + .cra_driver_name =3D "stm32-crc32-crc32c", .cra_priority =3D 200, .cra_flags =3D CRYPTO_ALG_OPTIONAL_KEY, .cra_blocksize =3D CHKSUM_BLOCK_SIZE, From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43A22C4332F for ; Mon, 24 Jan 2022 19:48:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350342AbiAXTry (ORCPT ); Mon, 24 Jan 2022 14:47:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34544 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354633AbiAXTgy (ORCPT ); Mon, 24 Jan 2022 14:36:54 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D236E6141C; Mon, 24 Jan 2022 19:36:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABC58C340E5; Mon, 24 Jan 2022 19:36:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053013; bh=N9z9CA+DDyeJ2G05kqCDHc2y8kstWZPWxKWqeGhvqvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C/4mcIM8BDORH1AMLuJUQcUCnZgzBmXUp9o28BnK96r5Mz0vv5zYtI/PAzUcXF3y6 Dkebau1MxwmCTxu9FCNl0AZbkXUQod1dXm6eIup8fz6QAoWdRiuKXfIOiQ4k4EDDE/ 7lrOPL9lYOMVZZZClDoAEZuAvrd1IsrlMnuSQDLU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Li , =?UTF-8?q?Horia=20Geant=C4=83?= , Herbert Xu Subject: [PATCH 5.4 248/320] crypto: caam - replace this_cpu_ptr with raw_cpu_ptr Date: Mon, 24 Jan 2022 19:43:52 +0100 Message-Id: <20220124184002.429181031@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Meng Li commit efd21e10fc3bf4c6da122470a5ae89ec4ed8d180 upstream. When enable the kernel debug config, there is below calltrace detected: BUG: using smp_processor_id() in preemptible [00000000] code: cryptomgr_tes= t/339 caller is debug_smp_processor_id+0x20/0x30 CPU: 9 PID: 339 Comm: cryptomgr_test Not tainted 5.10.63-yocto-standard #1 Hardware name: NXP Layerscape LX2160ARDB (DT) Call trace: dump_backtrace+0x0/0x1a0 show_stack+0x24/0x30 dump_stack+0xf0/0x13c check_preemption_disabled+0x100/0x110 debug_smp_processor_id+0x20/0x30 dpaa2_caam_enqueue+0x10c/0x25c ...... cryptomgr_test+0x38/0x60 kthread+0x158/0x164 ret_from_fork+0x10/0x38 According to the comment in commit ac5d15b4519f("crypto: caam/qi2 - use affine DPIOs "), because preemption is no longer disabled while trying to enqueue an FQID, it might be possible to run the enqueue on a different CPU(due to migration, when in process context), however this wouldn't be a functionality issue. But there will be above calltrace when enable kernel debug config. So, replace this_cpu_ptr with raw_cpu_ptr to avoid above call trace. Fixes: ac5d15b4519f ("crypto: caam/qi2 - use affine DPIOs") Cc: stable@vger.kernel.org Signed-off-by: Meng Li Reviewed-by: Horia Geant=C4=83 Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/crypto/caam/caamalg_qi2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/crypto/caam/caamalg_qi2.c +++ b/drivers/crypto/caam/caamalg_qi2.c @@ -5421,7 +5421,7 @@ int dpaa2_caam_enqueue(struct device *de dpaa2_fd_set_len(&fd, dpaa2_fl_get_len(&req->fd_flt[1])); dpaa2_fd_set_flc(&fd, req->flc_dma); =20 - ppriv =3D this_cpu_ptr(priv->ppriv); + ppriv =3D raw_cpu_ptr(priv->ppriv); for (i =3D 0; i < (priv->dpseci_attr.num_tx_queues << 1); i++) { err =3D dpaa2_io_service_enqueue_fq(ppriv->dpio, ppriv->req_fqid, &fd); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4A0AC433F5 for ; Mon, 24 Jan 2022 20:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353050AbiAXUCG (ORCPT ); Mon, 24 Jan 2022 15:02:06 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34570 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354648AbiAXTg5 (ORCPT ); Mon, 24 Jan 2022 14:36:57 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9ED0D614DA; Mon, 24 Jan 2022 19:36:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A507C340E5; Mon, 24 Jan 2022 19:36:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053016; bh=FYe4UVnzYe2hrRUNg/CIzkMESrbopJBXhiXreviRkXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gTSI4QUXZuWz/KJXvqsSWmZjMiOL90u6I6NmppcCuk9K+vc5hnd+SYR12HlGoya77 RNP2RTHWri8WerEpwIITf9SESWJY9FYKepnU6EsdXrnWt8Hm0eP9txNoFE69leJKsA /LChZdcWFOX1OhGCaMtV+lHlpEiB7XW2/w2Vw3Zc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Petr Cvachoucek , Richard Weinberger Subject: [PATCH 5.4 249/320] ubifs: Error path in ubifs_remount_rw() seems to wrongly free write buffers Date: Mon, 24 Jan 2022 19:43:53 +0100 Message-Id: <20220124184002.460673837@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Petr Cvachoucek commit 3fea4d9d160186617ff40490ae01f4f4f36b28ff upstream. it seems freeing the write buffers in the error path of the ubifs_remount_rw() is wrong. It leads later to a kernel oops like this: [10016.431274] UBIFS (ubi0:0): start fixing up free space [10090.810042] UBIFS (ubi0:0): free space fixup complete [10090.814623] UBIFS error (ubi0:0 pid 512): ubifs_remount_fs: cannot spawn "ubifs_bgt0_0", error -4 [10101.915108] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 517 [10105.275498] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000030 [10105.284352] Mem abort info: [10105.287160] ESR =3D 0x96000006 [10105.290252] EC =3D 0x25: DABT (current EL), IL =3D 32 bits [10105.295592] SET =3D 0, FnV =3D 0 [10105.298652] EA =3D 0, S1PTW =3D 0 [10105.301848] Data abort info: [10105.304723] ISV =3D 0, ISS =3D 0x00000006 [10105.308573] CM =3D 0, WnR =3D 0 [10105.311564] user pgtable: 4k pages, 48-bit VAs, pgdp=3D00000000f03d1000 [10105.318034] [0000000000000030] pgd=3D00000000f6cee003, pud=3D00000000f4884003, pmd=3D0000000000000000 [10105.326783] Internal error: Oops: 96000006 [#1] PREEMPT SMP [10105.332355] Modules linked in: ath10k_pci ath10k_core ath mac80211 libarc4 cfg80211 nvme nvme_core cryptodev(O) [10105.342468] CPU: 3 PID: 518 Comm: touch Tainted: G O 5.4.3 #1 [10105.349517] Hardware name: HYPEX CPU (DT) [10105.353525] pstate: 40000005 (nZcv daif -PAN -UAO) [10105.358324] pc : atomic64_try_cmpxchg_acquire.constprop.22+0x8/0x34 [10105.364596] lr : mutex_lock+0x1c/0x34 [10105.368253] sp : ffff000075633aa0 [10105.371563] x29: ffff000075633aa0 x28: 0000000000000001 [10105.376874] x27: ffff000076fa80c8 x26: 0000000000000004 [10105.382185] x25: 0000000000000030 x24: 0000000000000000 [10105.387495] x23: 0000000000000000 x22: 0000000000000038 [10105.392807] x21: 000000000000000c x20: ffff000076fa80c8 [10105.398119] x19: ffff000076fa8000 x18: 0000000000000000 [10105.403429] x17: 0000000000000000 x16: 0000000000000000 [10105.408741] x15: 0000000000000000 x14: fefefefefefefeff [10105.414052] x13: 0000000000000000 x12: 0000000000000fe0 [10105.419364] x11: 0000000000000fe0 x10: ffff000076709020 [10105.424675] x9 : 0000000000000000 x8 : 00000000000000a0 [10105.429986] x7 : ffff000076fa80f4 x6 : 0000000000000030 [10105.435297] x5 : 0000000000000000 x4 : 0000000000000000 [10105.440609] x3 : 0000000000000000 x2 : ffff00006f276040 [10105.445920] x1 : ffff000075633ab8 x0 : 0000000000000030 [10105.451232] Call trace: [10105.453676] atomic64_try_cmpxchg_acquire.constprop.22+0x8/0x34 [10105.459600] ubifs_garbage_collect+0xb4/0x334 [10105.463956] ubifs_budget_space+0x398/0x458 [10105.468139] ubifs_create+0x50/0x180 [10105.471712] path_openat+0x6a0/0x9b0 [10105.475284] do_filp_open+0x34/0x7c [10105.478771] do_sys_open+0x78/0xe4 [10105.482170] __arm64_sys_openat+0x1c/0x24 [10105.486180] el0_svc_handler+0x84/0xc8 [10105.489928] el0_svc+0x8/0xc [10105.492808] Code: 52800013 17fffffb d2800003 f9800011 (c85ffc05) [10105.498903] ---[ end trace 46b721d93267a586 ]--- To reproduce the problem: 1. Filesystem initially mounted read-only, free space fixup flag set. 2. mount -o remount,rw 3. it takes some time (free space fixup running) ... try to terminate running mount by CTRL-C ... does not respond, only after free space fixup is complete ... then "ubifs_remount_fs: cannot spawn "ubifs_bgt0_0", error -4" 4. mount -o remount,rw ... now finished instantly (fixup already done). 5. Create file or just unmount the filesystem and we get the oops. Cc: Fixes: b50b9f408502 ("UBIFS: do not free write-buffers when in R/O mode") Signed-off-by: Petr Cvachoucek Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/ubifs/super.c | 1 - 1 file changed, 1 deletion(-) --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1835,7 +1835,6 @@ out: kthread_stop(c->bgt); c->bgt =3D NULL; } - free_wbufs(c); kfree(c->write_reserve_buf); c->write_reserve_buf =3D NULL; vfree(c->ileb_buf); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1473C4167B for ; Mon, 24 Jan 2022 20:38:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385923AbiAXUer (ORCPT ); Mon, 24 Jan 2022 15:34:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355456AbiAXUNl (ORCPT ); Mon, 24 Jan 2022 15:13:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F48DC06177E; Mon, 24 Jan 2022 11:37:01 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2BF5BB80FA1; Mon, 24 Jan 2022 19:37:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E94DC340E5; Mon, 24 Jan 2022 19:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053018; bh=KXa3PZX3KZ79XnZVl87pu7FZ3QvuxgE02+fJGd2UNa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zwBay6TLX9Yv9r0Lm8wTWrlpP6jRSD3zGXHbQGHmr1r6IVGRU9pBsn4pPK5/kR/QC xY9QE6HPqXqpIqIorA8XM7UVDA83HYEceJdGMtcEYo3sK/Oaj/ysHSu40vgVjUAQaI nh6yvrNv6GerfCQGqtM+fDpKoOf1t7g72TuCMa9U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xie Yongji , Miklos Szeredi Subject: [PATCH 5.4 250/320] fuse: Pass correct lend value to filemap_write_and_wait_range() Date: Mon, 24 Jan 2022 19:43:54 +0100 Message-Id: <20220124184002.493762000@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xie Yongji commit e388164ea385f04666c4633f5dc4f951fca71890 upstream. The acceptable maximum value of lend parameter in filemap_write_and_wait_range() is LLONG_MAX rather than -1. And there is also some logic depending on LLONG_MAX check in write_cache_pages(). So let's pass LLONG_MAX to filemap_write_and_wait_range() in fuse_writeback_range() instead. Fixes: 59bda8ecee2f ("fuse: flush extending writes") Signed-off-by: Xie Yongji Cc: # v5.15 Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/fuse/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -3188,7 +3188,7 @@ fuse_direct_IO(struct kiocb *iocb, struc =20 static int fuse_writeback_range(struct inode *inode, loff_t start, loff_t = end) { - int err =3D filemap_write_and_wait_range(inode->i_mapping, start, -1); + int err =3D filemap_write_and_wait_range(inode->i_mapping, start, LLONG_M= AX); =20 if (!err) fuse_sync_writes(inode); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E94FDC433EF for ; Mon, 24 Jan 2022 20:38:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385823AbiAXUek (ORCPT ); Mon, 24 Jan 2022 15:34:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355459AbiAXUNl (ORCPT ); Mon, 24 Jan 2022 15:13:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D013AC0604D1; Mon, 24 Jan 2022 11:37:02 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E11F614FC; Mon, 24 Jan 2022 19:37:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49DAFC340E5; Mon, 24 Jan 2022 19:37:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053021; bh=QR8yZAhBM7iYkAK09ew+ffn9nmVg2lFDcim+AuhC6z0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uaMph8oNPNHKHUdVllV9XuoCJCC1k2saptmg2JZ5XO/DJVM7hR06mMKxM3mkRZLK+ kG6bK7MFXdQaktSytk6gIgTrJ4pOJLNKSWkZi9WfJCcujhUzu0Y4tKlH61TM/yCjA7 6DXfihI26P8vaMbszc8dUSkh/2Bk3JAvNbxXv3G0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Gago Castano , Jan Kiszka , Su Bao Cheng , Lukas Wunner Subject: [PATCH 5.4 251/320] serial: Fix incorrect rs485 polarity on uart open Date: Mon, 24 Jan 2022 19:43:55 +0100 Message-Id: <20220124184002.524758989@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Wunner commit d3b3404df318504ec084213ab1065b73f49b0f1d upstream. Commit a6845e1e1b78 ("serial: core: Consider rs485 settings to drive RTS") sought to deassert RTS when opening an rs485-enabled uart port. That way, the transceiver does not occupy the bus until it transmits data. Unfortunately, the commit mixed up the logic and *asserted* RTS instead of *deasserting* it: The commit amended uart_port_dtr_rts(), which raises DTR and RTS when opening an rs232 port. "Raising" actually means lowering the signal that's coming out of the uart, because an rs232 transceiver not only changes a signal's voltage level, it also *inverts* the signal. See the simplified schematic in the MAX232 datasheet for an example: https://www.ti.com/lit/ds/symlink/max232.pdf So, to raise RTS on an rs232 port, TIOCM_RTS is *set* in port->mctrl and that results in the signal being driven low. In contrast to rs232, the signal level for rs485 Transmit Enable is the identity, not the inversion: If the transceiver expects a "high" RTS signal for Transmit Enable, the signal coming out of the uart must also be high, so TIOCM_RTS must be *cleared* in port->mctrl. The commit did the exact opposite, but it's easy to see why given the confusing semantics of rs232 and rs485. Fix it. Fixes: a6845e1e1b78 ("serial: core: Consider rs485 settings to drive RTS") Cc: stable@vger.kernel.org # v4.14+ Cc: Rafael Gago Castano Cc: Jan Kiszka Cc: Su Bao Cheng Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/9395767847833f2f3193c49cde38501eeb3b5669.16= 39821059.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/tty/serial/serial_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -160,7 +160,7 @@ static void uart_port_dtr_rts(struct uar int RTS_after_send =3D !!(uport->rs485.flags & SER_RS485_RTS_AFTER_SEND); =20 if (raise) { - if (rs485_on && !RTS_after_send) { + if (rs485_on && RTS_after_send) { uart_set_mctrl(uport, TIOCM_DTR); uart_clear_mctrl(uport, TIOCM_RTS); } else { @@ -169,7 +169,7 @@ static void uart_port_dtr_rts(struct uar } else { unsigned int clear =3D TIOCM_DTR; =20 - clear |=3D (!rs485_on || !RTS_after_send) ? TIOCM_RTS : 0; + clear |=3D (!rs485_on || RTS_after_send) ? TIOCM_RTS : 0; uart_clear_mctrl(uport, clear); } } From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FCE9C433F5 for ; Mon, 24 Jan 2022 20:34:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348171AbiAXUeY (ORCPT ); Mon, 24 Jan 2022 15:34:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355442AbiAXUNl (ORCPT ); Mon, 24 Jan 2022 15:13:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C2CFC0604D2; Mon, 24 Jan 2022 11:37:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 082B8B81232; Mon, 24 Jan 2022 19:37:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27356C340E7; Mon, 24 Jan 2022 19:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053024; bh=QaemAATjchbPUysn33dPWc1b6QtCHkameZcT4eNz62Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DtfC5d4oiNhvzdA6GQO0nFF4q4E0wN7UiqjUi5NAUDJIoz+X/Vn1NwSnm328W0uAT g1IDZTjSvSlCOyqU+7Jvv+v8oLwQ3onmQsBubu0Ysew44REjG7909KoWCsIkTQVNSd yh//fymMrqwHwdd9vWZN2oH/9Hd+6s36rxuKFGc8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Ryabinin , "Peter Zijlstra (Intel)" , Daniel Jordan , Tejun Heo Subject: [PATCH 5.4 252/320] cputime, cpuacct: Include guest time in user time in cpuacct.stat Date: Mon, 24 Jan 2022 19:43:56 +0100 Message-Id: <20220124184002.557104227@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrey Ryabinin commit 9731698ecb9c851f353ce2496292ff9fcea39dff upstream. cpuacct.stat in no-root cgroups shows user time without guest time included int it. This doesn't match with user time shown in root cpuacct.stat and /proc//stat. This also affects cgroup2's cpu.stat in the same way. Make account_guest_time() to add user time to cgroup's cpustat to fix this. Fixes: ef12fefabf94 ("cpuacct: add per-cgroup utime/stime statistics") Signed-off-by: Andrey Ryabinin Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Daniel Jordan Acked-by: Tejun Heo Cc: Link: https://lore.kernel.org/r/20211115164607.23784-1-arbn@yandex-team.com Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- kernel/sched/cputime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -147,10 +147,10 @@ void account_guest_time(struct task_stru =20 /* Add guest time to cpustat. */ if (task_nice(p) > 0) { - cpustat[CPUTIME_NICE] +=3D cputime; + task_group_account_field(p, CPUTIME_NICE, cputime); cpustat[CPUTIME_GUEST_NICE] +=3D cputime; } else { - cpustat[CPUTIME_USER] +=3D cputime; + task_group_account_field(p, CPUTIME_USER, cputime); cpustat[CPUTIME_GUEST] +=3D cputime; } } From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47A2CC46467 for ; Mon, 24 Jan 2022 19:57:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359212AbiAXT4g (ORCPT ); Mon, 24 Jan 2022 14:56:36 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58542 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344035AbiAXThL (ORCPT ); Mon, 24 Jan 2022 14:37:11 -0500 Received: from smtp.kernel.org (relay.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 E74E9B81239; Mon, 24 Jan 2022 19:37:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E45CC340E5; Mon, 24 Jan 2022 19:37:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053027; bh=opo5R3812xqFwnMjvJtQVvKlpACVBA31j6oNkd7pbfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y7htYdfAYRWY/gsilsiSy0WwOMk5XkYefloLFRcRpnQAhphziMqk4q8w4iXw7dkuD 2VtiNLqUc6ygC3v1Fy0o/hWAV90AopAUFIWNBhY0CW+ItiiarLOFROA30+nzjBCMjp mlYlzUdnWsw7rMSspyfhgj2SiczXE3fUi8f8ey3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Xiangyang Zhang , Steven Rostedt Subject: [PATCH 5.4 253/320] tracing/kprobes: nmissed not showed correctly for kretprobe Date: Mon, 24 Jan 2022 19:43:57 +0100 Message-Id: <20220124184002.592999926@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiangyang Zhang commit dfea08a2116fe327f79d8f4d4b2cf6e0c88be11f upstream. The 'nmissed' column of the 'kprobe_profile' file for kretprobe is not showed correctly, kretprobe can be skipped by two reasons, shortage of kretprobe_instance which is counted by tk->rp.nmissed, and kprobe itself is missed by some reason, so to show the sum. Link: https://lkml.kernel.org/r/20220107150242.5019-1-xyz.sun.ok@gmail.com Cc: stable@vger.kernel.org Fixes: 4a846b443b4e ("tracing/kprobes: Cleanup kprobe tracer code") Acked-by: Masami Hiramatsu Signed-off-by: Xiangyang Zhang Signed-off-by: Steven Rostedt Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- kernel/trace/trace_kprobe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -999,15 +999,18 @@ static int probes_profile_seq_show(struc { struct dyn_event *ev =3D v; struct trace_kprobe *tk; + unsigned long nmissed; =20 if (!is_trace_kprobe(ev)) return 0; =20 tk =3D to_trace_kprobe(ev); + nmissed =3D trace_kprobe_is_return(tk) ? + tk->rp.kp.nmissed + tk->rp.nmissed : tk->rp.kp.nmissed; seq_printf(m, " %-44s %15lu %15lu\n", trace_probe_name(&tk->tp), trace_kprobe_nhit(tk), - tk->rp.kp.nmissed); + nmissed); =20 return 0; } From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EDCAC35268 for ; Mon, 24 Jan 2022 20:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386305AbiAXUfX (ORCPT ); Mon, 24 Jan 2022 15:35:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344625AbiAXUNq (ORCPT ); Mon, 24 Jan 2022 15:13:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA60DC0604D6; Mon, 24 Jan 2022 11:37:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 41C7A61515; Mon, 24 Jan 2022 19:37:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27847C340E5; Mon, 24 Jan 2022 19:37:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053030; bh=5vWYp7qQngVJfxFk9KUiSt3vvkHtUkiSXrq/kc/duEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=clEYfLh8Wbn18xnBz484lDJNaAadC1LG2fsUvQKFTKUGQi/Y3qT6HQP0TQPT3qoPg PsaTBeAdKcqkQWyTqjutf2kUliGltWL/MMjfUY6k09d5TxCG8ZApg9OVC83Qhgcy5x a8e/ILj3xQvgv1LMOIwwfqmrxou5QspLtRU8c9UY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilan Peer , Luca Coelho Subject: [PATCH 5.4 254/320] iwlwifi: mvm: Increase the scan timeout guard to 30 seconds Date: Mon, 24 Jan 2022 19:43:58 +0100 Message-Id: <20220124184002.631982996@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ilan Peer commit ced50f1133af12f7521bb777fcf4046ca908fb77 upstream. With the introduction of 6GHz channels the scan guard timeout should be adjusted to account for the following extreme case: - All 6GHz channels are scanned passively: 58 channels. - The scan is fragmented with the following parameters: 3 fragments, 95 TUs suspend time, 44 TUs maximal out of channel time. The above would result with scan time of more than 24 seconds. Thus, set the timeout to 30 seconds. Cc: stable@vger.kernel.org Signed-off-by: Ilan Peer Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211210090244.3c851b93aef5.I346fa2= e1d79220a6770496e773c6f87a2ad9e6c4@changeid Signed-off-by: Luca Coelho Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c @@ -1700,7 +1700,7 @@ static int iwl_mvm_check_running_scans(s return -EIO; } =20 -#define SCAN_TIMEOUT 20000 +#define SCAN_TIMEOUT 30000 =20 void iwl_mvm_scan_timeout_wk(struct work_struct *work) { From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 106A1C433F5 for ; Mon, 24 Jan 2022 20:01:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358387AbiAXUBt (ORCPT ); Mon, 24 Jan 2022 15:01:49 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58588 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348432AbiAXThT (ORCPT ); Mon, 24 Jan 2022 14:37:19 -0500 Received: from smtp.kernel.org (relay.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 0B246B810BD; Mon, 24 Jan 2022 19:37:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AC02C340E8; Mon, 24 Jan 2022 19:37:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053033; bh=1CNTcvK4OXKHW3vcSevueM9ut4cbVVfCf3c2zi3LRCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JSYN3KN+u0Xq6blxPFdIrlh0uxSk8tShbmLpLbrH9JZ/CUPQI3DXVAO+h5CQewPMp rukKNGC7FpJ6fw5Kjl7PwJCErdhSZmSb67sJXiDT8ZcFW8xY7q+Kw6DM4foRtfNhT2 a8LvGZuS+pl5h8QHQdrsXh5k1Lt4tPzbHWaqXHz0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vlastimil Babka , Gerald Schaefer , Alexander Gordeev , Heiko Carstens Subject: [PATCH 5.4 255/320] s390/mm: fix 2KB pgtable release race Date: Mon, 24 Jan 2022 19:43:59 +0100 Message-Id: <20220124184002.666556675@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev commit c2c224932fd0ee6854d6ebfc8d059c2bcad86606 upstream. There is a race on concurrent 2KB-pgtables release paths when both upper and lower halves of the containing parent page are freed, one via page_table_free_rcu() + __tlb_remove_table(), and the other via page_table_free(). The race might lead to a corruption as result of remove of list item in page_table_free() concurrently with __free_page() in __tlb_remove_table(). Let's assume first the lower and next the upper 2KB-pgtables are freed from a page. Since both halves of the page are allocated the tracking byte (bits 24-31 of the page _refcount) has value of 0x03 initially: CPU0 CPU1 Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee ---- ---- page_table_free_rcu() // lower half { // _refcount[31..24] =3D=3D 0x03 ... atomic_xor_bits(&page->_refcount, 0x11U << (0 + 24)); // _refcount[31..24] <=3D 0x12 ... table =3D table | (1U << 0); tlb_remove_table(tlb, table); } ... __tlb_remove_table() { // _refcount[31..24] =3D=3D 0x12 mask =3D _table & 3; // mask <=3D 0x01 ... page_table_free() // upper half { // _refcount[31..24] =3D=3D 0x12 ... atomic_xor_bits( &page->_refcount, 1U << (1 + 24)); // _refcount[31..24] <=3D 0x10 // mask <=3D 0x10 ... atomic_xor_bits(&page->_refcount, mask << (4 + 24)); // _refcount[31..24] <=3D 0x00 // mask <=3D 0x00 ... if (mask !=3D 0) // =3D=3D false break; fallthrough; ... if (mask & 3) // =3D=3D false ... else __free_page(page); list_del(&page->lru); ^^^^^^^^^^^^^^^^^^ RACE! ^^^^^^^^^^^^^^^^^^^^^ } ... } The problem is page_table_free() releases the page as result of lower nibble unset and __tlb_remove_table() observing zero too early. With this update page_table_free() will use the similar logic as page_table_free_rcu() + __tlb_remove_table(), and mark the fragment as pending for removal in the upper nibble until after the list_del(). In other words, the parent page is considered as unreferenced and safe to release only when the lower nibble is cleared already and unsetting a bit in upper nibble results in that nibble turned zero. Cc: stable@vger.kernel.org Suggested-by: Vlastimil Babka Reviewed-by: Gerald Schaefer Signed-off-by: Alexander Gordeev Signed-off-by: Heiko Carstens Signed-off-by: Greg Kroah-Hartman --- arch/s390/mm/pgalloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/s390/mm/pgalloc.c +++ b/arch/s390/mm/pgalloc.c @@ -255,13 +255,15 @@ void page_table_free(struct mm_struct *m /* Free 2K page table fragment of a 4K page */ bit =3D (__pa(table) & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)); spin_lock_bh(&mm->context.lock); - mask =3D atomic_xor_bits(&page->_refcount, 1U << (bit + 24)); + mask =3D atomic_xor_bits(&page->_refcount, 0x11U << (bit + 24)); mask >>=3D 24; if (mask & 3) list_add(&page->lru, &mm->context.pgtable_list); else list_del(&page->lru); spin_unlock_bh(&mm->context.lock); + mask =3D atomic_xor_bits(&page->_refcount, 0x10U << (bit + 24)); + mask >>=3D 24; if (mask !=3D 0) return; } else { From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78D5FC4321E for ; Mon, 24 Jan 2022 20:38:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386831AbiAXUgB (ORCPT ); Mon, 24 Jan 2022 15:36:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238181AbiAXUNu (ORCPT ); Mon, 24 Jan 2022 15:13:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35473C0604DB; Mon, 24 Jan 2022 11:37:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F1E3FB811FC; Mon, 24 Jan 2022 19:37:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B0D3C340E8; Mon, 24 Jan 2022 19:37:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053036; bh=PZ01Hxh638HDPHNS+Dby+/D9eR2Rhd60+XYmAAGGGkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QYGXJ9EJz+NeqwlrOiQbiq8aHx8NGdAOZ511lzoPk/MpQz5pwZNM6NmLDOTkP6b5c cVfzpMEotmHO38rTawsMon8AMLbHX1fKZJhEuG72c0OTcV0j/HCGkaX+OftY1u3ds7 vD9doQ7qShRu0o0po3Pe0m8t2nOwRxNvKpinB6fI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Lucas Stach , Christian Gmeiner Subject: [PATCH 5.4 256/320] drm/etnaviv: limit submit sizes Date: Mon, 24 Jan 2022 19:44:00 +0100 Message-Id: <20220124184002.698750045@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lucas Stach commit 6dfa2fab8ddd46faa771a102672176bee7a065de upstream. Currently we allow rediculous amounts of kernel memory being allocated via the etnaviv GEM_SUBMIT ioctl, which is a pretty easy DoS vector. Put some reasonable limits in to fix this. The commandstream size is limited to 64KB, which was already a soft limit on older kernels after which the kernel only took submits on a best effort base, so there is no userspace that tries to submit commandstreams larger than this. Even if the whole commandstream is a single incrementing address load, the size limit also limits the number of potential relocs and referenced buffers to slightly under 64K, so use the same limit for those arguments. The performance monitoring infrastructure currently supports less than 50 performance counter signals, so limiting them to 128 on a single submit seems like a reasonably future-proof number for now. This number can be bumped if needed without breaking the interface. Cc: stable@vger.kernel.org Reported-by: Dan Carpenter Signed-off-by: Lucas Stach Reviewed-by: Christian Gmeiner Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c @@ -471,6 +471,12 @@ int etnaviv_ioctl_gem_submit(struct drm_ return -EINVAL; } =20 + if (args->stream_size > SZ_64K || args->nr_relocs > SZ_64K || + args->nr_bos > SZ_64K || args->nr_pmrs > 128) { + DRM_ERROR("submit arguments out of size limits\n"); + return -EINVAL; + } + /* * Copy the command submission and bo array to kernel space in * one go, and do this outside of any locks. From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED06CC4167D for ; Mon, 24 Jan 2022 19:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359141AbiAXT40 (ORCPT ); Mon, 24 Jan 2022 14:56:26 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34938 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354702AbiAXThY (ORCPT ); Mon, 24 Jan 2022 14:37:24 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 490C16151C; Mon, 24 Jan 2022 19:37:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F7A4C340E7; Mon, 24 Jan 2022 19:37:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053042; bh=gyITbsjSlZfuVM4xh3vWN9UM7eV8Mkj+uIUGaq071sI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hPOxRa5IrLo0DOSVItR5nS63HUjEfb/qcgpyNv0wZKxOHm6IfIBuvNBw0/aE58vdv ytLlb/OvuL1gv//NwNzqnq0GqqZMKDwy+UXZvtxlOsPm4w8NTC8uPBXAyHzihLZl1X vFkAdqsZzjw/yG+qSatJEgqebaTi+PBIXjSRSPPo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Nathan E. Egge" , Ilia Mirkin , Ben Skeggs , Karol Herbst Subject: [PATCH 5.4 257/320] drm/nouveau/kms/nv04: use vzalloc for nv04_display Date: Mon, 24 Jan 2022 19:44:01 +0100 Message-Id: <20220124184002.734088357@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ilia Mirkin commit bd6e07e72f37f34535bec7eebc807e5fcfe37b43 upstream. The struct is giant, and triggers an order-7 allocation (512K). There is no reason for this to be kmalloc-type memory, so switch to vmalloc. This should help loading nouveau on low-memory and/or long-running systems. Reported-by: Nathan E. Egge Signed-off-by: Ilia Mirkin Cc: stable@vger.kernel.org Signed-off-by: Ben Skeggs Reviewed-by: Karol Herbst Signed-off-by: Karol Herbst Link: https://gitlab.freedesktop.org/drm/nouveau/-/merge_requests/10 Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/nouveau/dispnv04/disp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/nouveau/dispnv04/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c @@ -179,7 +179,7 @@ nv04_display_destroy(struct drm_device * nvif_notify_fini(&disp->flip); =20 nouveau_display(dev)->priv =3D NULL; - kfree(disp); + vfree(disp); =20 nvif_object_unmap(&drm->client.device.object); } @@ -197,7 +197,7 @@ nv04_display_create(struct drm_device *d struct nv04_display *disp; int i, ret; =20 - disp =3D kzalloc(sizeof(*disp), GFP_KERNEL); + disp =3D vzalloc(sizeof(*disp)); if (!disp) return -ENOMEM; =20 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 663D6C433F5 for ; Mon, 24 Jan 2022 20:01:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376339AbiAXUBZ (ORCPT ); Mon, 24 Jan 2022 15:01:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57606 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354722AbiAXTh2 (ORCPT ); Mon, 24 Jan 2022 14:37:28 -0500 Received: from smtp.kernel.org (relay.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 DE29CB811F9; Mon, 24 Jan 2022 19:37:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C789C340E5; Mon, 24 Jan 2022 19:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053045; bh=LexXsOHLM2Zyt+r8gcyKj5jMn+0GNWWGVK2D4CaDRiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a9AnDRd6HaerK29si4FEmlWR9M6sMpA6ZIG2Fa4mdLyozEy7y+0awWN68GUruUoHq OGHAalf/Gptaxoi+ZYg7CVMijPBEKuxv1x7/6/OQzgZzW1pOi4HyFS2ic/hAxqQQQO 81TmxZVpP1qG+OmQ1/lByemgWn6WmvWYPWDcrFjs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zain Wang , Tomasz Figa , Heiko Stuebner , Sean Paul , Brian Norris , Robert Foss Subject: [PATCH 5.4 258/320] drm/bridge: analogix_dp: Make PSR-exit block less Date: Mon, 24 Jan 2022 19:44:02 +0100 Message-Id: <20220124184002.765011039@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris commit c4c6ef229593366ab593d4d424addc7025b54a76 upstream. Prior to commit 6c836d965bad ("drm/rockchip: Use the helpers for PSR"), "PSR exit" used non-blocking analogix_dp_send_psr_spd(). The refactor started using the blocking variant, for a variety of reasons -- quoting Sean Paul's potentially-faulty memory: """ - To avoid racing a subsequent PSR entry (if exit takes a long time) - To avoid racing disable/modeset - We're not displaying new content while exiting PSR anyways, so there is minimal utility in allowing frames to be submitted - We're lying to userspace telling them frames are on the screen when we're just dropping them on the floor """ However, I'm finding that this blocking transition is causing upwards of 60+ ms of unneeded latency on PSR-exit, to the point that initial cursor movements when leaving PSR are unbearably jumpy. It turns out that we need to meet in the middle somewhere: Sean is right that we were "lying to userspace" with a non-blocking PSR-exit, but the new blocking behavior is also waiting too long: According to the eDP specification, the sink device must support PSR entry transitions from both state 4 (ACTIVE_RESYNC) and state 0 (INACTIVE). It also states that in ACTIVE_RESYNC, "the Sink device must display the incoming active frames from the Source device with no visible glitches and/or artifacts." Thus, for our purposes, we only need to wait for ACTIVE_RESYNC before moving on; we are ready to display video, and subsequent PSR-entry is safe. Tested on a Samsung Chromebook Plus (i.e., Rockchip RK3399 Gru Kevin), where this saves about 60ms of latency, for PSR-exit that used to take about 80ms. Fixes: 6c836d965bad ("drm/rockchip: Use the helpers for PSR") Cc: Cc: Zain Wang Cc: Tomasz Figa Cc: Heiko Stuebner Cc: Sean Paul Signed-off-by: Brian Norris Reviewed-by: Sean Paul Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20211103135112.v3.1.I67= 612ea073c3306c71b46a87be894f79707082df@changeid Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c @@ -1086,11 +1086,21 @@ int analogix_dp_send_psr_spd(struct anal if (!blocking) return 0; =20 + /* + * db[1]!=3D0: entering PSR, wait for fully active remote frame buffer. + * db[1]=3D=3D0: exiting PSR, wait for either + * (a) ACTIVE_RESYNC - the sink "must display the + * incoming active frames from the Source device with no visible + * glitches and/or artifacts", even though timings may still be + * re-synchronizing; or + * (b) INACTIVE - the transition is fully complete. + */ ret =3D readx_poll_timeout(analogix_dp_get_psr_status, dp, psr_status, psr_status >=3D 0 && ((vsc->db[1] && psr_status =3D=3D DP_PSR_SINK_ACTIVE_RFB) || - (!vsc->db[1] && psr_status =3D=3D DP_PSR_SINK_INACTIVE)), 1500, - DP_TIMEOUT_PSR_LOOP_MS * 1000); + (!vsc->db[1] && (psr_status =3D=3D DP_PSR_SINK_ACTIVE_RESYNC || + psr_status =3D=3D DP_PSR_SINK_INACTIVE))), + 1500, DP_TIMEOUT_PSR_LOOP_MS * 1000); if (ret) { dev_warn(dp->dev, "Failed to apply PSR %d\n", ret); return ret; From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7948C433EF for ; Mon, 24 Jan 2022 20:01:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353936AbiAXUBV (ORCPT ); Mon, 24 Jan 2022 15:01:21 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34990 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345679AbiAXTha (ORCPT ); Mon, 24 Jan 2022 14:37:30 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 48CFC614A8; Mon, 24 Jan 2022 19:37:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27201C340E7; Mon, 24 Jan 2022 19:37:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053049; bh=YljHBSu8U7fYgPuBxiqBxuJLS3a+IyXUlt9fCs6zb+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kps0+E7pgVwkAleioERwVpFQy9pYjS+XPbWmvlARwty3R/0k96d4Qwuu3R6TcIweJ 1QD1bMeRZw4AJm2YKgTRqN2SK4LdUCSF3SDe2geR7kp6i2Cvx0GXVuHlqYKPEKkgu/ ya+ZWclMksHzJhF3nUssLOX9HoYzGr/b7+A5ucfI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John David Anglin , Helge Deller Subject: [PATCH 5.4 259/320] parisc: Fix lpa and lpa_user defines Date: Mon, 24 Jan 2022 19:44:03 +0100 Message-Id: <20220124184002.794686090@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 David Anglin commit db19c6f1a2a353cc8dec35b4789733a3cf6e2838 upstream. While working on the rewrite to the light-weight syscall and futex code, I experimented with using a hash index based on the user physical address of atomic variable. This exposed two problems with the lpa and lpa_user define= s. Because of the copy instruction, the pa argument needs to be an early clobb= er argument. This prevents gcc from allocating the va and pa arguments to the = same register. Secondly, the lpa instruction can cause a page fault so we need to catch exceptions. Signed-off-by: John David Anglin Fixes: 116d753308cf ("parisc: Use lpa instruction to load physical addresse= s in driver code") Signed-off-by: Helge Deller Cc: stable@vger.kernel.org # v5.2+ Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/parisc/include/asm/special_insns.h | 44 +++++++++++++++++----------= ----- 1 file changed, 24 insertions(+), 20 deletions(-) --- a/arch/parisc/include/asm/special_insns.h +++ b/arch/parisc/include/asm/special_insns.h @@ -2,28 +2,32 @@ #ifndef __PARISC_SPECIAL_INSNS_H #define __PARISC_SPECIAL_INSNS_H =20 -#define lpa(va) ({ \ - unsigned long pa; \ - __asm__ __volatile__( \ - "copy %%r0,%0\n\t" \ - "lpa %%r0(%1),%0" \ - : "=3Dr" (pa) \ - : "r" (va) \ - : "memory" \ - ); \ - pa; \ +#define lpa(va) ({ \ + unsigned long pa; \ + __asm__ __volatile__( \ + "copy %%r0,%0\n" \ + "8:\tlpa %%r0(%1),%0\n" \ + "9:\n" \ + ASM_EXCEPTIONTABLE_ENTRY(8b, 9b) \ + : "=3D&r" (pa) \ + : "r" (va) \ + : "memory" \ + ); \ + pa; \ }) =20 -#define lpa_user(va) ({ \ - unsigned long pa; \ - __asm__ __volatile__( \ - "copy %%r0,%0\n\t" \ - "lpa %%r0(%%sr3,%1),%0" \ - : "=3Dr" (pa) \ - : "r" (va) \ - : "memory" \ - ); \ - pa; \ +#define lpa_user(va) ({ \ + unsigned long pa; \ + __asm__ __volatile__( \ + "copy %%r0,%0\n" \ + "8:\tlpa %%r0(%%sr3,%1),%0\n" \ + "9:\n" \ + ASM_EXCEPTIONTABLE_ENTRY(8b, 9b) \ + : "=3D&r" (pa) \ + : "r" (va) \ + : "memory" \ + ); \ + pa; \ }) =20 #define mfctl(reg) ({ \ From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A545BC43217 for ; Mon, 24 Jan 2022 19:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359050AbiAXT4P (ORCPT ); Mon, 24 Jan 2022 14:56:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58796 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347814AbiAXThj (ORCPT ); Mon, 24 Jan 2022 14:37:39 -0500 Received: from smtp.kernel.org (relay.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 E84F3B80FA1; Mon, 24 Jan 2022 19:37:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 259BCC340E5; Mon, 24 Jan 2022 19:37:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053052; bh=rkWayZZC0RqM6hI7nNtYbd4ASzlnGge0fvI4FQpwk0c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NYoheFsO34MuS7+mv9OZFCG+sXXUmpSlrtIMW0yFyu68J9XNQHIegFvXmjhGnE817 vNwiO9taRJkwkdSBau8mJi8gFfc8/luvOSe/BOmMpWA4SoZa5Qso+XrO+ZnyukwyVd 0g35wseyLl4B/NNQJkT+1SKfnWwb37LOAWTydHVY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joseph Bao , Lukas Wunner , Bjorn Helgaas , Stuart Hayes Subject: [PATCH 5.4 260/320] PCI: pciehp: Fix infinite loop in IRQ handler upon power fault Date: Mon, 24 Jan 2022 19:44:04 +0100 Message-Id: <20220124184002.827563143@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Wunner commit 23584c1ed3e15a6f4bfab8dc5a88d94ab929ee12 upstream. The Power Fault Detected bit in the Slot Status register differs from all other hotplug events in that it is sticky: It can only be cleared after turning off slot power. Per PCIe r5.0, sec. 6.7.1.8: If a power controller detects a main power fault on the hot-plug slot, it must automatically set its internal main power fault latch [...]. The main power fault latch is cleared when software turns off power to the hot-plug slot. The stickiness used to cause interrupt storms and infinite loops which were fixed in 2009 by commits 5651c48cfafe ("PCI pciehp: fix power fault interrupt storm problem") and 99f0169c17f3 ("PCI: pciehp: enable software notification on empty slots"). Unfortunately in 2020 the infinite loop issue was inadvertently reintroduced by commit 8edf5332c393 ("PCI: pciehp: Fix MSI interrupt race"): The hardirq handler pciehp_isr() clears the PFD bit until pciehp's power_fault_detected flag is set. That happens in the IRQ thread pciehp_ist(), which never learns of the event because the hardirq handler is stuck in an infinite loop. Fix by setting the power_fault_detected flag already in the hardirq handler. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D214989 Link: https://lore.kernel.org/linux-pci/DM8PR11MB5702255A6A92F735D90A444686= 8B9@DM8PR11MB5702.namprd11.prod.outlook.com Fixes: 8edf5332c393 ("PCI: pciehp: Fix MSI interrupt race") Link: https://lore.kernel.org/r/66eaeef31d4997ceea357ad93259f290ededecfd.16= 37187226.git.lukas@wunner.de Reported-by: Joseph Bao Tested-by: Joseph Bao Signed-off-by: Lukas Wunner Signed-off-by: Bjorn Helgaas Cc: stable@vger.kernel.org # v4.19+ Cc: Stuart Hayes Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/pci/hotplug/pciehp_hpc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -577,6 +577,8 @@ read_status: */ if (ctrl->power_fault_detected) status &=3D ~PCI_EXP_SLTSTA_PFD; + else if (status & PCI_EXP_SLTSTA_PFD) + ctrl->power_fault_detected =3D true; =20 events |=3D status; if (!events) { @@ -586,7 +588,7 @@ read_status: } =20 if (status) { - pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, events); + pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, status); =20 /* * In MSI mode, all event bits must be zero before the port @@ -660,8 +662,7 @@ static irqreturn_t pciehp_ist(int irq, v } =20 /* Check Power Fault Detected */ - if ((events & PCI_EXP_SLTSTA_PFD) && !ctrl->power_fault_detected) { - ctrl->power_fault_detected =3D 1; + if (events & PCI_EXP_SLTSTA_PFD) { ctrl_err(ctrl, "Slot(%s): Power fault\n", slot_name(ctrl)); pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF, PCI_EXP_SLTCTL_ATTN_IND_ON); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EC5FC43219 for ; Mon, 24 Jan 2022 20:38:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386930AbiAXUgI (ORCPT ); Mon, 24 Jan 2022 15:36:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352811AbiAXUOO (ORCPT ); Mon, 24 Jan 2022 15:14:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53DFEC0604E7; Mon, 24 Jan 2022 11:37:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1BA07B81235; Mon, 24 Jan 2022 19:37:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3086DC340E5; Mon, 24 Jan 2022 19:37:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053055; bh=ql6piuZkCz58r60WoTyFBToaCwhIxWa4iazsS4gyJgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UTOPelgHsgv+A0EOdD3EHSBbBBPMGlBwq4APl20IzMCVFAB3muK8vsdQ1b6rSfis4 suDDxQ0+Pe57JAf7Y0XzuXC8R8+IfS7l4oaPNht+IE8mAWUiodJCbZF+ATBKww2Qo8 jInuQ4hPjerezC3vWYay/DNn6bu9iMC5mDKaVohY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Lorenzo Pieralisi Subject: [PATCH 5.4 261/320] PCI: pci-bridge-emul: Properly mark reserved PCIe bits in PCI config space Date: Mon, 24 Jan 2022 19:44:05 +0100 Message-Id: <20220124184002.859435416@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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 7b067ac63a5730d2fae18399fed7e45f23d36912 upstream. Some bits in PCI config space are reserved when device is PCIe. Properly define behavior of PCI registers for PCIe emulated bridge and ensure that it would not be possible change these reserved bits. Link: https://lore.kernel.org/r/20211124155944.1290-3-pali@kernel.org Fixes: 23a5fba4d941 ("PCI: Introduce PCI bridge emulated config space commo= n logic") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/pci/pci-bridge-emul.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) --- a/drivers/pci/pci-bridge-emul.c +++ b/drivers/pci/pci-bridge-emul.c @@ -300,6 +300,27 @@ int pci_bridge_emul_init(struct pci_brid kfree(bridge->pci_regs_behavior); return -ENOMEM; } + /* These bits are applicable only for PCI and reserved on PCIe */ + bridge->pci_regs_behavior[PCI_CACHE_LINE_SIZE / 4].ro &=3D + ~GENMASK(15, 8); + bridge->pci_regs_behavior[PCI_COMMAND / 4].ro &=3D + ~((PCI_COMMAND_SPECIAL | PCI_COMMAND_INVALIDATE | + PCI_COMMAND_VGA_PALETTE | PCI_COMMAND_WAIT | + PCI_COMMAND_FAST_BACK) | + (PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK | + PCI_STATUS_DEVSEL_MASK) << 16); + bridge->pci_regs_behavior[PCI_PRIMARY_BUS / 4].ro &=3D + ~GENMASK(31, 24); + bridge->pci_regs_behavior[PCI_IO_BASE / 4].ro &=3D + ~((PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK | + PCI_STATUS_DEVSEL_MASK) << 16); + bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].rw &=3D + ~((PCI_BRIDGE_CTL_MASTER_ABORT | + BIT(8) | BIT(9) | BIT(11)) << 16); + bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].ro &=3D + ~((PCI_BRIDGE_CTL_FAST_BACK) << 16); + bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].w1c &=3D + ~(BIT(10) << 16); } =20 if (flags & PCI_BRIDGE_EMUL_NO_PREFETCHABLE_BAR) { From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAEF5C433EF for ; Mon, 24 Jan 2022 20:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376282AbiAXUBO (ORCPT ); Mon, 24 Jan 2022 15:01:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58832 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348618AbiAXThn (ORCPT ); Mon, 24 Jan 2022 14:37:43 -0500 Received: from smtp.kernel.org (relay.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 229FBB81142; Mon, 24 Jan 2022 19:37:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48681C340E5; Mon, 24 Jan 2022 19:37:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053058; bh=4ZpRgW4Bcsrip4PUdaaioMGM1mw8+zX2JCcZ9hwNATU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O/3oiWqqZsasGCurFi6nMFcEcsgoR1onGCPjIGl2R0P41bkVwakii9O51CYHl8Jam keJm8fH0Ail9xYVipzS64SN6LR7iZ9lFKWRsw5ogXImFwkLD+tihii3HKFOjIpESC8 z9tQgZ81fCVqHOL5AV8Dq2N5SctRKJsIUKtjCwFs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Lorenzo Pieralisi Subject: [PATCH 5.4 262/320] PCI: pci-bridge-emul: Correctly set PCIe capabilities Date: Mon, 24 Jan 2022 19:44:06 +0100 Message-Id: <20220124184002.900020903@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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 1f1050c5e1fefb34ac90a506b43e9da803b5f8f7 upstream. Older mvebu hardware provides PCIe Capability structure only in version 1. New mvebu and aardvark hardware provides it in version 2. So do not force version to 2 in pci_bridge_emul_init() and rather allow drivers to set correct version. Drivers need to set version in pcie_conf.cap field without overwriting PCI_CAP_LIST_ID register. Both drivers (mvebu and aardvark) do not provide slot support yet, so do not set PCI_EXP_FLAGS_SLOT flag. Link: https://lore.kernel.org/r/20211124155944.1290-6-pali@kernel.org Fixes: 23a5fba4d941 ("PCI: Introduce PCI bridge emulated config space commo= n logic") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/pci/controller/pci-aardvark.c | 4 +++- drivers/pci/controller/pci-mvebu.c | 8 ++++++++ drivers/pci/pci-bridge-emul.c | 5 +---- 3 files changed, 12 insertions(+), 5 deletions(-) --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -863,7 +863,6 @@ advk_pci_bridge_emul_pcie_conf_read(stru return PCI_BRIDGE_EMUL_HANDLED; } =20 - case PCI_CAP_LIST_ID: case PCI_EXP_DEVCAP: case PCI_EXP_DEVCTL: *value =3D advk_readl(pcie, PCIE_CORE_PCIEXP_CAP + reg); @@ -944,6 +943,9 @@ static int advk_sw_pci_bridge_init(struc /* Support interrupt A for MSI feature */ bridge->conf.intpin =3D PCIE_CORE_INT_A_ASSERT_ENABLE; =20 + /* Aardvark HW provides PCIe Capability structure in version 2 */ + bridge->pcie_conf.cap =3D cpu_to_le16(2); + /* Indicates supports for Completion Retry Status */ bridge->pcie_conf.rootcap =3D cpu_to_le16(PCI_EXP_RTCAP_CRSVIS); =20 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -576,6 +576,8 @@ struct pci_bridge_emul_ops mvebu_pci_bri static void mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) { struct pci_bridge_emul *bridge =3D &port->bridge; + u32 pcie_cap =3D mvebu_readl(port, PCIE_CAP_PCIEXP); + u8 pcie_cap_ver =3D ((pcie_cap >> 16) & PCI_EXP_FLAGS_VERS); =20 bridge->conf.vendor =3D PCI_VENDOR_ID_MARVELL; bridge->conf.device =3D mvebu_readl(port, PCIE_DEV_ID_OFF) >> 16; @@ -588,6 +590,12 @@ static void mvebu_pci_bridge_emul_init(s bridge->conf.iolimit =3D PCI_IO_RANGE_TYPE_32; } =20 + /* + * Older mvebu hardware provides PCIe Capability structure only in + * version 1. New hardware provides it in version 2. + */ + bridge->pcie_conf.cap =3D cpu_to_le16(pcie_cap_ver); + bridge->has_pcie =3D true; bridge->data =3D port; bridge->ops =3D &mvebu_pci_bridge_emul_ops; --- a/drivers/pci/pci-bridge-emul.c +++ b/drivers/pci/pci-bridge-emul.c @@ -288,10 +288,7 @@ int pci_bridge_emul_init(struct pci_brid if (bridge->has_pcie) { bridge->conf.capabilities_pointer =3D PCI_CAP_PCIE_START; bridge->pcie_conf.cap_id =3D PCI_CAP_ID_EXP; - /* Set PCIe v2, root port, slot support */ - bridge->pcie_conf.cap =3D - cpu_to_le16(PCI_EXP_TYPE_ROOT_PORT << 4 | 2 | - PCI_EXP_FLAGS_SLOT); + bridge->pcie_conf.cap |=3D cpu_to_le16(PCI_EXP_TYPE_ROOT_PORT << 4); bridge->pcie_cap_regs_behavior =3D kmemdup(pcie_cap_regs_behavior, sizeof(pcie_cap_regs_behavior), From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10007C43217 for ; Mon, 24 Jan 2022 19:48:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354158AbiAXTsA (ORCPT ); Mon, 24 Jan 2022 14:48:00 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58860 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349723AbiAXTho (ORCPT ); Mon, 24 Jan 2022 14:37:44 -0500 Received: from smtp.kernel.org (relay.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 189ABB8121C; Mon, 24 Jan 2022 19:37:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F5CAC340E5; Mon, 24 Jan 2022 19:37:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053061; bh=gvwNwUL2uzlUhdpiHJOTQEv4OnE/kqW5SjOPiiqcIDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=izp9fJBeCiTso3o57AIVNTnTZPlu3thMaFxTI/4in5HL5PBkc/dDjnXy7gWey8X7s dtp+18TtSiq9pglijoHILVBH7pElMA6oRk+NWZZKV0o2THsepPiHoUHEfOC94LX+lX aoZFD90hKVDfpQVM8zsHoNR880Mn6q/BN0mp7Ns0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Lorenzo Pieralisi Subject: [PATCH 5.4 263/320] PCI: pci-bridge-emul: Set PCI_STATUS_CAP_LIST for PCIe device Date: Mon, 24 Jan 2022 19:44:07 +0100 Message-Id: <20220124184002.931227601@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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 3be9d243b21724d49b65043d4520d688b6040b36 upstream. Since all PCI Express device Functions are required to implement the PCI Express Capability structure, Capabilities List bit in PCI Status Register must be hardwired to 1b. Capabilities Pointer register (which is already set by pci-bride-emul.c driver) is valid only when Capabilities List is set to 1b. Link: https://lore.kernel.org/r/20211124155944.1290-7-pali@kernel.org Fixes: 23a5fba4d941 ("PCI: Introduce PCI bridge emulated config space commo= n logic") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Lorenzo Pieralisi Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/pci/pci-bridge-emul.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/pci/pci-bridge-emul.c +++ b/drivers/pci/pci-bridge-emul.c @@ -287,6 +287,7 @@ int pci_bridge_emul_init(struct pci_brid =20 if (bridge->has_pcie) { bridge->conf.capabilities_pointer =3D PCI_CAP_PCIE_START; + bridge->conf.status |=3D cpu_to_le16(PCI_STATUS_CAP_LIST); bridge->pcie_conf.cap_id =3D PCI_CAP_ID_EXP; bridge->pcie_conf.cap |=3D cpu_to_le16(PCI_EXP_TYPE_ROOT_PORT << 4); bridge->pcie_cap_regs_behavior =3D From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 916B7C4321E for ; Mon, 24 Jan 2022 19:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359017AbiAXT4J (ORCPT ); Mon, 24 Jan 2022 14:56:09 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35146 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349781AbiAXThq (ORCPT ); Mon, 24 Jan 2022 14:37:46 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 703CA6121F; Mon, 24 Jan 2022 19:37:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31C46C340E7; Mon, 24 Jan 2022 19:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053064; bh=MIGW9zqQbSvj2OlFGfCSxrMOEsdVAhrTP4QjjKHJvW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0vj5Mw5ANtqiY38w62AUWKq9+JVFFonVMzu4duPEw436q/t47DbN1V35DDSCorICH iuhKLkG6KqGgLREWtCIJrkGayoZxTVNofY+mAURx7+1vnNVSK2OJwBgoy8Dmy28RiR t4l0peha02TlFHBts1UmmPmMzNqy5bqZWiBYE6EA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ghalem Boudour , Nicolas Dichtel , Steffen Klassert Subject: [PATCH 5.4 264/320] xfrm: fix policy lookup for ipv6 gre packets Date: Mon, 24 Jan 2022 19:44:08 +0100 Message-Id: <20220124184002.961580557@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ghalem Boudour commit bcf141b2eb551b3477b24997ebc09c65f117a803 upstream. On egress side, xfrm lookup is called from __gre6_xmit() with the fl6_gre_key field not initialized leading to policies selectors check failure. Consequently, gre packets are sent without encryption. On ingress side, INET6_PROTO_NOPOLICY was set, thus packets were not checked against xfrm policies. Like for egress side, fl6_gre_key should be correctly set, this is now done in decode_session6(). Fixes: c12b395a4664 ("gre: Support GRE over IPv6") Cc: stable@vger.kernel.org Signed-off-by: Ghalem Boudour Signed-off-by: Nicolas Dichtel Signed-off-by: Steffen Klassert Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/ipv6/ip6_gre.c | 5 ++++- net/xfrm/xfrm_policy.c | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -743,6 +743,7 @@ static netdev_tx_t __gre6_xmit(struct sk fl6->daddr =3D key->u.ipv6.dst; fl6->flowlabel =3D key->label; fl6->flowi6_uid =3D sock_net_uid(dev_net(dev), NULL); + fl6->fl6_gre_key =3D tunnel_id_to_key32(key->tun_id); =20 dsfield =3D key->tos; flags =3D key->tun_flags & @@ -978,6 +979,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit fl6.daddr =3D key->u.ipv6.dst; fl6.flowlabel =3D key->label; fl6.flowi6_uid =3D sock_net_uid(dev_net(dev), NULL); + fl6.fl6_gre_key =3D tunnel_id_to_key32(key->tun_id); =20 dsfield =3D key->tos; if (!(tun_info->key.tun_flags & TUNNEL_ERSPAN_OPT)) @@ -1085,6 +1087,7 @@ static void ip6gre_tnl_link_config_commo fl6->flowi6_oif =3D p->link; fl6->flowlabel =3D 0; fl6->flowi6_proto =3D IPPROTO_GRE; + fl6->fl6_gre_key =3D t->parms.o_key; =20 if (!(p->flags&IP6_TNL_F_USE_ORIG_TCLASS)) fl6->flowlabel |=3D IPV6_TCLASS_MASK & p->flowinfo; @@ -1530,7 +1533,7 @@ static void ip6gre_fb_tunnel_init(struct static struct inet6_protocol ip6gre_protocol __read_mostly =3D { .handler =3D gre_rcv, .err_handler =3D ip6gre_err, - .flags =3D INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, + .flags =3D INET6_PROTO_FINAL, }; =20 static void ip6gre_destroy_tunnels(struct net *net, struct list_head *head) --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -33,6 +33,7 @@ #include #include #include +#include #if IS_ENABLED(CONFIG_IPV6_MIP6) #include #endif @@ -3443,6 +3444,26 @@ decode_session6(struct sk_buff *skb, str } fl6->flowi6_proto =3D nexthdr; return; + case IPPROTO_GRE: + if (!onlyproto && + (nh + offset + 12 < skb->data || + pskb_may_pull(skb, nh + offset + 12 - skb->data))) { + struct gre_base_hdr *gre_hdr; + __be32 *gre_key; + + nh =3D skb_network_header(skb); + gre_hdr =3D (struct gre_base_hdr *)(nh + offset); + gre_key =3D (__be32 *)(gre_hdr + 1); + + if (gre_hdr->flags & GRE_KEY) { + if (gre_hdr->flags & GRE_CSUM) + gre_key++; + fl6->fl6_gre_key =3D *gre_key; + } + } + fl6->flowi6_proto =3D nexthdr; + return; + #if IS_ENABLED(CONFIG_IPV6_MIP6) case IPPROTO_MH: offset +=3D ipv6_optlen(exthdr); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C22CDC433EF for ; Mon, 24 Jan 2022 20:39:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387469AbiAXUgv (ORCPT ); Mon, 24 Jan 2022 15:36:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355622AbiAXUOU (ORCPT ); Mon, 24 Jan 2022 15:14:20 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB0ABC0604EF; Mon, 24 Jan 2022 11:37:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7AD8461539; Mon, 24 Jan 2022 19:37:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BEF1C340E7; Mon, 24 Jan 2022 19:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053067; bh=q0kEHvgfyUNBC3C/H7YD6lnSgLEbGNKvhZR6jcYbeT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qLShVapidrykxZXsIP1DkH/GPy4ccs8IGIujJmrqAT+l/t4DbXiWGqjmf+sYGm21E WWRsPFKsmbN8mxx91JSk6jLQtAcpQcq9d7+jiB+XPjqE3KTVJ7mcoQx5wMfL0D4pFh qRMWw84d313LhRrmQxUy1aazpkgv9ceQq3uEc48g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hao Sun , Qu Wenruo , Filipe Manana , David Sterba Subject: [PATCH 5.4 265/320] btrfs: fix deadlock between quota enable and other quota operations Date: Mon, 24 Jan 2022 19:44:09 +0100 Message-Id: <20220124184002.992709316@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 232796df8c1437c41d308d161007f0715bac0a54 upstream. When enabling quotas, we attempt to commit a transaction while holding the mutex fs_info->qgroup_ioctl_lock. This can result on a deadlock with other quota operations such as: - qgroup creation and deletion, ioctl BTRFS_IOC_QGROUP_CREATE; - adding and removing qgroup relations, ioctl BTRFS_IOC_QGROUP_ASSIGN. This is because these operations join a transaction and after that they attempt to lock the mutex fs_info->qgroup_ioctl_lock. Acquiring that mutex after joining or starting a transaction is a pattern followed everywhere in qgroups, so the quota enablement operation is the one at fault here, and should not commit a transaction while holding that mutex. Fix this by making the transaction commit while not holding the mutex. We are safe from two concurrent tasks trying to enable quotas because we are serialized by the rw semaphore fs_info->subvol_sem at btrfs_ioctl_quota_ctl(), which is the only call site for enabling quotas. When this deadlock happens, it produces a trace like the following: INFO: task syz-executor:25604 blocked for more than 143 seconds. Not tainted 5.15.0-rc6 #4 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:syz-executor state:D stack:24800 pid:25604 ppid: 24873 flags:0x00004= 004 Call Trace: context_switch kernel/sched/core.c:4940 [inline] __schedule+0xcd9/0x2530 kernel/sched/core.c:6287 schedule+0xd3/0x270 kernel/sched/core.c:6366 btrfs_commit_transaction+0x994/0x2e90 fs/btrfs/transaction.c:2201 btrfs_quota_enable+0x95c/0x1790 fs/btrfs/qgroup.c:1120 btrfs_ioctl_quota_ctl fs/btrfs/ioctl.c:4229 [inline] btrfs_ioctl+0x637e/0x7b70 fs/btrfs/ioctl.c:5010 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860 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+0x44/0xae RIP: 0033:0x7f86920b2c4d RSP: 002b:00007f868f61ac58 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f86921d90a0 RCX: 00007f86920b2c4d RDX: 0000000020005e40 RSI: 00000000c0109428 RDI: 0000000000000008 RBP: 00007f869212bd80 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f86921d90a0 R13: 00007fff6d233e4f R14: 00007fff6d233ff0 R15: 00007f868f61adc0 INFO: task syz-executor:25628 blocked for more than 143 seconds. Not tainted 5.15.0-rc6 #4 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:syz-executor state:D stack:29080 pid:25628 ppid: 24873 flags:0x00004= 004 Call Trace: context_switch kernel/sched/core.c:4940 [inline] __schedule+0xcd9/0x2530 kernel/sched/core.c:6287 schedule+0xd3/0x270 kernel/sched/core.c:6366 schedule_preempt_disabled+0xf/0x20 kernel/sched/core.c:6425 __mutex_lock_common kernel/locking/mutex.c:669 [inline] __mutex_lock+0xc96/0x1680 kernel/locking/mutex.c:729 btrfs_remove_qgroup+0xb7/0x7d0 fs/btrfs/qgroup.c:1548 btrfs_ioctl_qgroup_create fs/btrfs/ioctl.c:4333 [inline] btrfs_ioctl+0x683c/0x7b70 fs/btrfs/ioctl.c:5014 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860 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+0x44/0xae Reported-by: Hao Sun Link: https://lore.kernel.org/linux-btrfs/CACkBjsZQF19bQ1C6=3DyetF3BvL10OSO= RpFUcWXTP6HErshDB4dQ@mail.gmail.com/ Fixes: 340f1aa27f36 ("btrfs: qgroups: Move transaction management inside bt= rfs_quota_enable/disable") CC: stable@vger.kernel.org # 4.19 Reviewed-by: Qu Wenruo Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/btrfs/qgroup.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -890,6 +890,14 @@ int btrfs_quota_enable(struct btrfs_fs_i int ret =3D 0; int slot; =20 + /* + * We need to have subvol_sem write locked, to prevent races between + * concurrent tasks trying to enable quotas, because we will unlock + * and relock qgroup_ioctl_lock before setting fs_info->quota_root + * and before setting BTRFS_FS_QUOTA_ENABLED. + */ + lockdep_assert_held_write(&fs_info->subvol_sem); + mutex_lock(&fs_info->qgroup_ioctl_lock); if (fs_info->quota_root) goto out; @@ -1035,8 +1043,19 @@ out_add_root: goto out_free_path; } =20 + mutex_unlock(&fs_info->qgroup_ioctl_lock); + /* + * Commit the transaction while not holding qgroup_ioctl_lock, to avoid + * a deadlock with tasks concurrently doing other qgroup operations, such + * adding/removing qgroups or adding/deleting qgroup relations for exampl= e, + * because all qgroup operations first start or join a transaction and th= en + * lock the qgroup_ioctl_lock mutex. + * We are safe from a concurrent task trying to enable quotas, by calling + * this function, since we are serialized by fs_info->subvol_sem. + */ ret =3D btrfs_commit_transaction(trans); trans =3D NULL; + mutex_lock(&fs_info->qgroup_ioctl_lock); if (ret) goto out_free_path; =20 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E58EFC433F5 for ; Mon, 24 Jan 2022 20:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387748AbiAXUhN (ORCPT ); Mon, 24 Jan 2022 15:37:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356214AbiAXUOw (ORCPT ); Mon, 24 Jan 2022 15:14:52 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E892C09B052; Mon, 24 Jan 2022 11:37:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 26BF8B81238; Mon, 24 Jan 2022 19:37:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A7D2C340E5; Mon, 24 Jan 2022 19:37:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053070; bh=kEkyCNZBvcElxWMg8I/Xi3Hk6q+Di49XLMC0Q1kRaME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iuGGVG6wLLETne1DU8lgcs5UzwxuDc9Dndio352zTUQl6nFfAoy+WIRIUnBKiaxTX IvzFQSBBWsZIbNgVHl1xDl2vL1Gde0jAqTQS9zFVAbRpuqj653FV22taKLxScA7Yh2 rJnFr/8LufcM5NQZvpyuv2dmJwKsCy6inCCe8KzU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikolay Borisov , Josef Bacik , David Sterba Subject: [PATCH 5.4 266/320] btrfs: check the root node for uptodate before returning it Date: Mon, 24 Jan 2022 19:44:10 +0100 Message-Id: <20220124184003.027352454@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Josef Bacik commit 120de408e4b97504a2d9b5ca534b383de2c73d49 upstream. Now that we clear the extent buffer uptodate if we fail to write it out we need to check to see if our root node is uptodate before we search down it. Otherwise we could return stale data (or potentially corrupt data that was caught by the write verification step) and think that the path is OK to search down. CC: stable@vger.kernel.org # 5.4+ Reviewed-by: Nikolay Borisov Signed-off-by: Josef Bacik Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/btrfs/ctree.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -2658,12 +2658,9 @@ static struct extent_buffer *btrfs_searc { struct btrfs_fs_info *fs_info =3D root->fs_info; struct extent_buffer *b; - int root_lock; + int root_lock =3D 0; int level =3D 0; =20 - /* We try very hard to do read locks on the root */ - root_lock =3D BTRFS_READ_LOCK; - if (p->search_commit_root) { /* * The commit roots are read only so we always do read locks, @@ -2701,6 +2698,9 @@ static struct extent_buffer *btrfs_searc goto out; } =20 + /* We try very hard to do read locks on the root */ + root_lock =3D BTRFS_READ_LOCK; + /* * If the level is set to maximum, we can skip trying to get the read * lock. @@ -2727,6 +2727,17 @@ static struct extent_buffer *btrfs_searc level =3D btrfs_header_level(b); =20 out: + /* + * The root may have failed to write out at some point, and thus is no + * longer valid, return an error in this case. + */ + if (!extent_buffer_uptodate(b)) { + if (root_lock) + btrfs_tree_unlock_rw(b, root_lock); + free_extent_buffer(b); + return ERR_PTR(-EIO); + } + p->nodes[level] =3D b; if (!p->skip_locking) p->locks[level] =3D root_lock; From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F01BAC433EF for ; Mon, 24 Jan 2022 20:38:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387099AbiAXUgW (ORCPT ); Mon, 24 Jan 2022 15:36:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379907AbiAXUPS (ORCPT ); Mon, 24 Jan 2022 15:15:18 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FADFC09B06E; Mon, 24 Jan 2022 11:37:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E2645B81215; Mon, 24 Jan 2022 19:37:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E5F7C340E5; Mon, 24 Jan 2022 19:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053076; bh=nl0Je5jDJ38BoGxWoqFJB3ZeEVEu2hoWQfk3tXR6mkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eoowTyG9K7GrXTyDbP529+eEAnOscgRwk9CY4oKxSRx4SoaBlrBXzgW93q8+F8uej P2tLBYBDIJRImWEOd/3dX/3tLr1Y74wIBMz1+cmE0QWlI3E4bgb9Kg4VhckRqgO+Yj fHb6MDABNYRwEo77/AILTpiIquLRtbuB5Z2EwJ/4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , David Sterba Subject: [PATCH 5.4 267/320] btrfs: respect the max size in the header when activating swap file Date: Mon, 24 Jan 2022 19:44:11 +0100 Message-Id: <20220124184003.059308977@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 c2f822635df873c510bda6fb7fd1b10b7c31be2d upstream. If we extended the size of a swapfile after its header was created (by the mkswap utility) and then try to activate it, we will map the entire file when activating the swap file, instead of limiting to the max size defined in the swap file's header. Currently test case generic/643 from fstests fails because we do not respect that size limit defined in the swap file's header. So fix this by not mapping file ranges beyond the max size defined in the swap header. This is the same type of bug that iomap used to have, and was fixed in commit 36ca7943ac18ae ("mm/swap: consider max pages in iomap_swapfile_add_extent"). Fixes: ed46ff3d423780 ("Btrfs: support swap files") CC: stable@vger.kernel.org # 5.4+ Reviewed-and-tested-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/btrfs/inode.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -10808,9 +10808,19 @@ static int btrfs_add_swap_extent(struct struct btrfs_swap_info *bsi) { unsigned long nr_pages; + unsigned long max_pages; u64 first_ppage, first_ppage_reported, next_ppage; int ret; =20 + /* + * Our swapfile may have had its size extended after the swap header was + * written. In that case activating the swapfile should not go beyond + * the max size set in the swap header. + */ + if (bsi->nr_pages >=3D sis->max) + return 0; + + max_pages =3D sis->max - bsi->nr_pages; first_ppage =3D ALIGN(bsi->block_start, PAGE_SIZE) >> PAGE_SHIFT; next_ppage =3D ALIGN_DOWN(bsi->block_start + bsi->block_len, PAGE_SIZE) >> PAGE_SHIFT; @@ -10818,6 +10828,7 @@ static int btrfs_add_swap_extent(struct if (first_ppage >=3D next_ppage) return 0; nr_pages =3D next_ppage - first_ppage; + nr_pages =3D min(nr_pages, max_pages); =20 first_ppage_reported =3D first_ppage; if (bsi->start =3D=3D 0) From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E09CC4321E for ; Mon, 24 Jan 2022 19:48:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357028AbiAXTsL (ORCPT ); Mon, 24 Jan 2022 14:48:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59098 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345772AbiAXTiC (ORCPT ); Mon, 24 Jan 2022 14:38:02 -0500 Received: from smtp.kernel.org (relay.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 CD7FEB81215; Mon, 24 Jan 2022 19:38:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F416CC340E5; Mon, 24 Jan 2022 19:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053079; bh=xn5CIkjOdhzi0YaD3ET90nmLIPGwL+NI53JbBeeAdXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TSSSPDOL8FymrBxVmc4QmIShf6VPzBMqI1zSMRBh7+9mT3E88SiLHwcygqKK/14zO NLV3p54TF/8WT6Nzf5QiyWmRuLORZ5ISUjlKIicq7uUKq4M0Qu0GOyrwXIyjLhU0+c 05cxxAES99iy8wNsgdMIIBe6A1tyXlrXB8L3Jsp4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , stable@kernel.org, Theodore Tso , syzbot+3b6f9218b1301ddda3e2@syzkaller.appspotmail.com Subject: [PATCH 5.4 268/320] ext4: make sure to reset inode lockdep class when quota enabling fails Date: Mon, 24 Jan 2022 19:44:12 +0100 Message-Id: <20220124184003.098755253@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara commit 4013d47a5307fdb5c13370b5392498b00fedd274 upstream. When we succeed in enabling some quota type but fail to enable another one with quota feature, we correctly disable all enabled quota types. However we forget to reset i_data_sem lockdep class. When the inode gets freed and reused, it will inherit this lockdep class (i_data_sem is initialized only when a slab is created) and thus eventually lockdep barfs about possible deadlocks. Reported-and-tested-by: syzbot+3b6f9218b1301ddda3e2@syzkaller.appspotmail.c= om Signed-off-by: Jan Kara Cc: stable@kernel.org Link: https://lore.kernel.org/r/20211007155336.12493-3-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/ext4/super.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -5998,8 +5998,19 @@ static int ext4_enable_quotas(struct sup "Failed to enable quota tracking " "(type=3D%d, err=3D%d). Please run " "e2fsck to fix.", type, err); - for (type--; type >=3D 0; type--) + for (type--; type >=3D 0; type--) { + struct inode *inode; + + inode =3D sb_dqopt(sb)->files[type]; + if (inode) + inode =3D igrab(inode); dquot_quota_off(sb, type); + if (inode) { + lockdep_set_quota_inode(inode, + I_DATA_SEM_NORMAL); + iput(inode); + } + } =20 return err; } From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2108EC4167B for ; Mon, 24 Jan 2022 19:48:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356968AbiAXTsC (ORCPT ); Mon, 24 Jan 2022 14:48:02 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35464 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346088AbiAXTiD (ORCPT ); Mon, 24 Jan 2022 14:38:03 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1A9CB6135E; Mon, 24 Jan 2022 19:38:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEC48C340E5; Mon, 24 Jan 2022 19:38:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053082; bh=WrPbiVsHL3R4O3QuRUsnYj8sP4lCgmZ79KNdHnoSs5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QROLokJm7FXJWaYjjnKEWjcZlhUKIzPLVO8RzrL4881U3pJYiMp9UXRYeS8clYhit pMrdLeG0qQ3gds+hS+UZAumUch/jcNv5hH4Ayo97rIDWqS+kBKgHQ2AoJ2i5Gj7Dwl ctO9ILS95+gSC4EfFxAU5A5giZJW/EHr1gC/PsEQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , stable@kernel.org, Theodore Tso Subject: [PATCH 5.4 269/320] ext4: make sure quota gets properly shutdown on error Date: Mon, 24 Jan 2022 19:44:13 +0100 Message-Id: <20220124184003.131541828@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara commit 15fc69bbbbbc8c72e5f6cc4e1be0f51283c5448e upstream. When we hit an error when enabling quotas and setting inode flags, we do not properly shutdown quota subsystem despite returning error from Q_QUOTAON quotactl. This can lead to some odd situations like kernel using quota file while it is still writeable for userspace. Make sure we properly cleanup the quota subsystem in case of error. Signed-off-by: Jan Kara Cc: stable@kernel.org Link: https://lore.kernel.org/r/20211007155336.12493-2-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/ext4/super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -5912,10 +5912,7 @@ static int ext4_quota_on(struct super_bl =20 lockdep_set_quota_inode(path->dentry->d_inode, I_DATA_SEM_QUOTA); err =3D dquot_quota_on(sb, type, format_id, path); - if (err) { - lockdep_set_quota_inode(path->dentry->d_inode, - I_DATA_SEM_NORMAL); - } else { + if (!err) { struct inode *inode =3D d_inode(path->dentry); handle_t *handle; =20 @@ -5935,7 +5932,12 @@ static int ext4_quota_on(struct super_bl ext4_journal_stop(handle); unlock_inode: inode_unlock(inode); + if (err) + dquot_quota_off(sb, type); } + if (err) + lockdep_set_quota_inode(path->dentry->d_inode, + I_DATA_SEM_NORMAL); return err; } =20 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9EADC433EF for ; Mon, 24 Jan 2022 19:48:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345825AbiAXTsU (ORCPT ); Mon, 24 Jan 2022 14:48:20 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35486 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344264AbiAXTiG (ORCPT ); Mon, 24 Jan 2022 14:38:06 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 067CE61525; Mon, 24 Jan 2022 19:38:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6A97C340E7; Mon, 24 Jan 2022 19:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053085; bh=FRukRTFFv3IyJWhgY9Oz80eIT2Q6q8nsT2qXjYOW4+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TXQnSNGXW1QRBZMN/Ilq5AUytLKRPIBSxwecXiQrWXKXxhvpLvQMQ7JTPOp5QwBYB jtSyNbNBJ5qXzm81evsXUu8q//Oe9p3mQLnpa3TfzeikCPOR4/n2lIugh7td7GQmTq XgWLxLl16/Sr7EaYMq2JzbUN8N+KuUgfdb63RzJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeroen van Wolffelaar , =?UTF-8?q?Lu=C3=ADs=20Henriques?= , Theodore Tso , stable@kernel.org Subject: [PATCH 5.4 270/320] ext4: set csum seed in tmp inode while migrating to extents Date: Mon, 24 Jan 2022 19:44:14 +0100 Message-Id: <20220124184003.161692485@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Lu=C3=ADs Henriques commit e81c9302a6c3c008f5c30beb73b38adb0170ff2d upstream. When migrating to extents, the temporary inode will have it's own checksum seed. This means that, when swapping the inodes data, the inode checksums will be incorrect. This can be fixed by recalculating the extents checksums again. Or simply by copying the seed into the temporary inode. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D213357 Reported-by: Jeroen van Wolffelaar Signed-off-by: Lu=C3=ADs Henriques Link: https://lore.kernel.org/r/20211214175058.19511-1-lhenriques@suse.de Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/ext4/migrate.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c @@ -477,6 +477,17 @@ int ext4_ext_migrate(struct inode *inode ext4_journal_stop(handle); goto out_unlock; } + /* + * Use the correct seed for checksum (i.e. the seed from 'inode'). This + * is so that the metadata blocks will have the correct checksum after + * the migration. + * + * Note however that, if a crash occurs during the migration process, + * the recovery process is broken because the tmp_inode checksums will + * be wrong and the orphans cleanup will fail. + */ + ei =3D EXT4_I(inode); + EXT4_I(tmp_inode)->i_csum_seed =3D ei->i_csum_seed; i_size_write(tmp_inode, i_size_read(inode)); /* * Set the i_nlink to zero so it will be deleted later @@ -520,7 +531,6 @@ int ext4_ext_migrate(struct inode *inode goto out_tmp_inode; } =20 - ei =3D EXT4_I(inode); i_data =3D ei->i_data; memset(&lb, 0, sizeof(lb)); =20 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 640E8C433F5 for ; Mon, 24 Jan 2022 20:39:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387903AbiAXUhc (ORCPT ); Mon, 24 Jan 2022 15:37:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380174AbiAXUPv (ORCPT ); Mon, 24 Jan 2022 15:15:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F23AC01D7D9; Mon, 24 Jan 2022 11:38:09 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F04E56153F; Mon, 24 Jan 2022 19:38:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D028CC340E5; Mon, 24 Jan 2022 19:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053088; bh=d8IOgUuOdHwvSdiUZmBss8YbbyUAUuGdEZthO3GUveo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KziIE3EoQlJm2LOXWvfLm0Qv7f1A7vt1OJrlu4bQcal+r5e2AlkRrMDVibCCKVbss dc4FIEvAQxBuc8ce2uXJBnfCyhQxDaVUbblX3A1TVxdGrhlNgUz3Wx/2sNOg+fX6CP 7R38p3rCU3yTGGPUZpc3ab1XP9RAdaMzp+YhovBs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Bin , Jan Kara , Theodore Tso , stable@kernel.org Subject: [PATCH 5.4 271/320] ext4: Fix BUG_ON in ext4_bread when write quota data Date: Mon, 24 Jan 2022 19:44:15 +0100 Message-Id: <20220124184003.200217039@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ye Bin commit 380a0091cab482489e9b19e07f2a166ad2b76d5c upstream. We got issue as follows when run syzkaller: [ 167.936972] EXT4-fs error (device loop0): __ext4_remount:6314: comm rep:= Abort forced by user [ 167.938306] EXT4-fs (loop0): Remounting filesystem read-only [ 167.981637] Assertion failure in ext4_getblk() at fs/ext4/inode.c:847: '= (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY) || handle !=3D NULL = || create =3D=3D 0' [ 167.983601] ------------[ cut here ]------------ [ 167.984245] kernel BUG at fs/ext4/inode.c:847! [ 167.984882] invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI [ 167.985624] CPU: 7 PID: 2290 Comm: rep Tainted: G B 5.16.= 0-rc5-next-20211217+ #123 [ 167.986823] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS = ?-20190727_073836-buildvm-ppc64le-16.ppc.fedoraproject.org-3.fc31 04/01/2014 [ 167.988590] RIP: 0010:ext4_getblk+0x17e/0x504 [ 167.989189] Code: c6 01 74 28 49 c7 c0 a0 a3 5c 9b b9 4f 03 00 00 48 c7 = c2 80 9c 5c 9b 48 c7 c6 40 b6 5c 9b 48 c7 c7 20 a4 5c 9b e8 77 e3 fd ff <0f= > 0b 8b 04 244 [ 167.991679] RSP: 0018:ffff8881736f7398 EFLAGS: 00010282 [ 167.992385] RAX: 0000000000000094 RBX: 1ffff1102e6dee75 RCX: 00000000000= 00000 [ 167.993337] RDX: 0000000000000001 RSI: ffffffff9b6e29e0 RDI: ffffed102e6= dee66 [ 167.994292] RBP: ffff88816a076210 R08: 0000000000000094 R09: ffffed10736= 3fa09 [ 167.995252] R10: ffff88839b1fd047 R11: ffffed107363fa08 R12: ffff88816a0= 761e8 [ 167.996205] R13: 0000000000000000 R14: 0000000000000021 R15: 00000000000= 00001 [ 167.997158] FS: 00007f6a1428c740(0000) GS:ffff88839b000000(0000) knlGS:= 0000000000000000 [ 167.998238] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 167.999025] CR2: 00007f6a140716c8 CR3: 0000000133216000 CR4: 00000000000= 006e0 [ 167.999987] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 00000000000= 00000 [ 168.000944] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 00000000000= 00400 [ 168.001899] Call Trace: [ 168.002235] [ 168.007167] ext4_bread+0xd/0x53 [ 168.007612] ext4_quota_write+0x20c/0x5c0 [ 168.010457] write_blk+0x100/0x220 [ 168.010944] remove_free_dqentry+0x1c6/0x440 [ 168.011525] free_dqentry.isra.0+0x565/0x830 [ 168.012133] remove_tree+0x318/0x6d0 [ 168.014744] remove_tree+0x1eb/0x6d0 [ 168.017346] remove_tree+0x1eb/0x6d0 [ 168.019969] remove_tree+0x1eb/0x6d0 [ 168.022128] qtree_release_dquot+0x291/0x340 [ 168.023297] v2_release_dquot+0xce/0x120 [ 168.023847] dquot_release+0x197/0x3e0 [ 168.024358] ext4_release_dquot+0x22a/0x2d0 [ 168.024932] dqput.part.0+0x1c9/0x900 [ 168.025430] __dquot_drop+0x120/0x190 [ 168.025942] ext4_clear_inode+0x86/0x220 [ 168.026472] ext4_evict_inode+0x9e8/0xa22 [ 168.028200] evict+0x29e/0x4f0 [ 168.028625] dispose_list+0x102/0x1f0 [ 168.029148] evict_inodes+0x2c1/0x3e0 [ 168.030188] generic_shutdown_super+0xa4/0x3b0 [ 168.030817] kill_block_super+0x95/0xd0 [ 168.031360] deactivate_locked_super+0x85/0xd0 [ 168.031977] cleanup_mnt+0x2bc/0x480 [ 168.033062] task_work_run+0xd1/0x170 [ 168.033565] do_exit+0xa4f/0x2b50 [ 168.037155] do_group_exit+0xef/0x2d0 [ 168.037666] __x64_sys_exit_group+0x3a/0x50 [ 168.038237] do_syscall_64+0x3b/0x90 [ 168.038751] entry_SYSCALL_64_after_hwframe+0x44/0xae In order to reproduce this problem, the following conditions need to be met: 1. Ext4 filesystem with no journal; 2. Filesystem image with incorrect quota data; 3. Abort filesystem forced by user; 4. umount filesystem; As in ext4_quota_write: ... if (EXT4_SB(sb)->s_journal && !handle) { ext4_msg(sb, KERN_WARNING, "Quota write (off=3D%llu, len= =3D%llu)" " cancelled because transaction is not started", (unsigned long long)off, (unsigned long long)len); return -EIO; } ... We only check handle if NULL when filesystem has journal. There is need check handle if NULL even when filesystem has no journal. Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20211223015506.297766-1-yebin10@huawei.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -6114,7 +6114,7 @@ static ssize_t ext4_quota_write(struct s struct buffer_head *bh; handle_t *handle =3D journal_current_handle(); =20 - if (EXT4_SB(sb)->s_journal && !handle) { + if (!handle) { ext4_msg(sb, KERN_WARNING, "Quota write (off=3D%llu, len=3D%llu)" " cancelled because transaction is not started", (unsigned long long)off, (unsigned long long)len); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26F9CC46467 for ; Mon, 24 Jan 2022 19:51:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350757AbiAXTuY (ORCPT ); Mon, 24 Jan 2022 14:50:24 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35862 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355281AbiAXTkW (ORCPT ); Mon, 24 Jan 2022 14:40:22 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9DBAA61031; Mon, 24 Jan 2022 19:40:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A6ACC340E5; Mon, 24 Jan 2022 19:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053221; bh=Rx8dchfiegJrJJRwYhJBopyQhGvxJQNkEZe4Sd9hbbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=spsIrxw+2mtkDVYB9481wgyjzKfIuu7HgGc8FwhsFHgk3p7NpE0c/qlEm/IlpVj5g T1mBE84WiKAzdWIUKsJhJoC+gKaVyACk85kvgDBeXJ3ymdtfx+Tk0a+k1DfUGtIR08 Sh+ffg7Tb5GgsAavy160V3SikWN2iYKYG7YPSlEE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , Lukas Czerner , stable@kernel.org Subject: [PATCH 5.4 272/320] ext4: dont use the orphan list when migrating an inode Date: Mon, 24 Jan 2022 19:44:16 +0100 Message-Id: <20220124184003.230984352@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Theodore Ts'o commit 6eeaf88fd586f05aaf1d48cb3a139d2a5c6eb055 upstream. We probably want to remove the indirect block to extents migration feature after a deprecation window, but until then, let's fix a potential data loss problem caused by the fact that we put the tmp_inode on the orphan list. In the unlikely case where we crash and do a journal recovery, the data blocks belonging to the inode being migrated are also represented in the tmp_inode on the orphan list --- and so its data blocks will get marked unallocated, and available for reuse. Instead, stop putting the tmp_inode on the oprhan list. So in the case where we crash while migrating the inode, we'll leak an inode, which is not a disaster. It will be easily fixed the next time we run fsck, and it's better than potentially having blocks getting claimed by two different files, and losing data as a result. Signed-off-by: Theodore Ts'o Reviewed-by: Lukas Czerner Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/ext4/migrate.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c @@ -455,12 +455,12 @@ int ext4_ext_migrate(struct inode *inode percpu_down_write(&sbi->s_writepages_rwsem); =20 /* - * Worst case we can touch the allocation bitmaps, a bgd - * block, and a block to link in the orphan list. We do need - * need to worry about credits for modifying the quota inode. + * Worst case we can touch the allocation bitmaps and a block + * group descriptor block. We do need need to worry about + * credits for modifying the quota inode. */ handle =3D ext4_journal_start(inode, EXT4_HT_MIGRATE, - 4 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); + 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); =20 if (IS_ERR(handle)) { retval =3D PTR_ERR(handle); @@ -481,10 +481,6 @@ int ext4_ext_migrate(struct inode *inode * Use the correct seed for checksum (i.e. the seed from 'inode'). This * is so that the metadata blocks will have the correct checksum after * the migration. - * - * Note however that, if a crash occurs during the migration process, - * the recovery process is broken because the tmp_inode checksums will - * be wrong and the orphans cleanup will fail. */ ei =3D EXT4_I(inode); EXT4_I(tmp_inode)->i_csum_seed =3D ei->i_csum_seed; @@ -496,7 +492,6 @@ int ext4_ext_migrate(struct inode *inode clear_nlink(tmp_inode); =20 ext4_ext_tree_init(handle, tmp_inode); - ext4_orphan_add(handle, tmp_inode); ext4_journal_stop(handle); =20 /* @@ -521,12 +516,6 @@ int ext4_ext_migrate(struct inode *inode =20 handle =3D ext4_journal_start(inode, EXT4_HT_MIGRATE, 1); if (IS_ERR(handle)) { - /* - * It is impossible to update on-disk structures without - * a handle, so just rollback in-core changes and live other - * work to orphan_list_cleanup() - */ - ext4_orphan_del(NULL, tmp_inode); retval =3D PTR_ERR(handle); goto out_tmp_inode; } From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23974C4332F for ; Tue, 25 Jan 2022 02:36:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422407AbiAYCbH (ORCPT ); Mon, 24 Jan 2022 21:31:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379630AbiAXUSc (ORCPT ); Mon, 24 Jan 2022 15:18:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F519C075953; Mon, 24 Jan 2022 11:38:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 182CCB8122A; Mon, 24 Jan 2022 19:38:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41097C340E7; Mon, 24 Jan 2022 19:38:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053112; bh=J3h6L2kwUZJ7G0s0Kn2R/BUw7Zxwyn30CVsABOeUez4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MnQ2o+rCDG+eV3jR4yMSFYxbFT7XyNfKfzSNN9CKs/iIz3ZJgTMlmy7Cb8XlSNXUk tVCJbKxS9cJsfE1SlPb1KnZziOOBNnVwDbwkdZ9g0qHKtiDlOeLpt+HlR/T0Dcdh13 ayaPe2FTUMGJZaxk83hYYp3iRKkipiHpI7aRpz5E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20K=C3=B6nig?= , Jan Stancek , Borislav Petkov , Alex Deucher Subject: [PATCH 5.4 273/320] drm/radeon: fix error handling in radeon_driver_open_kms Date: Mon, 24 Jan 2022 19:44:17 +0100 Message-Id: <20220124184003.262333170@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christian K=C3=B6nig commit 4722f463896cc0ef1a6f1c3cb2e171e949831249 upstream. The return value was never initialized so the cleanup code executed when it isn't even necessary. Just add proper error handling. Fixes: ab50cb9df889 ("drm/radeon/radeon_kms: Fix a NULL pointer dereference= in radeon_driver_open_kms()") Signed-off-by: Christian K=C3=B6nig Tested-by: Jan Stancek Tested-by: Borislav Petkov Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/radeon/radeon_kms.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -652,18 +652,18 @@ int radeon_driver_open_kms(struct drm_de fpriv =3D kzalloc(sizeof(*fpriv), GFP_KERNEL); if (unlikely(!fpriv)) { r =3D -ENOMEM; - goto out_suspend; + goto err_suspend; } =20 if (rdev->accel_working) { vm =3D &fpriv->vm; r =3D radeon_vm_init(rdev, vm); if (r) - goto out_fpriv; + goto err_fpriv; =20 r =3D radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); if (r) - goto out_vm_fini; + goto err_vm_fini; =20 /* map the ib pool buffer read only into * virtual address space */ @@ -671,7 +671,7 @@ int radeon_driver_open_kms(struct drm_de rdev->ring_tmp_bo.bo); if (!vm->ib_bo_va) { r =3D -ENOMEM; - goto out_vm_fini; + goto err_vm_fini; } =20 r =3D radeon_vm_bo_set_addr(rdev, vm->ib_bo_va, @@ -679,19 +679,21 @@ int radeon_driver_open_kms(struct drm_de RADEON_VM_PAGE_READABLE | RADEON_VM_PAGE_SNOOPED); if (r) - goto out_vm_fini; + goto err_vm_fini; } file_priv->driver_priv =3D fpriv; } =20 - if (!r) - goto out_suspend; + pm_runtime_mark_last_busy(dev->dev); + pm_runtime_put_autosuspend(dev->dev); + return 0; =20 -out_vm_fini: +err_vm_fini: radeon_vm_fini(rdev, vm); -out_fpriv: +err_fpriv: kfree(fpriv); -out_suspend: + +err_suspend: pm_runtime_mark_last_busy(dev->dev); pm_runtime_put_autosuspend(dev->dev); return r; From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4107AC433F5 for ; Mon, 24 Jan 2022 19:50:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357281AbiAXTtn (ORCPT ); Mon, 24 Jan 2022 14:49:43 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34628 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347433AbiAXTjH (ORCPT ); Mon, 24 Jan 2022 14:39:07 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 290FB614B8; Mon, 24 Jan 2022 19:39:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D5A1C340ED; Mon, 24 Jan 2022 19:39:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053146; bh=jDg9XGqHjkDJjhAXgWKbRhPaSoxWIUpSvlaXpemAD9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BCp+Pgvgfb8e/Jn9w+rlWQ7u5MN3VYeJQGDu6v1pBTWQJ6lyCAoPUTAO2v8rDZHC1 ipJI08tXHs93PXJAq1AHOdfSFqKleJTP2Oo6HkcwN3u+YYoM9FlET/t36WwdzXM+GT kG7T6SbzxZ8bF1deFVfALED5/oUxxCMJPnWZaNaQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baruch Siach , Rob Herring Subject: [PATCH 5.4 274/320] of: base: Improve argument length mismatch error Date: Mon, 24 Jan 2022 19:44:18 +0100 Message-Id: <20220124184003.297857000@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baruch Siach commit 5d05b811b5acb92fc581a7b328b36646c86f5ab9 upstream. The cells_name field of of_phandle_iterator might be NULL. Use the phandle name instead. With this change instead of: OF: /soc/pinctrl@1000000: (null) =3D 3 found 2 We get: OF: /soc/pinctrl@1000000: phandle pinctrl@1000000 needs 3, found 2 Which is a more helpful messages making DT debugging easier. In this particular example the phandle name looks like duplicate of the same node name. But note that the first node is the parent node (it->parent), while the second is the phandle target (it->node). They happen to be the same in the case that triggered this improvement. See commit 72cb4c48a46a ("arm64: dts: qcom: ipq6018: Fix gpio-ranges property"). Signed-off-by: Baruch Siach Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/f6a68e0088a552ea9dfd4d8e3b5b586d92594738.16= 40881913.git.baruch@tkos.co.il Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/of/base.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1366,9 +1366,14 @@ int of_phandle_iterator_next(struct of_p * property data length */ if (it->cur + count > it->list_end) { - pr_err("%pOF: %s =3D %d found %td\n", - it->parent, it->cells_name, - count, it->list_end - it->cur); + if (it->cells_name) + pr_err("%pOF: %s =3D %d found %td\n", + it->parent, it->cells_name, + count, it->list_end - it->cur); + else + pr_err("%pOF: phandle %s needs %d, found %td\n", + it->parent, of_node_full_name(it->node), + count, it->list_end - it->cur); goto err; } } From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23E36C4332F for ; Mon, 24 Jan 2022 19:50:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357435AbiAXTuA (ORCPT ); Mon, 24 Jan 2022 14:50:00 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58796 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354940AbiAXTjn (ORCPT ); Mon, 24 Jan 2022 14:39:43 -0500 Received: from smtp.kernel.org (relay.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 C0B2CB80FA1; Mon, 24 Jan 2022 19:39:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02BA8C340E5; Mon, 24 Jan 2022 19:39:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053180; bh=Kg6lB8gyFX7ICKo3+KWCWKtc2SOVkFcVpBWAYHfLIk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iXkqVAton2oKAhP/YUDzDfvYS1KneJDZ0k5KJb75XoDFxwHzoiM+zWKZFbq+LXVUf BlZyN3uEMiz6t3U+qU4wifaf90MT9rc9T6TWuL9cxImKhy0BeN9sCjvBQ/RNHrVJur fznXzYrAihCIgxtk6BoDRKu9De0ynz4ej3LCnxmw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julius Werner , Ben Hutchings Subject: [PATCH 5.4 275/320] firmware: Update Kconfig help text for Google firmware Date: Mon, 24 Jan 2022 19:44:19 +0100 Message-Id: <20220124184003.327989918@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ben Hutchings commit d185a3466f0cd5af8f1c5c782c53bc0e6f2e7136 upstream. The help text for GOOGLE_FIRMWARE states that it should only be enabled when building a kernel for Google's own servers. However, many of the drivers dependent on it are also useful on Chromebooks or on any platform using coreboot. Update the help text to reflect this double duty. Fixes: d384d6f43d1e ("firmware: google memconsole: Add coreboot support") Reviewed-by: Julius Werner Signed-off-by: Ben Hutchings Link: https://lore.kernel.org/r/20180618225540.GD14131@decadent.org.uk Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/firmware/google/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/firmware/google/Kconfig +++ b/drivers/firmware/google/Kconfig @@ -3,9 +3,9 @@ menuconfig GOOGLE_FIRMWARE bool "Google Firmware Drivers" default n help - These firmware drivers are used by Google's servers. They are - only useful if you are working directly on one of their - proprietary servers. If in doubt, say "N". + These firmware drivers are used by Google servers, + Chromebooks and other devices using coreboot firmware. + If in doubt, say "N". =20 if GOOGLE_FIRMWARE =20 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06D14C35268 for ; Mon, 24 Jan 2022 19:51:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357575AbiAXTuS (ORCPT ); Mon, 24 Jan 2022 14:50:18 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59098 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355137AbiAXTkE (ORCPT ); Mon, 24 Jan 2022 14:40:04 -0500 Received: from smtp.kernel.org (relay.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 AC34BB8119D; Mon, 24 Jan 2022 19:40:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5BECC340E5; Mon, 24 Jan 2022 19:40:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053202; bh=cAsgGxHRlMgNK0AryRN0I/ANz2aq81Z9fpR9OCPmRwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o1ECqNOoFFdGX5NY9hfFnDwNycKEleid+y2cyDIMk86eAnm3/PJm4rLpRqrtrAX8k W8PQQsWt6Lxz+9fqYSaM/RT7GRCvuSUZ4pjqc56c8oIhDc6lYbZFDS6/SQsvCHJ3ZX +acYBbM2lYZSt62DzqM1OJ8ngDKTsoZ3POhQq9j0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suresh Udipi , Michael Rodin , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.4 276/320] media: rcar-csi2: Optimize the selection PHTW register Date: Mon, 24 Jan 2022 19:44:20 +0100 Message-Id: <20220124184003.361849513@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Suresh Udipi commit 549cc89cd09a85aaa16dc07ef3db811d5cf9bcb1 upstream. PHTW register is selected based on default bit rate from Table[1]. for the bit rates less than or equal to 250. Currently first value of default bit rate which is greater than or equal to the caculated mbps is selected. This selection can be further improved by selecting the default bit rate which is nearest to the calculated value. [1] specs r19uh0105ej0200-r-car-3rd-generation.pdf [Table 25.12] Fixes: 769afd212b16 ("media: rcar-csi2: add Renesas R-Car MIPI CSI-2 receiv= er driver") Signed-off-by: Suresh Udipi Signed-off-by: Michael Rodin Reviewed-by: Niklas S=C3=B6derlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/media/platform/rcar-vin/rcar-csi2.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/drivers/media/platform/rcar-vin/rcar-csi2.c +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c @@ -911,10 +911,17 @@ static int rcsi2_phtw_write_mbps(struct const struct rcsi2_mbps_reg *values, u16 code) { const struct rcsi2_mbps_reg *value; + const struct rcsi2_mbps_reg *prev_value =3D NULL; =20 - for (value =3D values; value->mbps; value++) + for (value =3D values; value->mbps; value++) { if (value->mbps >=3D mbps) break; + prev_value =3D value; + } + + if (prev_value && + ((mbps - prev_value->mbps) <=3D (value->mbps - mbps))) + value =3D prev_value; =20 if (!value->mbps) { dev_err(priv->dev, "Unsupported PHY speed (%u Mbps)", mbps); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48794C4321E for ; Tue, 25 Jan 2022 02:36:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422914AbiAYCcY (ORCPT ); Mon, 24 Jan 2022 21:32:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355546AbiAXUWa (ORCPT ); Mon, 24 Jan 2022 15:22:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E85B2C0417CD; Mon, 24 Jan 2022 11:40:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 87DD66135E; Mon, 24 Jan 2022 19:40:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A815C340E5; Mon, 24 Jan 2022 19:40:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053206; bh=Ss9cJ1xCoPXGKemzTHnuPgLOcrn/oCFFznA4VV3+pwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WUD6ZmlJtRmcwHo+Zd6D6EHzKzhWzoIYvjwBwqJWpf5ciP1IM8HP7y2zAtB4hSpn4 y+o5epPQ6MEGj4XDcOokDds2f+wls7rp+CvNePGkr4uwp9IE0kUrk9uITltufESj1h SOFwVPaG88/2X8EsTEYOXPMbbmTWOxa91mGApV5Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Thompson , Vinod Koul Subject: [PATCH 5.4 277/320] Documentation: dmaengine: Correctly describe dmatest with channel unset Date: Mon, 24 Jan 2022 19:44:21 +0100 Message-Id: <20220124184003.392558506@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Thompson commit c61d7b2ef141abf81140756b45860a2306f395a2 upstream. Currently the documentation states that channels must be configured before running the dmatest. This has not been true since commit 6b41030fdc79 ("dmaengine: dmatest: Restore default for channel"). Fix accordingly. Fixes: 6b41030fdc79 ("dmaengine: dmatest: Restore default for channel") Signed-off-by: Daniel Thompson Link: https://lore.kernel.org/r/20211118100952.27268-3-daniel.thompson@lina= ro.org Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- Documentation/driver-api/dmaengine/dmatest.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/Documentation/driver-api/dmaengine/dmatest.rst +++ b/Documentation/driver-api/dmaengine/dmatest.rst @@ -143,13 +143,14 @@ Part 5 - Handling channel allocation Allocating Channels ------------------- =20 -Channels are required to be configured prior to starting the test run. -Attempting to run the test without configuring the channels will fail. +Channels do not need to be configured prior to starting a test run. Attemp= ting +to run the test without configuring the channels will result in testing any +channels that are available. =20 Example:: =20 % echo 1 > /sys/module/dmatest/parameters/run - dmatest: Could not start test, no channels configured + dmatest: No channels configured, continue with any =20 Channels are registered using the "channel" parameter. Channels can be req= uested by their name, once requested, the channel is registered and a pending thread is ad= ded to the test list. From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7274AC433F5 for ; Tue, 25 Jan 2022 02:36:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422951AbiAYCci (ORCPT ); Mon, 24 Jan 2022 21:32:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355551AbiAXUWa (ORCPT ); Mon, 24 Jan 2022 15:22:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89917C0417CE; Mon, 24 Jan 2022 11:40:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 51E28B81215; Mon, 24 Jan 2022 19:40:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74CE8C340E5; Mon, 24 Jan 2022 19:40:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053209; bh=/CkJZbBS/noqHTVzt9gb1OaMJAK407vUfQxtvkkrFfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2LiZgTyZEXUnOWd2dJuGh+dWOk+/XFW2H4Rcno9IhEuXu4fRrmSginiCXvN9aJS51 TQUJ9jxSzQBnCWVUBoZ1ae9PohqAh1Xv1gTgdnvRIfOTf14qXFqU8NYKJTZ5sfTFME mhcTRd7c9ro1rZogPO+1GkUXQE7KOc0pXv5Q0O94= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sakari Ailus , Andy Shevchenko , "Rafael J. Wysocki" Subject: [PATCH 5.4 278/320] Documentation: ACPI: Fix data node reference documentation Date: Mon, 24 Jan 2022 19:44:22 +0100 Message-Id: <20220124184003.431781304@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sakari Ailus commit a11174952205d082f1658fab4314f0caf706e0a8 upstream. The data node reference documentation was missing a package that must contain the property values, instead property name and multiple values being present in a single package. This is not aligned with the _DSD spec. Fix it by adding the package for the values. Also add the missing "reg" properties to two numbered nodes. Fixes: b10134a3643d ("ACPI: property: Document hierarchical data extension = references") Signed-off-by: Sakari Ailus Reviewed-by: Andy Shevchenko Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- Documentation/firmware-guide/acpi/dsd/data-node-references.rst | 10 ++++= ++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/Documentation/firmware-guide/acpi/dsd/data-node-references.rst +++ b/Documentation/firmware-guide/acpi/dsd/data-node-references.rst @@ -5,7 +5,7 @@ Referencing hierarchical data nodes =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -:Copyright: |copy| 2018 Intel Corporation +:Copyright: |copy| 2018, 2021 Intel Corporation :Author: Sakari Ailus =20 ACPI in general allows referring to device objects in the tree only. @@ -52,12 +52,14 @@ the ANOD object which is also the final Name (NOD0, Package() { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { + Package () { "reg", 0 }, Package () { "random-property", 3 }, } }) Name (NOD1, Package() { ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), Package () { + Package () { "reg", 1 }, Package () { "anothernode", "ANOD" }, } }) @@ -74,7 +76,11 @@ the ANOD object which is also the final Name (_DSD, Package () { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { - Package () { "reference", ^DEV0, "node@1", "anothernode" }, + Package () { + "reference", Package () { + ^DEV0, "node@1", "anothernode" + } + }, } }) } From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67BFFC4167B for ; Mon, 24 Jan 2022 19:51:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235750AbiAXTum (ORCPT ); Mon, 24 Jan 2022 14:50:42 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37660 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355211AbiAXTkN (ORCPT ); Mon, 24 Jan 2022 14:40:13 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8D1EF6153D; Mon, 24 Jan 2022 19:40:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75482C340E5; Mon, 24 Jan 2022 19:40:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053212; bh=vwRGDU4N4TbEApmcUFKQ4hpx5acenT08Vv9AbCWceh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zGGbO5yH3okHFASZyKbZ6qc6YgSQt677DGCmKh8qggMeDlgIJGbOuNX6CaBD7n6wf ETnPbgQCa5cxSsfC+yvhV5fmWwLMv6v7R09U0b/hoWsb+IHcS47RHgFUoC6SNAdWBp gJsyeosvORYxTTWT9rYp+P3Hw8gXMRPtX469b+X8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Bulwahn , Jonathan Corbet Subject: [PATCH 5.4 279/320] Documentation: refer to config RANDOMIZE_BASE for kernel address-space randomization Date: Mon, 24 Jan 2022 19:44:23 +0100 Message-Id: <20220124184003.466568032@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Bulwahn commit 82ca67321f55a8d1da6ac3ed611da3c32818bb37 upstream. The config RANDOMIZE_SLAB does not exist, the authors probably intended to refer to the config RANDOMIZE_BASE, which provides kernel address-space randomization. They probably just confused SLAB with BASE (these two four-letter words coincidentally share three common letters), as they also point out the config SLAB_FREELIST_RANDOM as further randomization within the same sentence. Fix the reference of the config for kernel address-space randomization to the config that provides that. Fixes: 6e88559470f5 ("Documentation: Add section about CPU vulnerabilities = for Spectre") Signed-off-by: Lukas Bulwahn Link: https://lore.kernel.org/r/20211230171940.27558-1-lukas.bulwahn@gmail.= com Signed-off-by: Jonathan Corbet Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- Documentation/admin-guide/hw-vuln/spectre.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/Documentation/admin-guide/hw-vuln/spectre.rst +++ b/Documentation/admin-guide/hw-vuln/spectre.rst @@ -468,7 +468,7 @@ Spectre variant 2 before invoking any firmware code to prevent Spectre variant 2 exploits using the firmware. =20 - Using kernel address space randomization (CONFIG_RANDOMIZE_SLAB=3Dy + Using kernel address space randomization (CONFIG_RANDOMIZE_BASE=3Dy and CONFIG_SLAB_FREELIST_RANDOM=3Dy in the kernel configuration) makes attacks on the kernel generally more difficult. =20 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C04BAC4167B for ; Tue, 25 Jan 2022 02:36:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422992AbiAYCcm (ORCPT ); Mon, 24 Jan 2022 21:32:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355493AbiAXUWb (ORCPT ); Mon, 24 Jan 2022 15:22:31 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 011A5C0417CF; Mon, 24 Jan 2022 11:40:16 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 93417612E9; Mon, 24 Jan 2022 19:40:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53B61C340E5; Mon, 24 Jan 2022 19:40:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053215; bh=9wTFvCDXsLGr2ff4ZSyAlfnhmj5VqNbcLjP9DYhL73E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0MBK2adB3ZfirpDsAaEk+ej3glhLr53h5y0xvfkBc7iuOku5VatHsSsThQv+eclma QugK/cgxGny1a53ANo4kMERw0kGjdhMjnbsFCnECsIuNyN2ruHq7foRgoZYExmidgW qZEgylkrfqZ1qBP3Fijzm7HUcTbEC+KU6dZiMmao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Akira Yokosawa , Jonathan Corbet Subject: [PATCH 5.4 280/320] Documentation: fix firewire.rst ABI file path error Date: Mon, 24 Jan 2022 19:44:24 +0100 Message-Id: <20220124184003.504380023@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Randy Dunlap commit b0ac702f3329cdc8a06dcaac73183d4b5a2b942d upstream. Adjust the path of the ABI files for firewire.rst to prevent a documentation build error. Prevents this problem: Sphinx parallel build error: docutils.utils.SystemMessage: Documentation/driver-api/firewire.rst:22: (SE= VERE/4) Problems with "include" directive path: InputError: [Errno 2] No such file or directory: '../Documentation/driver-a= pi/ABI/stable/firewire-cdev'. Fixes: 2f4830ef96d2 ("FireWire: add driver-api Introduction section") Signed-off-by: Randy Dunlap Tested-by: Akira Yokosawa Link: https://lore.kernel.org/r/20220119033905.4779-1-rdunlap@infradead.org Signed-off-by: Jonathan Corbet Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- Documentation/driver-api/firewire.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/Documentation/driver-api/firewire.rst +++ b/Documentation/driver-api/firewire.rst @@ -19,7 +19,7 @@ of kernel interfaces is available via ex Firewire char device data structures =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -.. include:: /ABI/stable/firewire-cdev +.. include:: ../ABI/stable/firewire-cdev :literal: =20 .. kernel-doc:: include/uapi/linux/firewire-cdev.h @@ -28,7 +28,7 @@ Firewire char device data structures Firewire device probing and sysfs interfaces =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -.. include:: /ABI/stable/sysfs-bus-firewire +.. include:: ../ABI/stable/sysfs-bus-firewire :literal: =20 .. kernel-doc:: drivers/firewire/core-device.c From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BBA1C4167E for ; Tue, 25 Jan 2022 02:36:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3423091AbiAYCcy (ORCPT ); Mon, 24 Jan 2022 21:32:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356111AbiAXUWc (ORCPT ); Mon, 24 Jan 2022 15:22:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 918AAC0417D1; Mon, 24 Jan 2022 11:40:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 39B88B81239; Mon, 24 Jan 2022 19:40:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66C9FC340E7; Mon, 24 Jan 2022 19:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053218; bh=Nfhpuzi4irbRQN3E3HkAZc4HSOT9aiM10z8KebCFNVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i4k9PuQsRNigywDeO/YurS5pO1DBwUkuyuye5MIq3J6Fwduy28IGnv9rzjTDPEdcu naJ2naVo4RmqsDbuCdfxvnWf5E3grSBUUNX2Mym1zSLO8A0ApDc9+nlPJjEhkeOqVU dwFAe3S0jSJLGdB61f3w5YlDz5UhUOXi+qh6Rtsg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , "Martin K. Petersen" Subject: [PATCH 5.4 281/320] scsi: core: Show SCMD_LAST in text form Date: Mon, 24 Jan 2022 19:44:25 +0100 Message-Id: <20220124184003.536800740@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche commit 3369046e54ca8f82e0cb17740643da2d80d3cfa8 upstream. The SCSI debugfs code supports showing information about pending commands, including translating SCSI command flags from numeric into text format. Also convert the SCMD_LAST flag from numeric into text form. Link: https://lore.kernel.org/r/20211129194609.3466071-4-bvanassche@acm.org Fixes: 8930a6c20791 ("scsi: core: add support for request batching") Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/scsi/scsi_debugfs.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/scsi/scsi_debugfs.c +++ b/drivers/scsi/scsi_debugfs.c @@ -10,6 +10,7 @@ static const char *const scsi_cmd_flags[ SCSI_CMD_FLAG_NAME(TAGGED), SCSI_CMD_FLAG_NAME(UNCHECKED_ISA_DMA), SCSI_CMD_FLAG_NAME(INITIALIZED), + SCSI_CMD_FLAG_NAME(LAST), }; #undef SCSI_CMD_FLAG_NAME =20 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01F80C4332F for ; Mon, 24 Jan 2022 20:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388959AbiAXUkS (ORCPT ); Mon, 24 Jan 2022 15:40:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348246AbiAXUTP (ORCPT ); Mon, 24 Jan 2022 15:19:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 545D5C07595F; Mon, 24 Jan 2022 11:38:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0F692B8122F; Mon, 24 Jan 2022 19:38:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36B99C340E7; Mon, 24 Jan 2022 19:38:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053115; bh=M9oIfxmAlJKoa8Khik9yGYB1gk0CI7pD+tdr8Mbg2A0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJ2AIF4oq4sPy+F0jD+7+roKg4PlcJPmUPPhMhvzvHRxx0bMrjrlr8g/pmTMwp2t7 GRkaZ4ytHH6/3QF0AOioUSapQ9RUsvM8R5kHs/sn2OgASz5beQeXErJtJtfirGDqAL xL6yZUc9mrhTRcBoSl1O9EyqFcxjfRtujP3YnR2g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yixing Liu , Wenpeng Liang , Jason Gunthorpe Subject: [PATCH 5.4 282/320] RDMA/hns: Modify the mapping attribute of doorbell to device Date: Mon, 24 Jan 2022 19:44:26 +0100 Message-Id: <20220124184003.567963329@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yixing Liu commit 39d5534b1302189c809e90641ffae8cbdc42a8fc upstream. It is more general for ARM device drivers to use the device attribute to map PCI BAR spaces. Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver") Link: https://lore.kernel.org/r/20211206133652.27476-1-liangwenpeng@huawei.= com Signed-off-by: Yixing Liu Signed-off-by: Wenpeng Liang Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/infiniband/hw/hns/hns_roce_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -362,7 +362,7 @@ static int hns_roce_mmap(struct ib_ucont return rdma_user_mmap_io(context, vma, to_hr_ucontext(context)->uar.pfn, PAGE_SIZE, - pgprot_noncached(vma->vm_page_prot)); + pgprot_device(vma->vm_page_prot)); =20 /* vm_pgoff: 1 -- TPTR */ case 1: From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F858C4332F for ; Tue, 25 Jan 2022 02:36:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422537AbiAYCbd (ORCPT ); Mon, 24 Jan 2022 21:31:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345124AbiAXUTV (ORCPT ); Mon, 24 Jan 2022 15:19:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CAF0C075966; Mon, 24 Jan 2022 11:38:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 057DDB81188; Mon, 24 Jan 2022 19:38:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CE5CC340E5; Mon, 24 Jan 2022 19:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053118; bh=7MnhLEjkv5OmPQOjR5kPlUEAsHS1KKAq0CkG2/QiCQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GikW50vF+3ZC1A5IulqEh/9wZDFGjXaN70FyJpp5MpSRf9C8V8+115KqwsFLVwmp+ Opv1QqEHtLdsPMP+SJkA0e8VUhNrsLJwGE0hGlhYBk+jJa9aJmhVuvqLnG4PFxuj7+ rVL4cIrhhrcwi/HIyyvT5EgzQpOEXJQHr+OR8dKM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chengguang Xu , Zhu Yanjun , Bob Pearson , Jason Gunthorpe Subject: [PATCH 5.4 283/320] RDMA/rxe: Fix a typo in opcode name Date: Mon, 24 Jan 2022 19:44:27 +0100 Message-Id: <20220124184003.600809394@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chengguang Xu commit 8d1cfb884e881efd69a3be4ef10772c71cb22216 upstream. There is a redundant ']' in the name of opcode IB_OPCODE_RC_SEND_MIDDLE, so just fix it. Fixes: 8700e3e7c485 ("Soft RoCE driver") Link: https://lore.kernel.org/r/20211218112320.3558770-1-cgxu519@mykernel.n= et Signed-off-by: Chengguang Xu Acked-by: Zhu Yanjun Reviewed-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/infiniband/sw/rxe/rxe_opcode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/infiniband/sw/rxe/rxe_opcode.c +++ b/drivers/infiniband/sw/rxe/rxe_opcode.c @@ -137,7 +137,7 @@ struct rxe_opcode_info rxe_opcode[RXE_NU } }, [IB_OPCODE_RC_SEND_MIDDLE] =3D { - .name =3D "IB_OPCODE_RC_SEND_MIDDLE]", + .name =3D "IB_OPCODE_RC_SEND_MIDDLE", .mask =3D RXE_PAYLOAD_MASK | RXE_REQ_MASK | RXE_SEND_MASK | RXE_MIDDLE_MASK, .length =3D RXE_BTH_BYTES, From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78282C433EF for ; Mon, 24 Jan 2022 19:49:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356596AbiAXTtX (ORCPT ); Mon, 24 Jan 2022 14:49:23 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59656 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349112AbiAXTio (ORCPT ); Mon, 24 Jan 2022 14:38:44 -0500 Received: from smtp.kernel.org (relay.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 39BBFB8122F; Mon, 24 Jan 2022 19:38:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A569C340E5; Mon, 24 Jan 2022 19:38:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053122; bh=j8QhFAcoP5YnbewakrrigomulAjYONylTaD5Y1/NRwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zpNsqtbCGHfMTLfB0p7FMHPteZVZUdGf2S+r8v7EkBPRq5euAMngD+dLVmPdoqIRZ AeJfg5UB+lpV/euga+F8q2Z7KGC2O/tu/XQvA789Mtk/UjWWnhrbImZwfb4d9lB8s+ gWcT65vc/dVYxHL2fCXgGGBwbucfw+1M/UVzVuBk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amelie Delaunay , Vinod Koul Subject: [PATCH 5.4 284/320] dmaengine: stm32-mdma: fix STM32_MDMA_CTBR_TSEL_MASK Date: Mon, 24 Jan 2022 19:44:28 +0100 Message-Id: <20220124184003.630479015@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Amelie Delaunay commit e7f110889a87307fb0fed408a5dee1707796ca04 upstream. This patch fixes STM32_MDMA_CTBR_TSEL_MASK, which is [5:0], not [7:0]. Fixes: a4ffb13c8946 ("dmaengine: Add STM32 MDMA driver") Signed-off-by: Amelie Delaunay Link: https://lore.kernel.org/r/20211220165827.1238097-1-amelie.delaunay@fo= ss.st.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/dma/stm32-mdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/dma/stm32-mdma.c +++ b/drivers/dma/stm32-mdma.c @@ -184,7 +184,7 @@ #define STM32_MDMA_CTBR(x) (0x68 + 0x40 * (x)) #define STM32_MDMA_CTBR_DBUS BIT(17) #define STM32_MDMA_CTBR_SBUS BIT(16) -#define STM32_MDMA_CTBR_TSEL_MASK GENMASK(7, 0) +#define STM32_MDMA_CTBR_TSEL_MASK GENMASK(5, 0) #define STM32_MDMA_CTBR_TSEL(n) STM32_MDMA_SET(n, \ STM32_MDMA_CTBR_TSEL_MASK) =20 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C8D1C433EF for ; Tue, 25 Jan 2022 02:36:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422559AbiAYCbf (ORCPT ); Mon, 24 Jan 2022 21:31:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347413AbiAXUTV (ORCPT ); Mon, 24 Jan 2022 15:19:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB46EC07596F; Mon, 24 Jan 2022 11:38:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8BDFA6148B; Mon, 24 Jan 2022 19:38:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D62FC340E5; Mon, 24 Jan 2022 19:38:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053125; bh=PivZKGnOzd2O9y7F4oVeB7DXqDj2PYX04tcxn/ZNV40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O5BboJwV54oG3Q9rROPBqkr5HR0SKE/8Q6zDC6S4T5PddCca6MnKz96ucpwD1NVYq sIj+vOKS/P9DIX4RYsHMxMet9jU0ks6aC/mumr6+oORSMCeb2H79FZzqCO59iE1nQh gejM0+8KCYm0jwKSvcKgZoZdIteZQJLSNyyecy44= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Moshe Shemesh , Eran Ben Elisha , Saeed Mahameed Subject: [PATCH 5.4 285/320] Revert "net/mlx5: Add retry mechanism to the command entry index allocation" Date: Mon, 24 Jan 2022 19:44:29 +0100 Message-Id: <20220124184003.661305647@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Moshe Shemesh commit 4f6626b0e140867fd6d5a2e9d4ceaef97f10f46a upstream. This reverts commit 410bd754cd73c4a2ac3856d9a03d7b08f9c906bf. The reverted commit had added a retry mechanism to the command entry index allocation. The previous patch ensures that there is a free command entry index once the command work handler holds the command semaphore. Thus the retry mechanism is not needed. Fixes: 410bd754cd73 ("net/mlx5: Add retry mechanism to the command entry in= dex allocation") Signed-off-by: Moshe Shemesh Reviewed-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -887,25 +887,6 @@ static bool opcode_allowed(struct mlx5_c return cmd->allowed_opcode =3D=3D opcode; } =20 -static int cmd_alloc_index_retry(struct mlx5_cmd *cmd) -{ - unsigned long alloc_end =3D jiffies + msecs_to_jiffies(1000); - int idx; - -retry: - idx =3D cmd_alloc_index(cmd); - if (idx < 0 && time_before(jiffies, alloc_end)) { - /* Index allocation can fail on heavy load of commands. This is a tempor= ary - * situation as the current command already holds the semaphore, meaning= that - * another command completion is being handled and it is expected to rel= ease - * the entry index soon. - */ - cpu_relax(); - goto retry; - } - return idx; -} - static void cmd_work_handler(struct work_struct *work) { struct mlx5_cmd_work_ent *ent =3D container_of(work, struct mlx5_cmd_work= _ent, work); @@ -923,7 +904,7 @@ static void cmd_work_handler(struct work sem =3D ent->page_queue ? &cmd->pages_sem : &cmd->sem; down(sem); if (!ent->page_queue) { - alloc_ret =3D cmd_alloc_index_retry(cmd); + alloc_ret =3D cmd_alloc_index(cmd); if (alloc_ret < 0) { mlx5_core_err(dev, "failed to allocate command entry\n"); if (ent->callback) { From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85405C433EF for ; Mon, 24 Jan 2022 20:01:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358840AbiAXUA5 (ORCPT ); Mon, 24 Jan 2022 15:00:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59726 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347434AbiAXTiv (ORCPT ); Mon, 24 Jan 2022 14:38:51 -0500 Received: from smtp.kernel.org (relay.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 3C71FB8122A; Mon, 24 Jan 2022 19:38:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55578C340E5; Mon, 24 Jan 2022 19:38:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053128; bh=jWDHRme/ITQfZrL35IpdVL6ftOshaIh0+geEM+S1LeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yWEyj7zVcL395Fi/ZBfH/+I9cpbYAoAFVGkZ/h+ndPEG4HntPNkq9VtkcZCKLtwaK y+VJ3MjacJobmaFLK0VRIaAbuk8/QZxXGl0MxyzRYK/ckRoyXIzVYlQfuLSCbqYKws hgh19JuG254xgYZmGxjTiD8siUM1fh3CPcLEeqsc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naresh Kamboju , Anders Roxell , Nathan Chancellor , Arnd Bergmann , Michael Ellerman Subject: [PATCH 5.4 286/320] powerpc/cell: Fix clang -Wimplicit-fallthrough warning Date: Mon, 24 Jan 2022 19:44:30 +0100 Message-Id: <20220124184003.692330656@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Anders Roxell commit e89257e28e844f5d1d39081bb901d9f1183a7705 upstream. Clang warns: arch/powerpc/platforms/cell/pervasive.c:81:2: error: unannotated fall-throu= gh between switch labels case SRR1_WAKEEE: ^ arch/powerpc/platforms/cell/pervasive.c:81:2: note: insert 'break;' to avoi= d fall-through case SRR1_WAKEEE: ^ break; 1 error generated. Clang is more pedantic than GCC, which does not warn when failing through to a case that is just break or return. Clang's version is more in line with the kernel's own stance in deprecated.rst. Add athe missing break to silence the warning. Fixes: 6e83985b0f6e ("powerpc/cbe: Do not process external or decremeter in= terrupts from sreset") Reported-by: Naresh Kamboju Signed-off-by: Anders Roxell Reviewed-by: Nathan Chancellor Reviewed-by: Arnd Bergmann Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211207110228.698956-1-anders.roxell@linar= o.org Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/powerpc/platforms/cell/pervasive.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/powerpc/platforms/cell/pervasive.c +++ b/arch/powerpc/platforms/cell/pervasive.c @@ -77,6 +77,7 @@ static int cbe_system_reset_exception(st switch (regs->msr & SRR1_WAKEMASK) { case SRR1_WAKEDEC: set_dec(1); + break; case SRR1_WAKEEE: /* * Handle these when interrupts get re-enabled and we take From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39B37C433EF for ; Mon, 24 Jan 2022 23:29:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849599AbiAXX0P (ORCPT ); Mon, 24 Jan 2022 18:26:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835956AbiAXWhv (ORCPT ); Mon, 24 Jan 2022 17:37:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D2E0C0612DB; Mon, 24 Jan 2022 11:38:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F33B60917; Mon, 24 Jan 2022 19:38:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70E40C340E5; Mon, 24 Jan 2022 19:38:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053131; bh=3U9VP1OuruVXeNmVCUIDrfmA01G3vDMoXgFxbdOhwwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lWEde+FlcAmcvjIqYUbVes8w3Po2ur9BM/+O427xOPFFNdMD8y5KCoPyEbFpmSA6/ h7oVoyuBUVL9rqfJEZlOyTg702/Ax5onDw4HDTUs2kasPc5ZSKWijzEEBf4KiEt6ZS 0FAGceXD9Bv3WeK3OK+ZCT7kqDbq39vc32flG0fc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tobias Waldekranz , Jakub Kicinski Subject: [PATCH 5.4 287/320] powerpc/fsl/dts: Enable WA for erratum A-009885 on fman3l MDIO buses Date: Mon, 24 Jan 2022 19:44:31 +0100 Message-Id: <20220124184003.722563164@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tobias Waldekranz commit 0d375d610fa96524e2ee2b46830a46a7bfa92a9f upstream. This block is used in (at least) T1024 and T1040, including their variants like T1023 etc. Fixes: d55ad2967d89 ("powerpc/mpc85xx: Create dts components for the FSL Qo= rIQ DPAA FMan") Signed-off-by: Tobias Waldekranz Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi @@ -79,6 +79,7 @@ fman0: fman@400000 { #size-cells =3D <0>; compatible =3D "fsl,fman-memac-mdio", "fsl,fman-xmdio"; reg =3D <0xfc000 0x1000>; + fsl,erratum-a009885; }; =20 xmdio0: mdio@fd000 { @@ -86,6 +87,7 @@ fman0: fman@400000 { #size-cells =3D <0>; compatible =3D "fsl,fman-memac-mdio", "fsl,fman-xmdio"; reg =3D <0xfd000 0x1000>; + fsl,erratum-a009885; }; }; =20 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34C8CC433EF for ; Mon, 24 Jan 2022 20:00:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232730AbiAXUAV (ORCPT ); Mon, 24 Jan 2022 15:00:21 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59766 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347706AbiAXTi6 (ORCPT ); Mon, 24 Jan 2022 14:38:58 -0500 Received: from smtp.kernel.org (relay.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 782B7B8121A; Mon, 24 Jan 2022 19:38:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92881C340E5; Mon, 24 Jan 2022 19:38:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053134; bh=qlfGHbOjwuWJJj7g3mrICRmEQ360zRztaKRh34ZW7F8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ow6VYiQ8EDREy0KHRvyPtEqNGPWts/OeWO/SVQBf8Eh54ycaUpIn93CBHf8qDkYy3 ptwI5zbUgPWRW8+/8DiWaKXS67JPZKmtuCuSpOLOoFoKYVjYu8bq/JC7/ZaIv5oipp WxFLerWVzlNZkUn6lL5HmNHSXlXMaZYkhZABTzOQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quentin Monnet , Andrii Nakryiko Subject: [PATCH 5.4 288/320] bpftool: Remove inclusion of utilities.mak from Makefiles Date: Mon, 24 Jan 2022 19:44:32 +0100 Message-Id: <20220124184003.755661206@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quentin Monnet commit 48f5aef4c458c19ab337eed8c95a6486cc014aa3 upstream. Bpftool's Makefile, and the Makefile for its documentation, both include scripts/utilities.mak, but they use none of the items defined in this file. Remove the includes. Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool") Signed-off-by: Quentin Monnet Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20211110114632.24537-3-quentin@isovalent.= com Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- tools/bpf/bpftool/Documentation/Makefile | 1 - tools/bpf/bpftool/Makefile | 1 - 2 files changed, 2 deletions(-) --- a/tools/bpf/bpftool/Documentation/Makefile +++ b/tools/bpf/bpftool/Documentation/Makefile @@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only include ../../../scripts/Makefile.include -include ../../../scripts/utilities.mak =20 INSTALL ?=3D install RM ?=3D rm -f --- a/tools/bpf/bpftool/Makefile +++ b/tools/bpf/bpftool/Makefile @@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only include ../../scripts/Makefile.include -include ../../scripts/utilities.mak =20 ifeq ($(srctree),) srctree :=3D $(patsubst %/,%,$(dir $(CURDIR))) From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7478C4321E for ; Mon, 24 Jan 2022 20:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389016AbiAXUkW (ORCPT ); Mon, 24 Jan 2022 15:40:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351141AbiAXUT0 (ORCPT ); Mon, 24 Jan 2022 15:19:26 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF446C0612F5; Mon, 24 Jan 2022 11:38:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 75DE8B81229; Mon, 24 Jan 2022 19:38:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9970DC340E5; Mon, 24 Jan 2022 19:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053137; bh=v3qNmppBobj181G6eIp2mj/h+JGFuzf+50jMrh4mUIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r62/BZaFwG/AOLCJgFhSFU688fQP0OhmUd3y9YwJGRsLgarMFv5KHWljaU/Ew5MuQ aEQh5DVsRPdrL+7RoGiDbi3rXBT790osk+2oQZhozEfBt4XTsTaksFGwktgeG+wqHO T/TQUrOxkyzfNHOvt/6MtS3gSYnftzwwRaC2L5p0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , David Ahern , Jakub Kicinski Subject: [PATCH 5.4 289/320] ipv4: avoid quadratic behavior in netns dismantle Date: Mon, 24 Jan 2022 19:44:33 +0100 Message-Id: <20220124184003.787440229@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet commit d07418afea8f1d9896aaf9dc5ae47ac4f45b220c upstream. net/ipv4/fib_semantics.c uses an hash table of 256 slots, keyed by device ifindexes: fib_info_devhash[DEVINDEX_HASHSIZE] Problem is that with network namespaces, devices tend to use the same ifindex. lo device for instance has a fixed ifindex of one, for all network namespaces. This means that hosts with thousands of netns spend a lot of time looking at some hash buckets with thousands of elements, notably at netns dismantle. Simply add a per netns perturbation (net_hash_mix()) to spread elements more uniformely. Also change fib_devindex_hashfn() to use more entropy. Fixes: aa79e66eee5d ("net: Make ifindex generation per-net namespace") Signed-off-by: Eric Dumazet Reviewed-by: David Ahern Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/ipv4/fib_semantics.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -29,6 +29,7 @@ #include #include #include +#include =20 #include #include @@ -318,11 +319,15 @@ static inline int nh_comp(struct fib_inf =20 static inline unsigned int fib_devindex_hashfn(unsigned int val) { - unsigned int mask =3D DEVINDEX_HASHSIZE - 1; + return hash_32(val, DEVINDEX_HASHBITS); +} + +static struct hlist_head * +fib_info_devhash_bucket(const struct net_device *dev) +{ + u32 val =3D net_hash_mix(dev_net(dev)) ^ dev->ifindex; =20 - return (val ^ - (val >> DEVINDEX_HASHBITS) ^ - (val >> (DEVINDEX_HASHBITS * 2))) & mask; + return &fib_info_devhash[fib_devindex_hashfn(val)]; } =20 static unsigned int fib_info_hashfn_1(int init_val, u8 protocol, u8 scope, @@ -432,12 +437,11 @@ int ip_fib_check_default(__be32 gw, stru { struct hlist_head *head; struct fib_nh *nh; - unsigned int hash; =20 spin_lock(&fib_info_lock); =20 - hash =3D fib_devindex_hashfn(dev->ifindex); - head =3D &fib_info_devhash[hash]; + head =3D fib_info_devhash_bucket(dev); + hlist_for_each_entry(nh, head, nh_hash) { if (nh->fib_nh_dev =3D=3D dev && nh->fib_nh_gw4 =3D=3D gw && @@ -1594,12 +1598,10 @@ link_it: } else { change_nexthops(fi) { struct hlist_head *head; - unsigned int hash; =20 if (!nexthop_nh->fib_nh_dev) continue; - hash =3D fib_devindex_hashfn(nexthop_nh->fib_nh_dev->ifindex); - head =3D &fib_info_devhash[hash]; + head =3D fib_info_devhash_bucket(nexthop_nh->fib_nh_dev); hlist_add_head(&nexthop_nh->nh_hash, head); } endfor_nexthops(fi) } @@ -1940,8 +1942,7 @@ void fib_nhc_update_mtu(struct fib_nh_co =20 void fib_sync_mtu(struct net_device *dev, u32 orig_mtu) { - unsigned int hash =3D fib_devindex_hashfn(dev->ifindex); - struct hlist_head *head =3D &fib_info_devhash[hash]; + struct hlist_head *head =3D fib_info_devhash_bucket(dev); struct fib_nh *nh; =20 hlist_for_each_entry(nh, head, nh_hash) { @@ -1960,12 +1961,11 @@ void fib_sync_mtu(struct net_device *dev */ int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool fo= rce) { - int ret =3D 0; - int scope =3D RT_SCOPE_NOWHERE; + struct hlist_head *head =3D fib_info_devhash_bucket(dev); struct fib_info *prev_fi =3D NULL; - unsigned int hash =3D fib_devindex_hashfn(dev->ifindex); - struct hlist_head *head =3D &fib_info_devhash[hash]; + int scope =3D RT_SCOPE_NOWHERE; struct fib_nh *nh; + int ret =3D 0; =20 if (force) scope =3D -1; @@ -2110,7 +2110,6 @@ out: int fib_sync_up(struct net_device *dev, unsigned char nh_flags) { struct fib_info *prev_fi; - unsigned int hash; struct hlist_head *head; struct fib_nh *nh; int ret; @@ -2126,8 +2125,7 @@ int fib_sync_up(struct net_device *dev, } =20 prev_fi =3D NULL; - hash =3D fib_devindex_hashfn(dev->ifindex); - head =3D &fib_info_devhash[hash]; + head =3D fib_info_devhash_bucket(dev); ret =3D 0; =20 hlist_for_each_entry(nh, head, nh_hash) { From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61F46C433F5 for ; Mon, 24 Jan 2022 19:49:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350163AbiAXTtb (ORCPT ); Mon, 24 Jan 2022 14:49:31 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:36706 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353484AbiAXTjC (ORCPT ); Mon, 24 Jan 2022 14:39:02 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E72D861488; Mon, 24 Jan 2022 19:39:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5273C340E8; Mon, 24 Jan 2022 19:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053140; bh=SkxgkeQKtRzsXP4qhrbvLWmh+8iL7PKLaOqj4Z1DGOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xU+gvj78NmToGMFgaMO3Zbs1kq1CykbkBIXxJydaHLaWFvUgFQ58p4aAQzzIwGeav /GaApy7Bse7lrshFkzjV/8sJ5vPMcx2td9khEORSdtsiFP6cwY7eM0OTFWGJctHQfW zxrI+dGgUvpf4YO6yRs8AwQtXp5PoN6XYayA6n9Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tobias Waldekranz , Andrew Lunn , Jakub Kicinski Subject: [PATCH 5.4 290/320] net/fsl: xgmac_mdio: Fix incorrect iounmap when removing module Date: Mon, 24 Jan 2022 19:44:34 +0100 Message-Id: <20220124184003.818013973@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tobias Waldekranz commit 3f7c239c7844d2044ed399399d97a5f1c6008e1b upstream. As reported by sparse: In the remove path, the driver would attempt to unmap its own priv pointer - instead of the io memory that it mapped in probe. Fixes: 9f35a7342cff ("net/fsl: introduce Freescale 10G MDIO driver") Signed-off-by: Tobias Waldekranz Reviewed-by: Andrew Lunn Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/freescale/xgmac_mdio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -301,9 +301,10 @@ err_ioremap: static int xgmac_mdio_remove(struct platform_device *pdev) { struct mii_bus *bus =3D platform_get_drvdata(pdev); + struct mdio_fsl_priv *priv =3D bus->priv; =20 mdiobus_unregister(bus); - iounmap(bus->priv); + iounmap(priv->mdio_base); mdiobus_free(bus); =20 return 0; From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14A4DC433EF for ; Mon, 24 Jan 2022 19:50:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357227AbiAXTtj (ORCPT ); Mon, 24 Jan 2022 14:49:39 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59836 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353888AbiAXTjG (ORCPT ); Mon, 24 Jan 2022 14:39:06 -0500 Received: from smtp.kernel.org (relay.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 D85BBB81229; Mon, 24 Jan 2022 19:39:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF2C3C340E5; Mon, 24 Jan 2022 19:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053143; bh=x1ittnNsJWwt1zDpNreQd8A+qpmVXaypmHKKZugegkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rqBkDYjrtWrcC3YRCwJNbRzKtfFhJ3tfGHF4eNredVWQLfINxwGIbrw5wlyFw17FS dXbtDksydOg+iowWt7avfLblP/ohkffcTwocpwvk6Gd/PHV32AtS+oe/O8PiTDWMC7 O7JBLkX4Q9yjWJZ5HlfKvS8oK4DrioeVexT6qnyk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Helge Deller Subject: [PATCH 5.4 291/320] parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries Date: Mon, 24 Jan 2022 19:44:35 +0100 Message-Id: <20220124184003.848145150@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Miaoqian Lin commit d24846a4246b6e61ecbd036880a4adf61681d241 upstream. kobject_init_and_add() takes reference even when it fails. According to the doc of kobject_init_and_add()=EF=BC=9A If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object. Fix memory leak by calling kobject_put(). Fixes: 73f368cf679b ("Kobject: change drivers/parisc/pdc_stable.c to use ko= bject_init_and_add") Signed-off-by: Miaoqian Lin Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/parisc/pdc_stable.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c @@ -979,8 +979,10 @@ pdcs_register_pathentries(void) entry->kobj.kset =3D paths_kset; err =3D kobject_init_and_add(&entry->kobj, &ktype_pdcspath, NULL, "%s", entry->name); - if (err) + if (err) { + kobject_put(&entry->kobj); return err; + } =20 /* kobject is now registered */ write_lock(&entry->rw_lock); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96CE4C433EF for ; Tue, 25 Jan 2022 02:36:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422683AbiAYCbw (ORCPT ); Mon, 24 Jan 2022 21:31:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355979AbiAXUUb (ORCPT ); Mon, 24 Jan 2022 15:20:31 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 914A4C05A18E; Mon, 24 Jan 2022 11:39:10 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 25393614BB; Mon, 24 Jan 2022 19:39:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AE0DC340E5; Mon, 24 Jan 2022 19:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053149; bh=a/Ys53V0T/HHlhmYyRp32S+X1vTNoIqp0BxPb6o+PWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TJ1FGtd5eb152YaORkPb31XBr+0/D8R3fhMrscF+xXMoaWbBj19iBFfILz39o8E89 FC5RM8uqEw4d+KAsRIB6eQ9zubyaUehS+lQU3xtcGYjq9kwRjNSW43F8zDebxxZOjd BEMCPrVzo5WdN+pJgRsNwi6lc4bdTGzl0fsHq2nI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org Subject: [PATCH 5.4 292/320] f2fs: fix to reserve space for IO align feature Date: Mon, 24 Jan 2022 19:44:36 +0100 Message-Id: <20220124184003.879639707@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chao Yu commit 300a842937fbcfb5a189cea9ba15374fdb0b5c6b upstream. https://bugzilla.kernel.org/show_bug.cgi?id=3D204137 With below script, we will hit panic during new segment allocation: DISK=3Dbingo.img MOUNT_DIR=3D/mnt/f2fs dd if=3D/dev/zero of=3D$DISK bs=3D1M count=3D105 mkfs.f2fe -a 1 -o 19 -t 1 -z 1 -f -q $DISK mount -t f2fs $DISK $MOUNT_DIR -o "noinline_dentry,flush_merge,noextent_cac= he,mode=3Dlfs,io_bits=3D7,fsync_mode=3Dstrict" for (( i =3D 0; i < 4096; i++ )); do name=3D`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 10` mkdir $MOUNT_DIR/$name done umount $MOUNT_DIR rm $DISK Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/f2fs/f2fs.h | 11 +++++++++++ fs/f2fs/segment.h | 3 ++- fs/f2fs/super.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ fs/f2fs/sysfs.c | 4 +++- 4 files changed, 60 insertions(+), 2 deletions(-) --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -931,6 +931,7 @@ struct f2fs_sm_info { unsigned int segment_count; /* total # of segments */ unsigned int main_segments; /* # of segments in main area */ unsigned int reserved_segments; /* # of reserved segments */ + unsigned int additional_reserved_segments;/* reserved segs for IO align f= eature */ unsigned int ovp_segments; /* # of overprovision segments */ =20 /* a threshold to reclaim prefree segments */ @@ -1800,6 +1801,11 @@ static inline int inc_valid_block_count( =20 if (!__allow_reserved_blocks(sbi, inode, true)) avail_user_block_count -=3D F2FS_OPTION(sbi).root_reserved_blocks; + + if (F2FS_IO_ALIGNED(sbi)) + avail_user_block_count -=3D sbi->blocks_per_seg * + SM_I(sbi)->additional_reserved_segments; + if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) { if (avail_user_block_count > sbi->unusable_block_count) avail_user_block_count -=3D sbi->unusable_block_count; @@ -2045,6 +2051,11 @@ static inline int inc_valid_node_count(s =20 if (!__allow_reserved_blocks(sbi, inode, false)) valid_block_count +=3D F2FS_OPTION(sbi).root_reserved_blocks; + + if (F2FS_IO_ALIGNED(sbi)) + valid_block_count +=3D sbi->blocks_per_seg * + SM_I(sbi)->additional_reserved_segments; + user_block_count =3D sbi->user_block_count; if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) user_block_count -=3D sbi->unusable_block_count; --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -508,7 +508,8 @@ static inline unsigned int free_segments =20 static inline int reserved_segments(struct f2fs_sb_info *sbi) { - return SM_I(sbi)->reserved_segments; + return SM_I(sbi)->reserved_segments + + SM_I(sbi)->additional_reserved_segments; } =20 static inline unsigned int free_sections(struct f2fs_sb_info *sbi) --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -277,6 +277,46 @@ static inline void limit_reserve_root(st F2FS_OPTION(sbi).s_resgid)); } =20 +static inline int adjust_reserved_segment(struct f2fs_sb_info *sbi) +{ + unsigned int sec_blks =3D sbi->blocks_per_seg * sbi->segs_per_sec; + unsigned int avg_vblocks; + unsigned int wanted_reserved_segments; + block_t avail_user_block_count; + + if (!F2FS_IO_ALIGNED(sbi)) + return 0; + + /* average valid block count in section in worst case */ + avg_vblocks =3D sec_blks / F2FS_IO_SIZE(sbi); + + /* + * we need enough free space when migrating one section in worst case + */ + wanted_reserved_segments =3D (F2FS_IO_SIZE(sbi) / avg_vblocks) * + reserved_segments(sbi); + wanted_reserved_segments -=3D reserved_segments(sbi); + + avail_user_block_count =3D sbi->user_block_count - + sbi->current_reserved_blocks - + F2FS_OPTION(sbi).root_reserved_blocks; + + if (wanted_reserved_segments * sbi->blocks_per_seg > + avail_user_block_count) { + f2fs_err(sbi, "IO align feature can't grab additional reserved segment: = %u, available segments: %u", + wanted_reserved_segments, + avail_user_block_count >> sbi->log_blocks_per_seg); + return -ENOSPC; + } + + SM_I(sbi)->additional_reserved_segments =3D wanted_reserved_segments; + + f2fs_info(sbi, "IO align feature needs additional reserved segment: %u", + wanted_reserved_segments); + + return 0; +} + static inline void adjust_unusable_cap_perc(struct f2fs_sb_info *sbi) { if (!F2FS_OPTION(sbi).unusable_cap_perc) @@ -3450,6 +3490,10 @@ try_onemore: goto free_nm; } =20 + err =3D adjust_reserved_segment(sbi); + if (err) + goto free_nm; + /* For write statistics */ if (sb->s_bdev->bd_part) sbi->sectors_written_start =3D --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -262,7 +262,9 @@ out: if (a->struct_type =3D=3D RESERVED_BLOCKS) { spin_lock(&sbi->stat_lock); if (t > (unsigned long)(sbi->user_block_count - - F2FS_OPTION(sbi).root_reserved_blocks)) { + F2FS_OPTION(sbi).root_reserved_blocks - + sbi->blocks_per_seg * + SM_I(sbi)->additional_reserved_segments)) { spin_unlock(&sbi->stat_lock); return -EINVAL; } From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15314C43219 for ; Mon, 24 Jan 2022 20:42:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346837AbiAXUlA (ORCPT ); Mon, 24 Jan 2022 15:41:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380962AbiAXUVD (ORCPT ); Mon, 24 Jan 2022 15:21:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 085CFC0604F4; Mon, 24 Jan 2022 11:39:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C2DDFB8119D; Mon, 24 Jan 2022 19:39:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05E65C340E5; Mon, 24 Jan 2022 19:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053152; bh=5EYbqNegLlvnaMSWowG9UrcVkePTyeevdZP3O7Ejjos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B9L6SHnhjIaVty7CSqSBh0+m3W329XeDNf8wxjSwf32EFpqktRK78ECOE+Yo1jqcc QbfI4uysB6zAntRqiKUQ6w8dqQVxt+C+rJxzHZuP8t3B1sNupynuAW9J6DtzArmiw8 AWwQbCtf7Ds0C89dSr7DtfFp8uSSzPXAIWSfQdiQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , syzbot , Jakub Kicinski Subject: [PATCH 5.4 293/320] af_unix: annote lockless accesses to unix_tot_inflight & gc_in_progress Date: Mon, 24 Jan 2022 19:44:37 +0100 Message-Id: <20220124184003.909210029@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet commit 9d6d7f1cb67cdee15f1a0e85aacfb924e0e02435 upstream. wait_for_unix_gc() reads unix_tot_inflight & gc_in_progress without synchronization. Adds READ_ONCE()/WRITE_ONCE() and their associated comments to better document the intent. BUG: KCSAN: data-race in unix_inflight / wait_for_unix_gc write to 0xffffffff86e2b7c0 of 4 bytes by task 9380 on cpu 0: unix_inflight+0x1e8/0x260 net/unix/scm.c:63 unix_attach_fds+0x10c/0x1e0 net/unix/scm.c:121 unix_scm_to_skb net/unix/af_unix.c:1674 [inline] unix_dgram_sendmsg+0x679/0x16b0 net/unix/af_unix.c:1817 unix_seqpacket_sendmsg+0xcc/0x110 net/unix/af_unix.c:2258 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2409 ___sys_sendmsg net/socket.c:2463 [inline] __sys_sendmmsg+0x267/0x4c0 net/socket.c:2549 __do_sys_sendmmsg net/socket.c:2578 [inline] __se_sys_sendmmsg net/socket.c:2575 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2575 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae read to 0xffffffff86e2b7c0 of 4 bytes by task 9375 on cpu 1: wait_for_unix_gc+0x24/0x160 net/unix/garbage.c:196 unix_dgram_sendmsg+0x8e/0x16b0 net/unix/af_unix.c:1772 unix_seqpacket_sendmsg+0xcc/0x110 net/unix/af_unix.c:2258 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2409 ___sys_sendmsg net/socket.c:2463 [inline] __sys_sendmmsg+0x267/0x4c0 net/socket.c:2549 __do_sys_sendmmsg net/socket.c:2578 [inline] __se_sys_sendmmsg net/socket.c:2575 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2575 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae value changed: 0x00000002 -> 0x00000004 Reported by Kernel Concurrency Sanitizer on: CPU: 1 PID: 9375 Comm: syz-executor.1 Not tainted 5.16.0-rc7-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Goo= gle 01/01/2011 Fixes: 9915672d4127 ("af_unix: limit unix_tot_inflight") Signed-off-by: Eric Dumazet Reported-by: syzbot Link: https://lore.kernel.org/r/20220114164328.2038499-1-eric.dumazet@gmail= .com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/unix/garbage.c | 14 +++++++++++--- net/unix/scm.c | 6 ++++-- 2 files changed, 15 insertions(+), 5 deletions(-) --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -192,8 +192,11 @@ void wait_for_unix_gc(void) { /* If number of inflight sockets is insane, * force a garbage collect right now. + * Paired with the WRITE_ONCE() in unix_inflight(), + * unix_notinflight() and gc_in_progress(). */ - if (unix_tot_inflight > UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) + if (READ_ONCE(unix_tot_inflight) > UNIX_INFLIGHT_TRIGGER_GC && + !READ_ONCE(gc_in_progress)) unix_gc(); wait_event(unix_gc_wait, gc_in_progress =3D=3D false); } @@ -213,7 +216,9 @@ void unix_gc(void) if (gc_in_progress) goto out; =20 - gc_in_progress =3D true; + /* Paired with READ_ONCE() in wait_for_unix_gc(). */ + WRITE_ONCE(gc_in_progress, true); + /* First, select candidates for garbage collection. Only * in-flight sockets are considered, and from those only ones * which don't have any external reference. @@ -299,7 +304,10 @@ void unix_gc(void) =20 /* All candidates should have been detached by now. */ BUG_ON(!list_empty(&gc_candidates)); - gc_in_progress =3D false; + + /* Paired with READ_ONCE() in wait_for_unix_gc(). */ + WRITE_ONCE(gc_in_progress, false); + wake_up(&unix_gc_wait); =20 out: --- a/net/unix/scm.c +++ b/net/unix/scm.c @@ -59,7 +59,8 @@ void unix_inflight(struct user_struct *u } else { BUG_ON(list_empty(&u->link)); } - unix_tot_inflight++; + /* Paired with READ_ONCE() in wait_for_unix_gc() */ + WRITE_ONCE(unix_tot_inflight, unix_tot_inflight + 1); } user->unix_inflight++; spin_unlock(&unix_gc_lock); @@ -79,7 +80,8 @@ void unix_notinflight(struct user_struct =20 if (atomic_long_dec_and_test(&u->inflight)) list_del_init(&u->link); - unix_tot_inflight--; + /* Paired with READ_ONCE() in wait_for_unix_gc() */ + WRITE_ONCE(unix_tot_inflight, unix_tot_inflight - 1); } user->unix_inflight--; spin_unlock(&unix_gc_lock); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFD14C433EF for ; Tue, 25 Jan 2022 02:36:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422877AbiAYCcU (ORCPT ); Mon, 24 Jan 2022 21:32:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381600AbiAXUVY (ORCPT ); Mon, 24 Jan 2022 15:21:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CB25C05A19D; Mon, 24 Jan 2022 11:39:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5342E614FC; Mon, 24 Jan 2022 19:39:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 246D6C340E5; Mon, 24 Jan 2022 19:39:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053155; bh=moZbIAZBvYyKF814I2r+Yis0lNbH4FE0BMehZkNkKc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z9xgVgfffB8MmNTlKWcK4swGwTqs+rCeQhvrFBj7n7ZgyUugmXTQqe2lLyC9Wz2GJ ZJZnm6RmSvZa1n0gU2VW+w/5ba29xGPZ9MTKliAEhQd2E2j2oaxh1swUpud2vW40h8 IeuLXcqUs8ySCfCHOVWYJVElhku3cq9dXyNvqjsg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , Stephen Boyd Subject: [PATCH 5.4 294/320] clk: si5341: Fix clock HW provider cleanup Date: Mon, 24 Jan 2022 19:44:38 +0100 Message-Id: <20220124184003.947457916@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Hancock commit 49a8f2bc8d88702783c7e163ec84374e9a022f71 upstream. The call to of_clk_add_hw_provider was not undone on remove or on probe failure, which could cause an oops on a subsequent attempt to retrieve clocks for the removed device. Switch to the devm version of the function to avoid this issue. Fixes: 3044a860fd09 ("clk: Add Si5341/Si5340 driver") Signed-off-by: Robert Hancock Link: https://lore.kernel.org/r/20220112203816.1784610-1-robert.hancock@cal= ian.com Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/clk/clk-si5341.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/clk/clk-si5341.c +++ b/drivers/clk/clk-si5341.c @@ -1303,7 +1303,7 @@ static int si5341_probe(struct i2c_clien clk_prepare(data->clk[i].hw.clk); } =20 - err =3D of_clk_add_hw_provider(client->dev.of_node, of_clk_si5341_get, + err =3D devm_of_clk_add_hw_provider(&client->dev, of_clk_si5341_get, data); if (err) { dev_err(&client->dev, "unable to add clk provider\n"); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98DC0C433F5 for ; Mon, 24 Jan 2022 20:00:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359831AbiAXUAP (ORCPT ); Mon, 24 Jan 2022 15:00:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58588 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348601AbiAXTjW (ORCPT ); Mon, 24 Jan 2022 14:39:22 -0500 Received: from smtp.kernel.org (relay.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 24E12B8122C; Mon, 24 Jan 2022 19:39:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38C5BC340E5; Mon, 24 Jan 2022 19:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053158; bh=VKXK7kYTQZvVjzGQS4SN8dhAG6nk9/Iz3tYU1sWarK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BX5S4btgBgMbukpo/LIj5ujx8TxZyNSKjmsJbSvJYKAWr2bvDnwy4y1tzin3AGtGH s9VYrVQ0gvmYGNabyuqD7YZz5K4gT3DUW3Um2Kx88AApWP0+Cw8FLC3dx7WZe1cbxF w1Kf5Wi20c7ImpUAjVVJN08IRsvE3K2yCPhHof3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , "David S. Miller" Subject: [PATCH 5.4 295/320] net: axienet: limit minimum TX ring size Date: Mon, 24 Jan 2022 19:44:39 +0100 Message-Id: <20220124184003.977026219@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Hancock commit 70f5817deddbc6ef3faa35841cab83c280cc653a upstream. The driver will not work properly if the TX ring size is set to below MAX_SKB_FRAGS + 1 since it needs to hold at least one full maximally fragmented packet in the TX ring. Limit setting the ring size to below this value. Fixes: 8b09ca823ffb4 ("net: axienet: Make RX/TX ring sizes configurable") Signed-off-by: Robert Hancock Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -43,6 +43,7 @@ /* Descriptors defines for Tx and Rx DMA */ #define TX_BD_NUM_DEFAULT 64 #define RX_BD_NUM_DEFAULT 1024 +#define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1) #define TX_BD_NUM_MAX 4096 #define RX_BD_NUM_MAX 4096 =20 @@ -1223,7 +1224,8 @@ static int axienet_ethtools_set_ringpara if (ering->rx_pending > RX_BD_NUM_MAX || ering->rx_mini_pending || ering->rx_jumbo_pending || - ering->rx_pending > TX_BD_NUM_MAX) + ering->tx_pending < TX_BD_NUM_MIN || + ering->tx_pending > TX_BD_NUM_MAX) return -EINVAL; =20 if (netif_running(ndev)) From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF218C433FE for ; Mon, 24 Jan 2022 19:50:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357311AbiAXTts (ORCPT ); Mon, 24 Jan 2022 14:49:48 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37046 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354813AbiAXTjX (ORCPT ); Mon, 24 Jan 2022 14:39:23 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8708D60909; Mon, 24 Jan 2022 19:39:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C4FEC340E5; Mon, 24 Jan 2022 19:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053162; bh=osbjsETwmrFoJOk4P3d1ByJmQInAso1wONfhM9/Ubdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wcpj23CSk3rgduECmBRk8wq5z2SbbR50fC87VaYWTMxfcyP0vXKpGOOCXjXZlif1B KghHffYZaOPI6yrzh3PBrETh8m9DTKro3ItEhdmnSjDZjbL8ZifgZpHAJ4oyV5TE4a pb/cnskfJ25PG5c96YA/9gvZ/gyGHyKcJG9r7nWQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , "David S. Miller" Subject: [PATCH 5.4 296/320] net: axienet: fix number of TX ring slots for available check Date: Mon, 24 Jan 2022 19:44:40 +0100 Message-Id: <20220124184004.013259783@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Hancock commit aba57a823d2985a2cc8c74a2535f3a88e68d9424 upstream. The check for the number of available TX ring slots was off by 1 since a slot is required for the skb header as well as each fragment. This could result in overwriting a TX ring slot that was still in use. Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethern= et driver") Signed-off-by: Robert Hancock Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -636,7 +636,7 @@ axienet_start_xmit(struct sk_buff *skb, num_frag =3D skb_shinfo(skb)->nr_frags; cur_p =3D &lp->tx_bd_v[lp->tx_bd_tail]; =20 - if (axienet_check_tx_bd_space(lp, num_frag)) { + if (axienet_check_tx_bd_space(lp, num_frag + 1)) { if (netif_queue_stopped(ndev)) return NETDEV_TX_BUSY; =20 @@ -646,7 +646,7 @@ axienet_start_xmit(struct sk_buff *skb, smp_mb(); =20 /* Space might have just been freed - check again */ - if (axienet_check_tx_bd_space(lp, num_frag)) + if (axienet_check_tx_bd_space(lp, num_frag + 1)) return NETDEV_TX_BUSY; =20 netif_wake_queue(ndev); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A6CCC3526E for ; Mon, 24 Jan 2022 23:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386984AbiAXXdZ (ORCPT ); Mon, 24 Jan 2022 18:33:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1579821AbiAXWnj (ORCPT ); Mon, 24 Jan 2022 17:43:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E84ADC05A1B4; Mon, 24 Jan 2022 11:39:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5D592B810BD; Mon, 24 Jan 2022 19:39:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AA0AC340E5; Mon, 24 Jan 2022 19:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053165; bh=GQv7LOP06zbfKaH6OrGhewLZ8+JM8W6ZxwkO/Q4Zfm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XDwG35NSccQJbJ/soHUtOJLEu3Hl+fgWorfiMMephf2a1MUcwQ0aXBVhMVp0ZGAtz 0pjcOOoNLm+Fw+BZaM68D48xx/B2MqYUqxBpNdGsUwjZk+aYewzd57UarKvbc2RUp8 OBWDsIo13xG8dC0sh4Y4Vhzz5CPfcYeSKjaf1PZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , "David S. Miller" Subject: [PATCH 5.4 297/320] net: axienet: increase default TX ring size to 128 Date: Mon, 24 Jan 2022 19:44:41 +0100 Message-Id: <20220124184004.051571050@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Hancock commit 2d19c3fd80178160dd505ccd7fed1643831227a5 upstream. With previous changes to make the driver handle the TX ring size more correctly, the default TX ring size of 64 appears to significantly bottleneck TX performance to around 600 Mbps on a 1 Gbps link on ZynqMP. Increasing this to 128 seems to bring performance up to near line rate and shouldn't cause excess bufferbloat (this driver doesn't yet support modern byte-based queue management). Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethern= et driver") Signed-off-by: Robert Hancock Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -41,7 +41,7 @@ #include "xilinx_axienet.h" =20 /* Descriptors defines for Tx and Rx DMA */ -#define TX_BD_NUM_DEFAULT 64 +#define TX_BD_NUM_DEFAULT 128 #define RX_BD_NUM_DEFAULT 1024 #define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1) #define TX_BD_NUM_MAX 4096 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A00D2C4167B for ; Mon, 24 Jan 2022 20:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389522AbiAXUle (ORCPT ); Mon, 24 Jan 2022 15:41:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355936AbiAXUWG (ORCPT ); Mon, 24 Jan 2022 15:22:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2D79C05A1BA; Mon, 24 Jan 2022 11:39:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 570A8B811F9; Mon, 24 Jan 2022 19:39:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 888B9C340E5; Mon, 24 Jan 2022 19:39:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053168; bh=t36Qf7OqaHp5mhLh63Ejubt/7CRwFd48SoJJMeaqkEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EdBW2idPiHsqOfMGj1WkAlh98ODhDyjNOScGlYMiL+mg8hOfoS4TyY7cKm+rom3ZN J3Yj/GqW1NxJbw6WSRYjLcQcgL0D1I7UvtRZE2GWX0khgyqHGEKdHrLXiM5y+Grd5s avzf0QnS2qocfbYORivGutwk1KZs2sjsTh8ZcixQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurence de Bruxelles , Alexandre Belloni Subject: [PATCH 5.4 298/320] rtc: pxa: fix null pointer dereference Date: Mon, 24 Jan 2022 19:44:42 +0100 Message-Id: <20220124184004.089532880@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Laurence de Bruxelles commit 34127b3632b21e5c391756e724b1198eb9917981 upstream. With the latest stable kernel versions the rtc on the PXA based Zaurus does not work, when booting I see the following kernel messages: pxa-rtc pxa-rtc: failed to find rtc clock source pxa-rtc pxa-rtc: Unable to init SA1100 RTC sub-device pxa-rtc: probe of pxa-rtc failed with error -2 hctosys: unable to open rtc device (rtc0) I think this is because commit f2997775b111 ("rtc: sa1100: fix possible race condition") moved the allocation of the rtc_device struct out of sa1100_rtc_init and into sa1100_rtc_probe. This means that pxa_rtc_probe also needs to do allocation for the rtc_device struct, otherwise sa1100_rtc_init will try to dereference a null pointer. This patch adds that allocation by copying how sa1100_rtc_probe in drivers/rtc/rtc-sa1100.c does it; after the IRQs are set up a managed rtc_device is allocated. I've tested this patch with `qemu-system-arm -machine akita` and with a real Zaurus SL-C1000 applied to 4.19, 5.4, and 5.10. Signed-off-by: Laurence de Bruxelles Fixes: f2997775b111 ("rtc: sa1100: fix possible race condition") Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20220101154149.12026-1-lfdebrux@gmail.com Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/rtc/rtc-pxa.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/rtc/rtc-pxa.c +++ b/drivers/rtc/rtc-pxa.c @@ -330,6 +330,10 @@ static int __init pxa_rtc_probe(struct p if (sa1100_rtc->irq_alarm < 0) return -ENXIO; =20 + sa1100_rtc->rtc =3D devm_rtc_allocate_device(&pdev->dev); + if (IS_ERR(sa1100_rtc->rtc)) + return PTR_ERR(sa1100_rtc->rtc); + pxa_rtc->base =3D devm_ioremap(dev, pxa_rtc->ress->start, resource_size(pxa_rtc->ress)); if (!pxa_rtc->base) { From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AF5BC433FE for ; Mon, 24 Jan 2022 19:50:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357364AbiAXTtw (ORCPT ); Mon, 24 Jan 2022 14:49:52 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34990 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354870AbiAXTjc (ORCPT ); Mon, 24 Jan 2022 14:39:32 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 141506141C; Mon, 24 Jan 2022 19:39:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEAFEC340E5; Mon, 24 Jan 2022 19:39:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053171; bh=4KubBFmDsVrKB9scUEaiucazOFxFpJPrDKsfzlgOojM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yIlFtQZTnd4p1ZIlrUGQg+W0f584gekzdSAC5+nzzL9WPoO4zN7X/k+kRsvJcyRfK 0w+n9gkMqDEQtzEhO2hXMQ49p6gNvZPAbevCBp3/ktx3pdSYEbbST828dB0OLuWslx eM2H84d0qhtpuOTQ6kZ5aPLluSMqVutkBS5Fmv8M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" Subject: [PATCH 5.4 299/320] inet: frags: annotate races around fqdir->dead and fqdir->high_thresh Date: Mon, 24 Jan 2022 19:44:43 +0100 Message-Id: <20220124184004.126011562@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet commit 91341fa0003befd097e190ec2a4bf63ad957c49a upstream. Both fields can be read/written without synchronization, add proper accessors and documentation. Fixes: d5dd88794a13 ("inet: fix various use-after-free in defrags units") Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- include/net/inet_frag.h | 11 +++++++++-- include/net/ipv6_frag.h | 3 ++- net/ipv4/inet_fragment.c | 8 +++++--- net/ipv4/ip_fragment.c | 3 ++- 4 files changed, 18 insertions(+), 7 deletions(-) --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h @@ -116,8 +116,15 @@ int fqdir_init(struct fqdir **fqdirp, st =20 static inline void fqdir_pre_exit(struct fqdir *fqdir) { - fqdir->high_thresh =3D 0; /* prevent creation of new frags */ - fqdir->dead =3D true; + /* Prevent creation of new frags. + * Pairs with READ_ONCE() in inet_frag_find(). + */ + WRITE_ONCE(fqdir->high_thresh, 0); + + /* Pairs with READ_ONCE() in inet_frag_kill(), ip_expire() + * and ip6frag_expire_frag_queue(). + */ + WRITE_ONCE(fqdir->dead, true); } void fqdir_exit(struct fqdir *fqdir); =20 --- a/include/net/ipv6_frag.h +++ b/include/net/ipv6_frag.h @@ -67,7 +67,8 @@ ip6frag_expire_frag_queue(struct net *ne struct sk_buff *head; =20 rcu_read_lock(); - if (fq->q.fqdir->dead) + /* Paired with the WRITE_ONCE() in fqdir_pre_exit(). */ + if (READ_ONCE(fq->q.fqdir->dead)) goto out_rcu_unlock; spin_lock(&fq->q.lock); =20 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c @@ -204,9 +204,9 @@ void inet_frag_kill(struct inet_frag_que /* The RCU read lock provides a memory barrier * guaranteeing that if fqdir->dead is false then * the hash table destruction will not start until - * after we unlock. Paired with inet_frags_exit_net(). + * after we unlock. Paired with fqdir_pre_exit(). */ - if (!fqdir->dead) { + if (!READ_ONCE(fqdir->dead)) { rhashtable_remove_fast(&fqdir->rhashtable, &fq->node, fqdir->f->rhash_params); refcount_dec(&fq->refcnt); @@ -321,9 +321,11 @@ static struct inet_frag_queue *inet_frag /* TODO : call from rcu_read_lock() and no longer use refcount_inc_not_zer= o() */ struct inet_frag_queue *inet_frag_find(struct fqdir *fqdir, void *key) { + /* This pairs with WRITE_ONCE() in fqdir_pre_exit(). */ + long high_thresh =3D READ_ONCE(fqdir->high_thresh); struct inet_frag_queue *fq =3D NULL, *prev; =20 - if (!fqdir->high_thresh || frag_mem_limit(fqdir) > fqdir->high_thresh) + if (!high_thresh || frag_mem_limit(fqdir) > high_thresh) return NULL; =20 rcu_read_lock(); --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c @@ -144,7 +144,8 @@ static void ip_expire(struct timer_list =20 rcu_read_lock(); =20 - if (qp->q.fqdir->dead) + /* Paired with WRITE_ONCE() in fqdir_pre_exit(). */ + if (READ_ONCE(qp->q.fqdir->dead)) goto out_rcu_unlock; =20 spin_lock(&qp->q.lock); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79D37C4321E for ; Mon, 24 Jan 2022 19:50:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357467AbiAXTuF (ORCPT ); Mon, 24 Jan 2022 14:50:05 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60068 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354921AbiAXTji (ORCPT ); Mon, 24 Jan 2022 14:39:38 -0500 Received: from smtp.kernel.org (relay.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 D219CB810BD; Mon, 24 Jan 2022 19:39:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0811C340E5; Mon, 24 Jan 2022 19:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053174; bh=5vvXEwtT+nl1XZYj/msZ/ibkaZkOY9t/AmP0MCYpxQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DgnYED6RraJNO101Mb6Hi51wdYyQCkjjb0gOMKtxSq8q6ZUrlEU56QEUHjX8tH+i9 pRywiHqX+O/stuY5BBbes5R+Kn9ikI+Iz3rIrJnE6kiiPTiRS5CavueT9wHJyVG6Ef Q5HCuGuVXgsraQZpP0U5W6JyHvDW5cpcGT35G4uc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "Eric W. Biederman" , "David S. Miller" Subject: [PATCH 5.4 300/320] netns: add schedule point in ops_exit_list() Date: Mon, 24 Jan 2022 19:44:44 +0100 Message-Id: <20220124184004.156321648@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet commit 2836615aa22de55b8fca5e32fe1b27a67cda625e upstream. When under stress, cleanup_net() can have to dismantle netns in big numbers. ops_exit_list() currently calls many helpers [1] that have no schedule point, and we can end up with soft lockups, particularly on hosts with many cpus. Even for moderate amount of netns processed by cleanup_net() this patch avoids latency spikes. [1] Some of these helpers like fib_sync_up() and fib_sync_down_dev() are very slow because net/ipv4/fib_semantics.c uses host-wide hash tables, and ifindex is used as the only input of two hash functions. ifindexes tend to be the same for all netns (lo.ifindex=3D=3D1 per inst= ance) This will be fixed in a separate patch. Fixes: 72ad937abd0a ("net: Add support for batching network namespace clean= ups") Signed-off-by: Eric Dumazet Cc: Eric W. Biederman Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/core/net_namespace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -168,8 +168,10 @@ static void ops_exit_list(const struct p { struct net *net; if (ops->exit) { - list_for_each_entry(net, net_exit_list, exit_list) + list_for_each_entry(net, net_exit_list, exit_list) { ops->exit(net); + cond_resched(); + } } if (ops->exit_batch) ops->exit_batch(net_exit_list); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 779FCC4332F for ; Mon, 24 Jan 2022 19:50:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357400AbiAXTtz (ORCPT ); Mon, 24 Jan 2022 14:49:55 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37238 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354924AbiAXTjj (ORCPT ); Mon, 24 Jan 2022 14:39:39 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 34A256131E; Mon, 24 Jan 2022 19:39:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 077B9C340E5; Mon, 24 Jan 2022 19:39:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053177; bh=NYJ7RpJ3Zpj/TBTgN+RPZymLDIAJnEHe1ThwT5uOekQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hsCzJjof/heIHnsjTnx/QvxYNglJY2KmXefmizHAcdqf5c+ehwayZjQrLAvZJzCFn xJHO16eWsUe0AH/Z2G/PiM/K4K/yH/HSiJ/+qqSJrIk1saw6AiIwVaHrSqGZwM/Alp X7QZrnWetwyWM8RCbfDIMCnTvpZn24YH4qLA+CUU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Jakub Kicinski Subject: [PATCH 5.4 301/320] xfrm: Dont accidentally set RTO_ONLINK in decode_session4() Date: Mon, 24 Jan 2022 19:44:45 +0100 Message-Id: <20220124184004.188391880@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guillaume Nault commit 23e7b1bfed61e301853b5e35472820d919498278 upstream. Similar to commit 94e2238969e8 ("xfrm4: strip ECN bits from tos field"), clear the ECN bits from iph->tos when setting ->flowi4_tos. This ensures that the last bit of ->flowi4_tos is cleared, so ip_route_output_key_hash() isn't going to restrict the scope of the route lookup. Use ~INET_ECN_MASK instead of IPTOS_RT_MASK, because we have no reason to clear the high order bits. Found by code inspection, compile tested only. Fixes: 4da3089f2b58 ("[IPSEC]: Use TOS when doing tunnel lookups") Signed-off-by: Guillaume Nault Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/xfrm/xfrm_policy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -3282,7 +3283,7 @@ decode_session4(struct sk_buff *skb, str fl4->flowi4_proto =3D iph->protocol; fl4->daddr =3D reverse ? iph->saddr : iph->daddr; fl4->saddr =3D reverse ? iph->daddr : iph->saddr; - fl4->flowi4_tos =3D iph->tos; + fl4->flowi4_tos =3D iph->tos & ~INET_ECN_MASK; =20 if (!ip_is_fragment(iph)) { switch (iph->protocol) { From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAEBFC433EF for ; Mon, 24 Jan 2022 20:00:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359810AbiAXUAN (ORCPT ); Mon, 24 Jan 2022 15:00:13 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58832 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354971AbiAXTjq (ORCPT ); Mon, 24 Jan 2022 14:39:46 -0500 Received: from smtp.kernel.org (relay.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 C2937B811F9; Mon, 24 Jan 2022 19:39:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC917C340E5; Mon, 24 Jan 2022 19:39:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053183; bh=CK8CAGzGy8qPTGEr4D6PkQuiYvHfHcCmfKy/o/TGUVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g433rv54Lkl4y4ZKCr8WauNaX4q2w8dOxSJa4PSJ5z3mdkwFXMnubUvma3Wz4Anik cneYWhFHrrFpzFyEobXGvGarz0TXVgQE9FUKXH9+yMOcYeSiJjGaMYETwijIOxWu89 62iViTFL3Pi3cDzCPADi8HSI8pM1fpQiALMG84Bw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Jakub Kicinski Subject: [PATCH 5.4 302/320] gre: Dont accidentally set RTO_ONLINK in gre_fill_metadata_dst() Date: Mon, 24 Jan 2022 19:44:46 +0100 Message-Id: <20220124184004.225139699@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guillaume Nault commit f7716b318568b22fbf0e3be99279a979e217cf71 upstream. Mask the ECN bits before initialising ->flowi4_tos. The tunnel key may have the last ECN bit set, which will interfere with the route lookup process as ip_route_output_key_hash() interpretes this bit specially (to restrict the route scope). Found by code inspection, compile tested only. Fixes: 962924fa2b7a ("ip_gre: Refactor collect metatdata mode tunnel xmit t= o ip_md_tunnel_xmit") Signed-off-by: Guillaume Nault Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/ipv4/ip_gre.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -577,8 +577,9 @@ static int gre_fill_metadata_dst(struct =20 key =3D &info->key; ip_tunnel_init_flow(&fl4, IPPROTO_GRE, key->u.ipv4.dst, key->u.ipv4.src, - tunnel_id_to_key32(key->tun_id), key->tos, 0, - skb->mark, skb_get_hash(skb)); + tunnel_id_to_key32(key->tun_id), + key->tos & ~INET_ECN_MASK, 0, skb->mark, + skb_get_hash(skb)); rt =3D ip_route_output_key(dev_net(dev), &fl4); if (IS_ERR(rt)) return PTR_ERR(rt); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA6C0C4167D for ; Mon, 24 Jan 2022 19:50:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357486AbiAXTuI (ORCPT ); Mon, 24 Jan 2022 14:50:08 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35146 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354991AbiAXTjr (ORCPT ); Mon, 24 Jan 2022 14:39:47 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 348696148B; Mon, 24 Jan 2022 19:39:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16BD5C340E5; Mon, 24 Jan 2022 19:39:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053186; bh=DthYjh+AUf6U0msGHmNsk3EuOaLtsWRn1QyFhfakDLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CjbyhamFZQ8AOKXP5vuEvNCnumpkhL5R3UJYrdHdmRAHMCfUaIUc3seyhGbBq2+pe BZYlKiVacN2sf34PKmRFWo6h0CwKG2SBJMIjHb/BL7cFXZ7KjFn9ml4B2i/ClRn00O ymDAxuTQvFnPrkN1mZGsUNtwLEmuVyEb0QUSyjoM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Jakub Kicinski Subject: [PATCH 5.4 303/320] libcxgb: Dont accidentally set RTO_ONLINK in cxgb_find_route() Date: Mon, 24 Jan 2022 19:44:47 +0100 Message-Id: <20220124184004.256686805@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guillaume Nault commit a915deaa9abe4fb3a440312c954253a6a733608e upstream. Mask the ECN bits before calling ip_route_output_ports(). The tos variable might be passed directly from an IPv4 header, so it may have the last ECN bit set. This interferes with the route lookup process as ip_route_output_key_hash() interpretes this bit specially (to restrict the route scope). Found by code inspection, compile tested only. Fixes: 804c2f3e36ef ("libcxgb,iw_cxgb4,cxgbit: add cxgb_find_route()") Signed-off-by: Guillaume Nault Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c @@ -32,6 +32,7 @@ =20 #include #include +#include #include #include =20 @@ -99,7 +100,7 @@ cxgb_find_route(struct cxgb4_lld_info *l =20 rt =3D ip_route_output_ports(&init_net, &fl4, NULL, peer_ip, local_ip, peer_port, local_port, IPPROTO_TCP, - tos, 0); + tos & ~INET_ECN_MASK, 0); if (IS_ERR(rt)) return NULL; n =3D dst_neigh_lookup(&rt->dst, &peer_ip); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA4EEC2BA4C for ; Mon, 24 Jan 2022 19:50:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357502AbiAXTuK (ORCPT ); Mon, 24 Jan 2022 14:50:10 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60170 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355028AbiAXTjy (ORCPT ); Mon, 24 Jan 2022 14:39:54 -0500 Received: from smtp.kernel.org (relay.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 27732B81142; Mon, 24 Jan 2022 19:39:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59BE2C340E5; Mon, 24 Jan 2022 19:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053189; bh=TL1Xfz0ZRvKe04M8qbnQ2bKlTrASfu2apqLnWMTqNQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=izba72dK2ejXFHX9NWzfOyHRagrX8z1ksfR2QEfVDMMeGMRP8oDJQB2R443KpwADt K5I+koVcUjiTy9LsKUScTQsUW8GOsyy7N6XzhFIvMC8yIE3+TXwAvrc08GPpsabvBM dcXBodcRCuMr8yp5L6qqIOMQqqXSQPDbI8yzp2MU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Jiri Olsa , Arnaldo Carvalho de Melo Subject: [PATCH 5.4 304/320] perf script: Fix hex dump character output Date: Mon, 24 Jan 2022 19:44:48 +0100 Message-Id: <20220124184004.288294990@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adrian Hunter commit 62942e9fda9fd1def10ffcbd5e1c025b3c9eec17 upstream. Using grep -C with perf script -D can give erroneous results as grep loses lines due to non-printable characters, for example, below the 0020, 0060 and 0070 lines are missing: $ perf script -D | grep -C10 AUX | head . 0010: 08 00 00 00 00 00 00 00 1f 00 00 00 00 00 00 00 ................ . 0030: 01 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 ................ . 0040: 00 08 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0050: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................ . 0080: 02 00 00 00 00 00 00 00 1b 00 00 00 00 00 00 00 ................ . 0090: 00 00 00 00 00 00 00 00 ........ 0 0 0x450 [0x98]: PERF_RECORD_AUXTRACE_INFO type: 1 PMU Type 8 Time Shift 31 perf's isprint() is a custom implementation from the kernel, but the kernel's _ctype appears to include characters from Latin-1 Supplement which is not compatible with, for example, UTF-8. Fix by checking also isascii(). After: $ tools/perf/perf script -D | grep -C10 AUX | head . 0010: 08 00 00 00 00 00 00 00 1f 00 00 00 00 00 00 00 ................ . 0020: 03 84 32 2f 00 00 00 00 63 7c 4f d2 fa ff ff ff ..2/....c|O..... . 0030: 01 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 ................ . 0040: 00 08 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0050: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................ . 0060: 00 02 00 00 00 00 00 00 00 c0 03 00 00 00 00 00 ................ . 0070: e2 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0080: 02 00 00 00 00 00 00 00 1b 00 00 00 00 00 00 00 ................ . 0090: 00 00 00 00 00 00 00 00 ........ Fixes: 3052ba56bcb58904 ("tools perf: Move from sane_ctype.h obtained from = git to the Linux's original") Signed-off-by: Adrian Hunter Cc: Jiri Olsa Link: http://lore.kernel.org/lkml/20220112085057.277205-1-adrian.hunter@int= el.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- tools/perf/util/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c @@ -143,7 +143,7 @@ static int trace_event_printer(enum bina break; case BINARY_PRINT_CHAR_DATA: printed +=3D color_fprintf(fp, color, "%c", - isprint(ch) ? ch : '.'); + isprint(ch) && isascii(ch) ? ch : '.'); break; case BINARY_PRINT_CHAR_PAD: printed +=3D color_fprintf(fp, color, " "); From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC325C35268 for ; Mon, 24 Jan 2022 20:42:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241475AbiAXUlv (ORCPT ); Mon, 24 Jan 2022 15:41:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355544AbiAXUWb (ORCPT ); Mon, 24 Jan 2022 15:22:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6096C0417CB; Mon, 24 Jan 2022 11:39:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3ACC9B8121C; Mon, 24 Jan 2022 19:39:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63E6AC340E5; Mon, 24 Jan 2022 19:39:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053193; bh=TdBfH9yDEX18SMwX7BpD8oKnsT0/eTI2XzEfRHK2+LY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KtTSyumooJ9uJhGSnI3vnjlGvnADlAFam3YJr0nVmbKxF1Lgovj1hbBzCQFK+JV1i rtD+/ANyh+EynsZraUcR9KCfOlIviv7U1Mnh+V9vJyVxOhStIkZrhqnnn2Cam/CH1j /7t2B67WUWWvmfgKlCG4nujk7K7l3q9Yl1syu5Y8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Vinod Koul Subject: [PATCH 5.4 305/320] dmaengine: at_xdmac: Dont start transactions at tx_submit level Date: Mon, 24 Jan 2022 19:44:49 +0100 Message-Id: <20220124184004.319590007@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus commit bccfb96b59179d4f96cbbd1ddff8fac6d335eae4 upstream. tx_submit is supposed to push the current transaction descriptor to a pending queue, waiting for issue_pending() to be called. issue_pending() must start the transfer, not tx_submit(), thus remove at_xdmac_start_xfer() from at_xdmac_tx_submit(). Clients of at_xdmac that assume that tx_submit() starts the transfer must be updated and call dma_async_issue_pending() if they miss to call it (one example is atmel_serial). As the at_xdmac_start_xfer() is now called only from at_xdmac_advance_work() when !at_xdmac_chan_is_enabled(), the at_xdmac_chan_is_enabled() check is no longer needed in at_xdmac_start_xfer(), thus remove it. Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended D= MA Controller driver") Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20211215110115.191749-2-tudor.ambarus@micro= chip.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/dma/at_xdmac.c | 6 ------ 1 file changed, 6 deletions(-) --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -338,9 +338,6 @@ static void at_xdmac_start_xfer(struct a =20 dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, first); =20 - if (at_xdmac_chan_is_enabled(atchan)) - return; - /* Set transfer as active to not try to start it again. */ first->active_xfer =3D true; =20 @@ -430,9 +427,6 @@ static dma_cookie_t at_xdmac_tx_submit(s dev_vdbg(chan2dev(tx->chan), "%s: atchan 0x%p, add desc 0x%p to xfers_lis= t\n", __func__, atchan, desc); list_add_tail(&desc->xfer_node, &atchan->xfers_list); - if (list_is_singular(&atchan->xfers_list)) - at_xdmac_start_xfer(atchan, desc); - spin_unlock_irqrestore(&atchan->lock, irqflags); return cookie; } From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE5D8C4167D for ; Tue, 25 Jan 2022 02:36:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422971AbiAYCck (ORCPT ); Mon, 24 Jan 2022 21:32:40 -0500 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 S1355550AbiAXUWa (ORCPT ); Mon, 24 Jan 2022 15:22:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6A44C0417CC; Mon, 24 Jan 2022 11:39:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6E020B8121C; Mon, 24 Jan 2022 19:39:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78B57C340E5; Mon, 24 Jan 2022 19:39:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053196; bh=XvKunCyUTqhoDJttVMh5EWZ4rnj0JNBQ0NSEL9yv4Ak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kmsvG1WC1BAU75kosbi2IHI7+5/MX7h9cL0ntOru5anoZAIyUbZNk6NQVefkKJ19g dyui+MiXQato9cCJeYUDPC8xJSZfxr1rfRG9wvPTXwUuc5BlZl++O+Br7kkeEPrkgV ydt9Dihna92mDsaOJ5ngDIp3rLTzZePZ02o6bey8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Vinod Koul Subject: [PATCH 5.4 306/320] dmaengine: at_xdmac: Print debug message after realeasing the lock Date: Mon, 24 Jan 2022 19:44:50 +0100 Message-Id: <20220124184004.356910982@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus commit 5edc24ac876a928f36f407a0fcdb33b94a3a210f upstream. It is desirable to do the prints without the lock held if possible, so move the print after the lock is released. Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended D= MA Controller driver") Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20211215110115.191749-4-tudor.ambarus@micro= chip.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/dma/at_xdmac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -424,10 +424,12 @@ static dma_cookie_t at_xdmac_tx_submit(s spin_lock_irqsave(&atchan->lock, irqflags); cookie =3D dma_cookie_assign(tx); =20 - dev_vdbg(chan2dev(tx->chan), "%s: atchan 0x%p, add desc 0x%p to xfers_lis= t\n", - __func__, atchan, desc); list_add_tail(&desc->xfer_node, &atchan->xfers_list); spin_unlock_irqrestore(&atchan->lock, irqflags); + + dev_vdbg(chan2dev(tx->chan), "%s: atchan 0x%p, add desc 0x%p to xfers_lis= t\n", + __func__, atchan, desc); + return cookie; } =20 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6D22C433FE for ; Mon, 24 Jan 2022 19:51:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357535AbiAXTuO (ORCPT ); Mon, 24 Jan 2022 14:50:14 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37498 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355098AbiAXTkB (ORCPT ); Mon, 24 Jan 2022 14:40:01 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C2D7D61523; Mon, 24 Jan 2022 19:39:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E309C340E5; Mon, 24 Jan 2022 19:39:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053199; bh=Jxtv+A1161cRIGR/Gk7IFvyFKod5JdGJGCILTRds53I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=txNtJGR/Epvaq8MkmgwEtWJ6NTHCniCAssO7nTA6Ce2HUgp7b4GdZrwqP0D/7cWmw x19iE08VDaxKLeH76msEOD34MyOpJ+RfYWBTp7v6Es/IyOorMNbZm7tOqRty7zBPwt OMvSav/oUz6bQdGe8JWtJxipwsoGx/BkytyIebxg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Vinod Koul Subject: [PATCH 5.4 307/320] dmaengine: at_xdmac: Fix concurrency over xfers_list Date: Mon, 24 Jan 2022 19:44:51 +0100 Message-Id: <20220124184004.387740545@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus commit 18deddea9184b62941395889ff7659529c877326 upstream. Since tx_submit can be called from a hard IRQ, xfers_list must be protected with a lock to avoid concurency on the list's elements. Since at_xdmac_handle_cyclic() is called from a tasklet, spin_lock_irq is enough to protect from a hard IRQ. Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended D= MA Controller driver") Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20211215110115.191749-8-tudor.ambarus@micro= chip.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/dma/at_xdmac.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -1564,14 +1564,17 @@ static void at_xdmac_handle_cyclic(struc struct at_xdmac_desc *desc; struct dma_async_tx_descriptor *txd; =20 - if (!list_empty(&atchan->xfers_list)) { - desc =3D list_first_entry(&atchan->xfers_list, - struct at_xdmac_desc, xfer_node); - txd =3D &desc->tx_dma_desc; - - if (txd->flags & DMA_PREP_INTERRUPT) - dmaengine_desc_get_callback_invoke(txd, NULL); + spin_lock_irq(&atchan->lock); + if (list_empty(&atchan->xfers_list)) { + spin_unlock_irq(&atchan->lock); + return; } + desc =3D list_first_entry(&atchan->xfers_list, struct at_xdmac_desc, + xfer_node); + spin_unlock_irq(&atchan->lock); + txd =3D &desc->tx_dma_desc; + if (txd->flags & DMA_PREP_INTERRUPT) + dmaengine_desc_get_callback_invoke(txd, NULL); } =20 static void at_xdmac_handle_error(struct at_xdmac_chan *atchan) From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71193C433EF for ; Mon, 24 Jan 2022 20:00:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359539AbiAXT7s (ORCPT ); Mon, 24 Jan 2022 14:59:48 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33092 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349371AbiAXTlC (ORCPT ); Mon, 24 Jan 2022 14:41:02 -0500 Received: from smtp.kernel.org (relay.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 E673DB811FB; Mon, 24 Jan 2022 19:41:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27AD1C36AE9; Mon, 24 Jan 2022 19:40:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053259; bh=GmbIhl0GKXFYcgNw3rnSAj5/45aGoCjBXjN0MRLk7Lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bXxMZnrTkPQ+k5ajnsQ5e2GetsyFeqBOe379YUa0QGlYUaT3rfE+Is7qRCz9H6tbH OBLGYZSJD4M/7lNfulV7+7i+GCmnP5aY14j6uT+M5InAs616+a9j1VMIr8EdSs8jPk FDi8TZ85HKKCod21N4KVtLym8o7eDnTvB2GWOZuo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Vinod Koul Subject: [PATCH 5.4 308/320] dmaengine: at_xdmac: Fix lld view setting Date: Mon, 24 Jan 2022 19:44:52 +0100 Message-Id: <20220124184004.418436997@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus commit 1385eb4d14d447cc5d744bc2ac34f43be66c9963 upstream. AT_XDMAC_CNDC_NDVIEW_NDV3 was set even for AT_XDMAC_MBR_UBC_NDV2, because of the wrong bit handling. Fix it. Fixes: ee0fe35c8dcd ("dmaengine: xdmac: Handle descriptor's view 3 register= s") Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20211215110115.191749-10-tudor.ambarus@micr= ochip.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/dma/at_xdmac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -89,6 +89,7 @@ #define AT_XDMAC_CNDC_NDE (0x1 << 0) /* Channel x Next Descriptor Enabl= e */ #define AT_XDMAC_CNDC_NDSUP (0x1 << 1) /* Channel x Next Descriptor Sou= rce Update */ #define AT_XDMAC_CNDC_NDDUP (0x1 << 2) /* Channel x Next Descriptor Des= tination Update */ +#define AT_XDMAC_CNDC_NDVIEW_MASK GENMASK(28, 27) #define AT_XDMAC_CNDC_NDVIEW_NDV0 (0x0 << 3) /* Channel x Next Descripto= r View 0 */ #define AT_XDMAC_CNDC_NDVIEW_NDV1 (0x1 << 3) /* Channel x Next Descripto= r View 1 */ #define AT_XDMAC_CNDC_NDVIEW_NDV2 (0x2 << 3) /* Channel x Next Descripto= r View 2 */ @@ -353,7 +354,8 @@ static void at_xdmac_start_xfer(struct a */ if (at_xdmac_chan_is_cyclic(atchan)) reg =3D AT_XDMAC_CNDC_NDVIEW_NDV1; - else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3) + else if ((first->lld.mbr_ubc & + AT_XDMAC_CNDC_NDVIEW_MASK) =3D=3D AT_XDMAC_MBR_UBC_NDV3) reg =3D AT_XDMAC_CNDC_NDVIEW_NDV3; else reg =3D AT_XDMAC_CNDC_NDVIEW_NDV2; From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5046DC4332F for ; Mon, 24 Jan 2022 19:51:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350869AbiAXTua (ORCPT ); Mon, 24 Jan 2022 14:50:30 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37730 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355303AbiAXTkZ (ORCPT ); Mon, 24 Jan 2022 14:40:25 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B925761298; Mon, 24 Jan 2022 19:40:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DED0C340E5; Mon, 24 Jan 2022 19:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053224; bh=WS0FP5EzZnRXvSa/+sP/qnF6xwKayJlaYd0A6sJ99QA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dD2uMa/VyjRVtmlEIvhTZYMMYL4xXPmHU2c7xt5v76PEH6n3CTrpcKEBv6OUTPlq5 ZqsPA3xOPXpCljNVN6dwFGS4fsksBVtan88zL2Zho0XauAqz5xJd8mH1MOIUrMOZWU XpnIkHZNJ7v3tjvV0DrH6h7N/JSW2dXXSzq6NFbE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Vinod Koul Subject: [PATCH 5.4 309/320] dmaengine: at_xdmac: Fix at_xdmac_lld struct definition Date: Mon, 24 Jan 2022 19:44:53 +0100 Message-Id: <20220124184004.449445557@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus commit 912f7c6f7fac273f40e621447cf17d14b50d6e5b upstream. The hardware channel next descriptor view structure contains just fields of 32 bits, while dma_addr_t can be of type u64 or u32 depending on CONFIG_ARCH_DMA_ADDR_T_64BIT. Force u32 to comply with what the hardware expects. Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended D= MA Controller driver") Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20211215110115.191749-11-tudor.ambarus@micr= ochip.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/dma/at_xdmac.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -221,15 +221,15 @@ struct at_xdmac { =20 /* Linked List Descriptor */ struct at_xdmac_lld { - dma_addr_t mbr_nda; /* Next Descriptor Member */ - u32 mbr_ubc; /* Microblock Control Member */ - dma_addr_t mbr_sa; /* Source Address Member */ - dma_addr_t mbr_da; /* Destination Address Member */ - u32 mbr_cfg; /* Configuration Register */ - u32 mbr_bc; /* Block Control Register */ - u32 mbr_ds; /* Data Stride Register */ - u32 mbr_sus; /* Source Microblock Stride Register */ - u32 mbr_dus; /* Destination Microblock Stride Register */ + u32 mbr_nda; /* Next Descriptor Member */ + u32 mbr_ubc; /* Microblock Control Member */ + u32 mbr_sa; /* Source Address Member */ + u32 mbr_da; /* Destination Address Member */ + u32 mbr_cfg; /* Configuration Register */ + u32 mbr_bc; /* Block Control Register */ + u32 mbr_ds; /* Data Stride Register */ + u32 mbr_sus; /* Source Microblock Stride Register */ + u32 mbr_dus; /* Destination Microblock Stride Register */ }; =20 /* 64-bit alignment needed to update CNDA and CUBC registers in an atomic = way. */ From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 820D6C433EF for ; Mon, 24 Jan 2022 20:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390624AbiAXUp6 (ORCPT ); Mon, 24 Jan 2022 15:45:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356472AbiAXUXW (ORCPT ); Mon, 24 Jan 2022 15:23:22 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30006C0417D3; Mon, 24 Jan 2022 11:40:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C2CB2612E9; Mon, 24 Jan 2022 19:40:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AB5AC340E5; Mon, 24 Jan 2022 19:40:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053236; bh=3rPbOFr2/UomEnoslEhyoCs0jFZin3Hj41+6n7tDrps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fLgOmd11AQQpRpVeuy2Zh8MjqcZE86BdWOeKzmCw9I/3YAug1FUApGx06Zi/8OsjU FE/dBYsD/VdQ63jjr1yEl4AiELeZkYGQX3TV+8ik2q560fAEmN1ThAyJYldScCFY+c gLWsLqZCUAWQh24Qj8IZ2/yE5jgAAcMdTmRqayyE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Heidelberg , Bjorn Andersson Subject: [PATCH 5.4 310/320] arm64: dts: qcom: msm8996: drop not documented adreno properties Date: Mon, 24 Jan 2022 19:44:54 +0100 Message-Id: <20220124184004.481167881@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Heidelberg commit c41910f257a22dc406c60d8826b4a3b5398003a3 upstream. These properties aren't documented nor implemented in the driver. Drop them. Fixes warnings as: $ make dtbs_check DT_SCHEMA_FILES=3DDocumentation/devicetree/bindings/displ= ay/msm/gpu.yaml ... arch/arm64/boot/dts/qcom/msm8996-mtp.dt.yaml: gpu@b00000: 'qcom,gpu-quirk-f= ault-detect-mask', 'qcom,gpu-quirk-two-pass-use-wfi' do not match any of th= e regexes: 'pinctrl-[0-9]+' From schema: Documentation/devicetree/bindings/display/msm/gpu.yaml ... Fixes: 69cc3114ab0f ("arm64: dts: Add Adreno GPU definitions") Signed-off-by: David Heidelberg Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211030100413.28370-1-david@ixit.cz Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm64/boot/dts/qcom/msm8996.dtsi | 3 --- 1 file changed, 3 deletions(-) --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi @@ -2098,9 +2098,6 @@ nvmem-cells =3D <&gpu_speed_bin>; nvmem-cell-names =3D "speed_bin"; =20 - qcom,gpu-quirk-two-pass-use-wfi; - qcom,gpu-quirk-fault-detect-mask; - operating-points-v2 =3D <&gpu_opp_table>; =20 gpu_opp_table: opp-table { From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5563CC433FE for ; Mon, 24 Jan 2022 20:42:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358603AbiAXUmd (ORCPT ); Mon, 24 Jan 2022 15:42:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356533AbiAXUX0 (ORCPT ); Mon, 24 Jan 2022 15:23:26 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5FCBC0417D9; Mon, 24 Jan 2022 11:40:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7CD80B810AF; Mon, 24 Jan 2022 19:40:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3B81C340E5; Mon, 24 Jan 2022 19:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053239; bh=Tel8WpvjObCRmrZAAP6SGwebSrPTvmAswveLhfMl9mE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LaKsYUV9GiMI+alfrOCxEbvSzdhBrC7rlx1ASJR9B/i/DKRV4uqWjii2eQ6OvQ3Tm 3o2w+2maRRVm0bZuf6IwUNRdpPlWciTzkHyG9Jm/s76HeXeBDUIRbzJNW6TgF6vzuc n+GJ6TR0JXZoOjumckXTuYn11n26MNqBfeYD5hJ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kevin Bracey , Eric Dumazet , Jiri Pirko , Vimalkumar , Jakub Kicinski Subject: [PATCH 5.4 311/320] net_sched: restore "mpu xxx" handling Date: Mon, 24 Jan 2022 19:44:55 +0100 Message-Id: <20220124184004.511088561@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kevin Bracey commit fb80445c438c78b40b547d12b8d56596ce4ccfeb upstream. commit 56b765b79e9a ("htb: improved accuracy at high rates") broke "overhead X", "linklayer atm" and "mpu X" attributes. "overhead X" and "linklayer atm" have already been fixed. This restores the "mpu X" handling, as might be used by DOCSIS or Ethernet shaping: tc class add ... htb rate X overhead 4 mpu 64 The code being fixed is used by htb, tbf and act_police. Cake has its own mpu handling. qdisc_calculate_pkt_len still uses the size table containing values adjusted for mpu by user space. iproute2 tc has always passed mpu into the kernel via a tc_ratespec structure, but the kernel never directly acted on it, merely stored it so that it could be read back by `tc class show`. Rather, tc would generate length-to-time tables that included the mpu (and linklayer) in their construction, and the kernel used those tables. Since v3.7, the tables were no longer used. Along with "mpu", this also broke "overhead" and "linklayer" which were fixed in 01cb71d2d47b ("net_sched: restore "overhead xxx" handling", v3.10) and 8a8e3d84b171 ("net_sched: restore "linklayer atm" handling", v3.11). "overhead" was fixed by simply restoring use of tc_ratespec::overhead - this had originally been used by the kernel but was initially omitted from the new non-table-based calculations. "linklayer" had been handled in the table like "mpu", but the mode was not originally passed in tc_ratespec. The new implementation was made to handle it by getting new versions of tc to pass the mode in an extended tc_ratespec, and for older versions of tc the table contents were analysed at load time to deduce linklayer. As "mpu" has always been given to the kernel in tc_ratespec, accompanying the mpu-based table, we can restore system functionality with no userspace change by making the kernel act on the tc_ratespec value. Fixes: 56b765b79e9a ("htb: improved accuracy at high rates") Signed-off-by: Kevin Bracey Cc: Eric Dumazet Cc: Jiri Pirko Cc: Vimalkumar Link: https://lore.kernel.org/r/20220112170210.1014351-1-kevin@bracey.fi Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- include/net/sch_generic.h | 5 +++++ net/sched/sch_generic.c | 1 + 2 files changed, 6 insertions(+) --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -1264,6 +1264,7 @@ struct psched_ratecfg { u64 rate_bytes_ps; /* bytes per second */ u32 mult; u16 overhead; + u16 mpu; u8 linklayer; u8 shift; }; @@ -1273,6 +1274,9 @@ static inline u64 psched_l2t_ns(const st { len +=3D r->overhead; =20 + if (len < r->mpu) + len =3D r->mpu; + if (unlikely(r->linklayer =3D=3D TC_LINKLAYER_ATM)) return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift; =20 @@ -1295,6 +1299,7 @@ static inline void psched_ratecfg_getrat res->rate =3D min_t(u64, r->rate_bytes_ps, ~0U); =20 res->overhead =3D r->overhead; + res->mpu =3D r->mpu; res->linklayer =3D (r->linklayer & TC_LINKLAYER_MASK); } =20 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -1396,6 +1396,7 @@ void psched_ratecfg_precompute(struct ps { memset(r, 0, sizeof(*r)); r->overhead =3D conf->overhead; + r->mpu =3D conf->mpu; r->rate_bytes_ps =3D max_t(u64, conf->rate, rate64); r->linklayer =3D (conf->linklayer & TC_LINKLAYER_MASK); r->mult =3D 1; From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1AEDC433FE for ; Mon, 24 Jan 2022 19:51:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350791AbiAXTvY (ORCPT ); Mon, 24 Jan 2022 14:51:24 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37858 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346790AbiAXTkn (ORCPT ); Mon, 24 Jan 2022 14:40:43 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E231C61482; Mon, 24 Jan 2022 19:40:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5442C340E5; Mon, 24 Jan 2022 19:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053242; bh=EUR/jm+L4HhFA2yHUvgPJ9P9all3a0iZt49RZndztp4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SySatmMEHsZtz4Qu0ParYqmjrQg1KWMOaMykWUiF98jfPODw/eKmklVIQl6ULaK9X 7MENS89s6pf5NMB5XO7Ca9y58Kbw046tgOUIyRQCo0/k2AMKbLmBixSiKiGR6gea0P 9IOe4dpC5OsPdfrGRp8F4bQ4ZcRokkY8dU7icBsI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Florian Fainelli , "David S. Miller" Subject: [PATCH 5.4 312/320] bcmgenet: add WOL IRQ check Date: Mon, 24 Jan 2022 19:44:56 +0100 Message-Id: <20220124184004.548338336@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergey Shtylyov commit 9deb48b53e7f4056c2eaa2dc2ee3338df619e4f6 upstream. The driver neglects to check the result of platform_get_irq_optional()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL. Stop calling devm_request_irq() with the invalid IRQ #s. Fixes: 8562056f267d ("net: bcmgenet: request Wake-on-LAN interrupt") Signed-off-by: Sergey Shtylyov Acked-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -3507,10 +3507,12 @@ static int bcmgenet_probe(struct platfor =20 /* Request the WOL interrupt and advertise suspend if available */ priv->wol_irq_disabled =3D true; - err =3D devm_request_irq(&pdev->dev, priv->wol_irq, bcmgenet_wol_isr, 0, - dev->name, priv); - if (!err) - device_set_wakeup_capable(&pdev->dev, 1); + if (priv->wol_irq > 0) { + err =3D devm_request_irq(&pdev->dev, priv->wol_irq, + bcmgenet_wol_isr, 0, dev->name, priv); + if (!err) + device_set_wakeup_capable(&pdev->dev, 1); + } =20 /* Set the needed headroom to account for any possible * features enabling/disabling at runtime From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B2A6C433FE for ; Mon, 24 Jan 2022 20:00:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359790AbiAXUAL (ORCPT ); Mon, 24 Jan 2022 15:00:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59656 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244292AbiAXTks (ORCPT ); Mon, 24 Jan 2022 14:40:48 -0500 Received: from smtp.kernel.org (relay.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 8DCABB8122F; Mon, 24 Jan 2022 19:40:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9A95C340E5; Mon, 24 Jan 2022 19:40:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053245; bh=yrC4/59bDpg4P6F8ntcpYsVINcsebGMtT4MPqprAZJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pK1ofs0520J8kjpQszfKATeTEB9Bh7a2BkN0BgBHhXjBhNotDo7AK3BcCmLSlR/JM squ456ijwLqHHWwpJ+hJlLlR/S8uh9/rIQFyVLkQjL81CdTGgvPbfzG1pgmvhqKWge 7TFf2qVJh3xkGsKFjGX+FcAi3+CEtVK7jzodozts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , "David S. Miller" Subject: [PATCH 5.4 313/320] net: ethernet: mtk_eth_soc: fix error checking in mtk_mac_config() Date: Mon, 24 Jan 2022 19:44:57 +0100 Message-Id: <20220124184004.582592928@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tom Rix commit 214b3369ab9b0a6f28d6c970220c209417edbc65 upstream. Clang static analysis reports this problem mtk_eth_soc.c:394:7: warning: Branch condition evaluates to a garbage value if (err) ^~~ err is not initialized and only conditionally set. So intitialize err. Fixes: 7e538372694b ("net: ethernet: mediatek: Re-add support SGMII") Signed-off-by: Tom Rix Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -215,7 +215,7 @@ static void mtk_mac_config(struct phylin phylink_config); struct mtk_eth *eth =3D mac->hw; u32 mcr_cur, mcr_new, sid, i; - int val, ge_mode, err; + int val, ge_mode, err =3D 0; =20 /* MT76x8 has no hardware settings between for the MAC */ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) && From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E7A0C433F5 for ; Mon, 24 Jan 2022 19:51:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351370AbiAXTvj (ORCPT ); Mon, 24 Jan 2022 14:51:39 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38000 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346686AbiAXTkt (ORCPT ); Mon, 24 Jan 2022 14:40:49 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A94EE61543; Mon, 24 Jan 2022 19:40:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88C13C340E5; Mon, 24 Jan 2022 19:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053248; bh=BpYPUZRVnVVrF1JoUHFH1eR+soNCBH8Y8qRLv1Sz2IY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q/oKDjam5E4jeblHew4wrWshAN2RLljoHGl2d85pgU17J/0SzNVfMA6WlFFR35Ngs AEMaAS9EYeIjIzVDuNrIY7mN5sQYhOKyw4sT4J6/bgRZaw4Fn1Gz+PwRYbVzdvzizu UhahmJZ+gzJXzkrI1raN/xU0xDJd6k8Hd+chvAzI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Neil Armstrong Subject: [PATCH 5.4 314/320] dt-bindings: display: meson-dw-hdmi: add missing sound-name-prefix property Date: Mon, 24 Jan 2022 19:44:58 +0100 Message-Id: <20220124184004.613685488@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein commit 22bf4047d26980807611b7e2030803db375afd87 upstream. This is used in meson-gx and meson-g12. Add the property to the binding. This fixes the dtschema warning: hdmi-tx@c883a000: 'sound-name-prefix' does not match any of the regexes: 'pinctrl-[0-9]+' Signed-off-by: Alexander Stein Fixes: 376bf52deef5 ("dt-bindings: display: amlogic, meson-dw-hdmi: convert= to yaml") Acked-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20211223122434.39378-2-= alexander.stein@mailbox.org Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml | = 5 +++++ 1 file changed, 5 insertions(+) --- a/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml +++ b/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml @@ -10,6 +10,9 @@ title: Amlogic specific extensions to th maintainers: - Neil Armstrong =20 +allOf: + - $ref: /schemas/sound/name-prefix.yaml# + description: | The Amlogic Meson Synopsys Designware Integration is composed of - A Synopsys DesignWare HDMI Controller IP @@ -101,6 +104,8 @@ properties: "#sound-dai-cells": const: 0 =20 + sound-name-prefix: true + required: - compatible - reg From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0BA6C433F5 for ; Mon, 24 Jan 2022 20:43:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358999AbiAXUnU (ORCPT ); Mon, 24 Jan 2022 15:43:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356011AbiAXUYW (ORCPT ); Mon, 24 Jan 2022 15:24:22 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80C1CC03401E; Mon, 24 Jan 2022 11:40:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3D059B81239; Mon, 24 Jan 2022 19:40:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A979C340E5; Mon, 24 Jan 2022 19:40:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053251; bh=SXLfzd5y8qbHZcNAsfFwg8ytvIlVzeFuNSCndUNrVus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ns/wKTM/qYVopfEnAZEpacCiA1Ht2Zoxy5p8bbg4ZVwfNntf1iYNypedG8RBC6J90 jtBjmvZgW1HCKT6FXUoGfdi6abK7+ReG1lsOXWjXZBv+mAUAvcPrhy4POv1XyBAfEP Lyd1m6f/OoHXJIe6hWP1A4TnCLjyrfSR/tS37xvU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Rob Herring , Neil Armstrong , Martin Blumenstingl Subject: [PATCH 5.4 315/320] dt-bindings: display: meson-vpu: Add missing amlogic,canvas property Date: Mon, 24 Jan 2022 19:44:59 +0100 Message-Id: <20220124184004.652659969@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein commit 640f35b871d29cd685ce0ea0762636381beeb98a upstream. This property was already mentioned in the old textual bindings amlogic,meson-vpu.txt, but got dropped during conversion. Adding it back similar to amlogic,gx-vdec.yaml. Fixes: 6b9ebf1e0e67 ("dt-bindings: display: amlogic, meson-vpu: convert to = yaml") Signed-off-by: Alexander Stein Acked-by: Rob Herring Reviewed-by: Neil Armstrong Reviewed-by: Martin Blumenstingl Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20211219094155.177206-1= -alexander.stein@mailbox.org Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml | 6 ++= ++++ 1 file changed, 6 insertions(+) --- a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml +++ b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml @@ -78,6 +78,10 @@ properties: interrupts: maxItems: 1 =20 + amlogic,canvas: + description: should point to a canvas provider node + $ref: /schemas/types.yaml#/definitions/phandle + power-domains: maxItems: 1 description: phandle to the associated power domain @@ -106,6 +110,7 @@ required: - port@1 - "#address-cells" - "#size-cells" + - amlogic,canvas =20 examples: - | @@ -116,6 +121,7 @@ examples: interrupts =3D <3>; #address-cells =3D <1>; #size-cells =3D <0>; + amlogic,canvas =3D <&canvas>; =20 /* CVBS VDAC output port */ port@0 { From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21691C433EF for ; Mon, 24 Jan 2022 20:49:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356254AbiAXUsn (ORCPT ); Mon, 24 Jan 2022 15:48:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354371AbiAXUYa (ORCPT ); Mon, 24 Jan 2022 15:24:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D1F7C0085BD; Mon, 24 Jan 2022 11:40:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 21F59B81239; Mon, 24 Jan 2022 19:40:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50BCAC340E5; Mon, 24 Jan 2022 19:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053253; bh=4vD56yFlgUBC5atksTz50D4Z2EyBrU/6DhqxbVI8tNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BzfnHKaLpfGrmy0fpiDDD56QR7FKLlYQtC4VREilCOjC9gRo3bfTVPl2IJknuJtXI rLxMIojTNBXG2+Qk6Bo46uEMesFoELr+l5uSQXVCDA/tinmknZxVZFstAwOeIBNgVY 5H1MBaU7Wjp41g1RyA43nOqvSH7tH8ApBllE3Wys= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Schiffer , Frank Rowand , Rob Herring Subject: [PATCH 5.4 316/320] scripts/dtc: dtx_diff: remove broken example from help text Date: Mon, 24 Jan 2022 19:45:00 +0100 Message-Id: <20220124184004.689164480@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Matthias Schiffer commit d8adf5b92a9d2205620874d498c39923ecea8749 upstream. dtx_diff suggests to use <(...) syntax to pipe two inputs into it, but this has never worked: The /proc/self/fds/... paths passed by the shell will fail the `[ -f "${dtx}" ] && [ -r "${dtx}" ]` check in compile_to_dts, but even with this check removed, the function cannot work: hexdump will eat up the DTB magic, making the subsequent dtc call fail, as a pipe cannot be rewound. Simply remove this broken example, as there is already an alternative one that works fine. Fixes: 10eadc253ddf ("dtc: create tool to diff device trees") Signed-off-by: Matthias Schiffer Reviewed-by: Frank Rowand Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20220113081918.10387-1-matthias.schiffer@ew= .tq-group.com Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- scripts/dtc/dtx_diff | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- a/scripts/dtc/dtx_diff +++ b/scripts/dtc/dtx_diff @@ -56,12 +56,8 @@ Otherwise DTx is treated as a dts source or '/include/' to be processed. =20 If DTx_1 and DTx_2 are in different architectures, then this script - may not work since \${ARCH} is part of the include path. Two possible - workarounds: - - `basename $0` \\ - <(ARCH=3Darch_of_dtx_1 `basename $0` DTx_1) \\ - <(ARCH=3Darch_of_dtx_2 `basename $0` DTx_2) + may not work since \${ARCH} is part of the include path. The following + workaround can be used: =20 `basename $0` ARCH=3Darch_of_dtx_1 DTx_1 >tmp_dtx_1.dts `basename $0` ARCH=3Darch_of_dtx_2 DTx_2 >tmp_dtx_2.dts From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3EDCC433EF for ; Mon, 24 Jan 2022 20:43:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344074AbiAXUn3 (ORCPT ); Mon, 24 Jan 2022 15:43:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353874AbiAXUYc (ORCPT ); Mon, 24 Jan 2022 15:24:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8963C00666A; Mon, 24 Jan 2022 11:40:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 68972614BB; Mon, 24 Jan 2022 19:40:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50E8BC340EA; Mon, 24 Jan 2022 19:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053256; bh=qlT3vnluDMsRouKx8Jpg9yt05ismtEnGetjEo7q+Ykw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oDU4YRz5vLa5GEEiL8AZtZvh+k4zzaWns80/u09qFHua1JwJmrvi+vO6l07fYJLr5 tmo6tnUBCwZppv8D/wSoZpP/COasD+tJolA3WAnydoQrVNNbXsiLDFx4wBNQq+8d5z pWS8OWF4rr16gN5hf2YmbuFsP9ZmcqMSzg1Si6JA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , "David S. Miller" Subject: [PATCH 5.4 317/320] lib82596: Fix IRQ check in sni_82596_probe Date: Mon, 24 Jan 2022 19:45:01 +0100 Message-Id: <20220124184004.719495777@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin commit 99218cbf81bf21355a3de61cd46a706d36e900e6 upstream. platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example: int irq =3D platform_get_irq(pdev, 0); if (irq < 0) return irq; Fix the check of return value to catch errors correctly. Fixes: 115978859272 ("i825xx: Move the Intel 82586/82593/82596 based driver= s") Signed-off-by: Miaoqian Lin Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/i825xx/sni_82596.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/i825xx/sni_82596.c +++ b/drivers/net/ethernet/i825xx/sni_82596.c @@ -123,9 +123,10 @@ static int sni_82596_probe(struct platfo netdevice->dev_addr[5] =3D readb(eth_addr + 0x06); iounmap(eth_addr); =20 - if (!netdevice->irq) { + if (netdevice->irq < 0) { printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n", __FILE__, netdevice->base_addr); + retval =3D netdevice->irq; goto probe_failed; } =20 From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C0F7C433FE for ; Mon, 24 Jan 2022 19:56:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358805AbiAXTzu (ORCPT ); Mon, 24 Jan 2022 14:55:50 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60392 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355328AbiAXTkb (ORCPT ); Mon, 24 Jan 2022 14:40:31 -0500 Received: from smtp.kernel.org (relay.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 3FD71B81215; Mon, 24 Jan 2022 19:40:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78AF2C340E5; Mon, 24 Jan 2022 19:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053227; bh=Bl5llVI2z9O6KxJJgC5I6x36I+iAXLOaQmkkZq6i4e4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MbA1VIYc3qNXF0Cbts0dWadhKxgOWbZNf/5LESEj0oqRF87nxH69eYvTRZ6ohZFLO FLa89VX2pnfLTIzI8xcimD9tFn6M6V+ihf8ef0d84ma1Q8DngCSaaPnnX9Oklnji0x FzsTQjOLcymgFmsAYfAgE4Mvc6vyXPU3miPxCnnE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , Andrew Morton , Linus Torvalds Subject: [PATCH 5.4 318/320] lib/test_meminit: destroy cache in kmem_cache_alloc_bulk() test Date: Mon, 24 Jan 2022 19:45:02 +0100 Message-Id: <20220124184004.756506394@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrey Konovalov commit e073e5ef90298d2d6e5e7f04b545a0815e92110c upstream. Make do_kmem_cache_size_bulk() destroy the cache it creates. Link: https://lkml.kernel.org/r/aced20a94bf04159a139f0846e41d38a1537debb.16= 40018297.git.andreyknvl@google.com Fixes: 03a9349ac0e0 ("lib/test_meminit: add a kmem_cache_alloc_bulk() test") Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Cc: Alexander Potapenko Cc: Dmitry Vyukov Cc: Andrey Ryabinin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- lib/test_meminit.c | 1 + 1 file changed, 1 insertion(+) --- a/lib/test_meminit.c +++ b/lib/test_meminit.c @@ -319,6 +319,7 @@ static int __init do_kmem_cache_size_bul if (num) kmem_cache_free_bulk(c, num, objects); } + kmem_cache_destroy(c); *total_failures +=3D fail; return 1; } From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E321C433FE for ; Mon, 24 Jan 2022 19:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358835AbiAXTzz (ORCPT ); Mon, 24 Jan 2022 14:55:55 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37778 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355335AbiAXTkc (ORCPT ); Mon, 24 Jan 2022 14:40:32 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A14F6135E; Mon, 24 Jan 2022 19:40:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C863C340E5; Mon, 24 Jan 2022 19:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053230; bh=o4vXwjtGO5bckZbOzF25uhyLz3mbp8Clz6bUC0ZiGSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gUpzveh7nC8uOE/NkthwF7fMpdZJWvJ6fslIRb5vFAZ6ho408ZQgGpsfn+nroDBL1 y5Cm8pneoEDB3GR1KD4YHNegtwTQ9z5BPLCq/SO/J7NEAQ+NW14VsAG6HNLgERRbay zPtrCIm/PK5cSI7362awXwwrbzNM43QchJ6//Gq4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrick Doyle , Richard Weinberger , Yoshio Furuyama , Miquel Raynal , Frieder Schrempf Subject: [PATCH 5.4 319/320] mtd: nand: bbt: Fix corner case in bad block table handling Date: Mon, 24 Jan 2022 19:45:03 +0100 Message-Id: <20220124184004.787407516@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Doyle, Patrick commit fd0d8d85f7230052e638a56d1bfea170c488e6bc upstream. In the unlikely event that both blocks 10 and 11 are marked as bad (on a 32 bit machine), then the process of marking block 10 as bad stomps on cached entry for block 11. There are (of course) other examples. Signed-off-by: Patrick Doyle Reviewed-by: Richard Weinberger Signed-off-by: Yoshio Furuyama [: Fixed the title] Signed-off-by: Miquel Raynal Cc: Frieder Schrempf Link: https://lore.kernel.org/linux-mtd/774a92693f311e7de01e5935e720a179fb1= b2468.1616635406.git.ytc-mb-yfuruyama7@kioxia.com Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/mtd/nand/bbt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mtd/nand/bbt.c +++ b/drivers/mtd/nand/bbt.c @@ -123,7 +123,7 @@ int nanddev_bbt_set_block_status(struct unsigned int rbits =3D bits_per_block + offs - BITS_PER_LONG; =20 pos[1] &=3D ~GENMASK(rbits - 1, 0); - pos[1] |=3D val >> rbits; + pos[1] |=3D val >> (bits_per_block - rbits); } =20 return 0; From nobody Tue Jun 30 05:22:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48911C4332F for ; Mon, 24 Jan 2022 20:49:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390653AbiAXUqA (ORCPT ); Mon, 24 Jan 2022 15:46:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356459AbiAXUXV (ORCPT ); Mon, 24 Jan 2022 15:23:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93EADC0417D2; Mon, 24 Jan 2022 11:40:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5D529B810AF; Mon, 24 Jan 2022 19:40:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FCEDC340E5; Mon, 24 Jan 2022 19:40:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053233; bh=ANb36/vL4AN6qiRw1rm/W3zBn10mTgx73/eymUafD68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cdCHQpNgput25IMFtLRIA/+UQio7M6su2Sl3TjNRac8nQP78PfBpvQ1mzkQhX3vc5 0QXEAwpMSfU0v7i+x/fuo64aOFwVBUoQ3aZFOjLBoBgifWPfUoW61/oLlNNEYW4aRQ 4/Cd+zb0OHpIWHzOASra1/Ye4xboSZgGdk+nYIuw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Masami Hiramatsu Subject: [PATCH 5.4 320/320] Revert "ia64: kprobes: Use generic kretprobe trampoline handler" Date: Mon, 24 Jan 2022 19:45:04 +0100 Message-Id: <20220124184004.817741092@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Masami Hiramatsu This reverts commit 77fa5e15c933a1ec812de61ad709c00aa51e96ae. Since the upstream commit e792ff804f49720ce003b3e4c618b5d996256a18 depends on the generic kretprobe trampoline handler, which was introduced by commit 66ada2ccae4e ("kprobes: Add generic kretprobe trampoline handler") but that is not ported to the stable kernel because it is not a bugfix series. So revert this commit to fix a build error. NOTE: I keep commit a7fe2378454c ("ia64: kprobes: Fix to pass correct trampoline address to the handler") on the tree, that seems just a cleanup without the original reverted commit, but it would be better to use dereference_function_descriptor() macro instead of accessing descriptor's field directly. Fixes: 77fa5e15c933 ("ia64: kprobes: Use generic kretprobe trampoline handl= er") Reported-by: kernel test robot Signed-off-by: Masami Hiramatsu Signed-off-by: Greg Kroah-Hartman Tested-by: Hulk Robot Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/ia64/kernel/kprobes.c | 78 ++++++++++++++++++++++++++++++++++++++++= +++-- 1 file changed, 75 insertions(+), 3 deletions(-) --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c @@ -396,10 +396,83 @@ static void kretprobe_trampoline(void) { } =20 +/* + * At this point the target function has been tricked into + * returning into our trampoline. Lookup the associated instance + * and then: + * - call the handler function + * - cleanup by marking the instance as unused + * - long jump back to the original return address + */ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *r= egs) { - regs->cr_iip =3D __kretprobe_trampoline_handler(regs, - dereference_function_descriptor(kretprobe_trampoline), NULL); + struct kretprobe_instance *ri =3D NULL; + struct hlist_head *head, empty_rp; + struct hlist_node *tmp; + unsigned long flags, orig_ret_address =3D 0; + unsigned long trampoline_address =3D + (unsigned long)dereference_function_descriptor(kretprobe_trampoline); + + INIT_HLIST_HEAD(&empty_rp); + kretprobe_hash_lock(current, &head, &flags); + + /* + * It is possible to have multiple instances associated with a given + * task either because an multiple functions in the call path + * have a return probe installed on them, and/or more than one return + * return probe was registered for a target function. + * + * We can handle this because: + * - instances are always inserted at the head of the list + * - when multiple return probes are registered for the same + * function, the first instance's ret_addr will point to the + * real return address, and all the rest will point to + * kretprobe_trampoline + */ + hlist_for_each_entry_safe(ri, tmp, head, hlist) { + if (ri->task !=3D current) + /* another task is sharing our hash bucket */ + continue; + + orig_ret_address =3D (unsigned long)ri->ret_addr; + if (orig_ret_address !=3D trampoline_address) + /* + * This is the real return address. Any other + * instances associated with this task are for + * other calls deeper on the call stack + */ + break; + } + + regs->cr_iip =3D orig_ret_address; + + hlist_for_each_entry_safe(ri, tmp, head, hlist) { + if (ri->task !=3D current) + /* another task is sharing our hash bucket */ + continue; + + if (ri->rp && ri->rp->handler) + ri->rp->handler(ri, regs); + + orig_ret_address =3D (unsigned long)ri->ret_addr; + recycle_rp_inst(ri, &empty_rp); + + if (orig_ret_address !=3D trampoline_address) + /* + * This is the real return address. Any other + * instances associated with this task are for + * other calls deeper on the call stack + */ + break; + } + kretprobe_assert(ri, orig_ret_address, trampoline_address); + + kretprobe_hash_unlock(current, &flags); + + hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) { + hlist_del(&ri->hlist); + kfree(ri); + } /* * By returning a non-zero value, we are telling * kprobe_handler() that we don't want the post_handler @@ -412,7 +485,6 @@ void __kprobes arch_prepare_kretprobe(st struct pt_regs *regs) { ri->ret_addr =3D (kprobe_opcode_t *)regs->b0; - ri->fp =3D NULL; =20 /* Replace the return addr with trampoline addr */ regs->b0 =3D (unsigned long)dereference_function_descriptor(kretprobe_tra= mpoline);