From b47c6ddc82763cf11f4550707369edda56d219b4 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 28 Mar 2023 13:48:29 +0200 Subject: [PATCH] 5.15-stable patches added patches: cifs-empty-interface-list-when-server-doesn-t-support-query-interfaces.patch cifs-print-session-id-while-listing-open-files.patch scsi-core-add-blist_skip_vpd_pages-for-skhynix-h28u74301amr.patch usb-dwc2-fix-a-devres-leak-in-hw_enable-upon-suspend-resume.patch usb-gadget-u_audio-don-t-let-userspace-block-driver-unbind.patch --- ...ver-doesn-t-support-query-interfaces.patch | 33 ++++++ ...-session-id-while-listing-open-files.patch | 47 ++++++++ ...p_vpd_pages-for-skhynix-h28u74301amr.patch | 37 +++++++ queue-5.15/series | 5 + ...eak-in-hw_enable-upon-suspend-resume.patch | 100 ++++++++++++++++++ ...-t-let-userspace-block-driver-unbind.patch | 72 +++++++++++++ 6 files changed, 294 insertions(+) create mode 100644 queue-5.15/cifs-empty-interface-list-when-server-doesn-t-support-query-interfaces.patch create mode 100644 queue-5.15/cifs-print-session-id-while-listing-open-files.patch create mode 100644 queue-5.15/scsi-core-add-blist_skip_vpd_pages-for-skhynix-h28u74301amr.patch create mode 100644 queue-5.15/usb-dwc2-fix-a-devres-leak-in-hw_enable-upon-suspend-resume.patch create mode 100644 queue-5.15/usb-gadget-u_audio-don-t-let-userspace-block-driver-unbind.patch diff --git a/queue-5.15/cifs-empty-interface-list-when-server-doesn-t-support-query-interfaces.patch b/queue-5.15/cifs-empty-interface-list-when-server-doesn-t-support-query-interfaces.patch new file mode 100644 index 00000000000..7f4961200a2 --- /dev/null +++ b/queue-5.15/cifs-empty-interface-list-when-server-doesn-t-support-query-interfaces.patch @@ -0,0 +1,33 @@ +From 896cd316b841053f6df95ab77b5f1322c16a8e18 Mon Sep 17 00:00:00 2001 +From: Shyam Prasad N +Date: Thu, 9 Mar 2023 13:23:29 +0000 +Subject: cifs: empty interface list when server doesn't support query interfaces + +From: Shyam Prasad N + +commit 896cd316b841053f6df95ab77b5f1322c16a8e18 upstream. + +When querying server interfaces returns -EOPNOTSUPP, +clear the list of interfaces. Assumption is that multichannel +would be disabled too. + +Signed-off-by: Shyam Prasad N +Reviewed-by: Paulo Alcantara (SUSE) +Cc: stable@vger.kernel.org +Signed-off-by: Steve French +Signed-off-by: Greg Kroah-Hartman +--- + fs/cifs/smb2ops.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/cifs/smb2ops.c ++++ b/fs/cifs/smb2ops.c +@@ -653,7 +653,7 @@ SMB3_request_interfaces(const unsigned i + if (rc == -EOPNOTSUPP) { + cifs_dbg(FYI, + "server does not support query network interfaces\n"); +- goto out; ++ ret_data_len = 0; + } else if (rc != 0) { + cifs_tcon_dbg(VFS, "error %d on ioctl to get interface list\n", rc); + goto out; diff --git a/queue-5.15/cifs-print-session-id-while-listing-open-files.patch b/queue-5.15/cifs-print-session-id-while-listing-open-files.patch new file mode 100644 index 00000000000..77b113130ae --- /dev/null +++ b/queue-5.15/cifs-print-session-id-while-listing-open-files.patch @@ -0,0 +1,47 @@ +From 175b54abc443b6965e9379b71ec05f7c73c192e9 Mon Sep 17 00:00:00 2001 +From: Shyam Prasad N +Date: Mon, 13 Mar 2023 12:17:34 +0000 +Subject: cifs: print session id while listing open files + +From: Shyam Prasad N + +commit 175b54abc443b6965e9379b71ec05f7c73c192e9 upstream. + +In the output of /proc/fs/cifs/open_files, we only print +the tree id for the tcon of each open file. It becomes +difficult to know which tcon these files belong to with +just the tree id. + +This change dumps ses id in addition to all other data today. + +Signed-off-by: Shyam Prasad N +Reviewed-by: Paulo Alcantara (SUSE) +Cc: stable@vger.kernel.org +Signed-off-by: Steve French +Signed-off-by: Greg Kroah-Hartman +--- + fs/cifs/cifs_debug.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/fs/cifs/cifs_debug.c ++++ b/fs/cifs/cifs_debug.c +@@ -173,7 +173,7 @@ static int cifs_debug_files_proc_show(st + + seq_puts(m, "# Version:1\n"); + seq_puts(m, "# Format:\n"); +- seq_puts(m, "# "); ++ seq_puts(m, "# "); + #ifdef CONFIG_CIFS_DEBUG2 + seq_printf(m, " \n"); + #else +@@ -190,8 +190,9 @@ static int cifs_debug_files_proc_show(st + cfile = list_entry(tmp2, struct cifsFileInfo, + tlist); + seq_printf(m, +- "0x%x 0x%llx 0x%x %d %d %d %pd", ++ "0x%x 0x%llx 0x%llx 0x%x %d %d %d %pd", + tcon->tid, ++ ses->Suid, + cfile->fid.persistent_fid, + cfile->f_flags, + cfile->count, diff --git a/queue-5.15/scsi-core-add-blist_skip_vpd_pages-for-skhynix-h28u74301amr.patch b/queue-5.15/scsi-core-add-blist_skip_vpd_pages-for-skhynix-h28u74301amr.patch new file mode 100644 index 00000000000..4f110c69bf7 --- /dev/null +++ b/queue-5.15/scsi-core-add-blist_skip_vpd_pages-for-skhynix-h28u74301amr.patch @@ -0,0 +1,37 @@ +From a204b490595de71016b2360a1886ec8c12d0afac Mon Sep 17 00:00:00 2001 +From: Joel Selvaraj +Date: Sun, 12 Mar 2023 23:14:02 -0500 +Subject: scsi: core: Add BLIST_SKIP_VPD_PAGES for SKhynix H28U74301AMR + +From: Joel Selvaraj + +commit a204b490595de71016b2360a1886ec8c12d0afac upstream. + +Xiaomi Poco F1 (qcom/sdm845-xiaomi-beryllium*.dts) comes with a SKhynix +H28U74301AMR UFS. The sd_read_cpr() operation leads to a 120 second +timeout, making the device bootup very slow: + +[ 121.457736] sd 0:0:0:1: [sdb] tag#23 timing out command, waited 120s + +Setting the BLIST_SKIP_VPD_PAGES allows the device to skip the failing +sd_read_cpr operation and boot normally. + +Signed-off-by: Joel Selvaraj +Link: https://lore.kernel.org/r/20230313041402.39330-1-joelselvaraj.oss@gmail.com +Cc: stable@vger.kernel.org +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/scsi_devinfo.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/scsi/scsi_devinfo.c ++++ b/drivers/scsi/scsi_devinfo.c +@@ -233,6 +233,7 @@ static struct { + {"SGI", "RAID5", "*", BLIST_SPARSELUN}, + {"SGI", "TP9100", "*", BLIST_REPORTLUN2}, + {"SGI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, ++ {"SKhynix", "H28U74301AMR", NULL, BLIST_SKIP_VPD_PAGES}, + {"IBM", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, + {"SUN", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, + {"DELL", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, diff --git a/queue-5.15/series b/queue-5.15/series index 404b9040a5b..7165801524d 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -99,3 +99,8 @@ net-usb-qmi_wwan-add-telit-0x1080-composition.patch sh-sanitize-the-flags-on-sigreturn.patch net-sched-act_mirred-better-wording-on-protection-ag.patch act_mirred-use-the-backlog-for-nested-calls-to-mirre.patch +cifs-empty-interface-list-when-server-doesn-t-support-query-interfaces.patch +cifs-print-session-id-while-listing-open-files.patch +scsi-core-add-blist_skip_vpd_pages-for-skhynix-h28u74301amr.patch +usb-dwc2-fix-a-devres-leak-in-hw_enable-upon-suspend-resume.patch +usb-gadget-u_audio-don-t-let-userspace-block-driver-unbind.patch diff --git a/queue-5.15/usb-dwc2-fix-a-devres-leak-in-hw_enable-upon-suspend-resume.patch b/queue-5.15/usb-dwc2-fix-a-devres-leak-in-hw_enable-upon-suspend-resume.patch new file mode 100644 index 00000000000..e5a7c5fecc3 --- /dev/null +++ b/queue-5.15/usb-dwc2-fix-a-devres-leak-in-hw_enable-upon-suspend-resume.patch @@ -0,0 +1,100 @@ +From f747313249b74f323ddf841a9c8db14d989f296a Mon Sep 17 00:00:00 2001 +From: Fabrice Gasnier +Date: Thu, 16 Mar 2023 09:41:27 +0100 +Subject: usb: dwc2: fix a devres leak in hw_enable upon suspend resume + +From: Fabrice Gasnier + +commit f747313249b74f323ddf841a9c8db14d989f296a upstream. + +Each time the platform goes to low power, PM suspend / resume routines +call: __dwc2_lowlevel_hw_enable -> devm_add_action_or_reset(). +This adds a new devres each time. +This may also happen at runtime, as dwc2_lowlevel_hw_enable() can be +called from udc_start(). + +This can be seen with tracing: +- echo 1 > /sys/kernel/debug/tracing/events/dev/devres_log/enable +- go to low power +- cat /sys/kernel/debug/tracing/trace + +A new "ADD" entry is found upon each low power cycle: +... devres_log: 49000000.usb-otg ADD 82a13bba devm_action_release (8 bytes) +... devres_log: 49000000.usb-otg ADD 49889daf devm_action_release (8 bytes) +... + +A second issue is addressed here: +- regulator_bulk_enable() is called upon each PM cycle (suspend/resume). +- regulator_bulk_disable() never gets called. + +So the reference count for these regulators constantly increase, by one +upon each low power cycle, due to missing regulator_bulk_disable() call +in __dwc2_lowlevel_hw_disable(). + +The original fix that introduced the devm_add_action_or_reset() call, +fixed an issue during probe, that happens due to other errors in +dwc2_driver_probe() -> dwc2_core_reset(). Then the probe fails without +disabling regulators, when dr_mode == USB_DR_MODE_PERIPHERAL. + +Rather fix the error path: disable all the low level hardware in the +error path, by using the "hsotg->ll_hw_enabled" flag. Checking dr_mode +has been introduced to avoid a dual call to dwc2_lowlevel_hw_disable(). +"ll_hw_enabled" should achieve the same (and is used currently in the +remove() routine). + +Fixes: 54c196060510 ("usb: dwc2: Always disable regulators on driver teardown") +Fixes: 33a06f1300a7 ("usb: dwc2: Fix error path in gadget registration") +Cc: stable +Signed-off-by: Fabrice Gasnier +Link: https://lore.kernel.org/r/20230316084127.126084-1-fabrice.gasnier@foss.st.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc2/platform.c | 16 ++-------------- + 1 file changed, 2 insertions(+), 14 deletions(-) + +--- a/drivers/usb/dwc2/platform.c ++++ b/drivers/usb/dwc2/platform.c +@@ -121,13 +121,6 @@ static int dwc2_get_dr_mode(struct dwc2_ + return 0; + } + +-static void __dwc2_disable_regulators(void *data) +-{ +- struct dwc2_hsotg *hsotg = data; +- +- regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); +-} +- + static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg) + { + struct platform_device *pdev = to_platform_device(hsotg->dev); +@@ -138,11 +131,6 @@ static int __dwc2_lowlevel_hw_enable(str + if (ret) + return ret; + +- ret = devm_add_action_or_reset(&pdev->dev, +- __dwc2_disable_regulators, hsotg); +- if (ret) +- return ret; +- + if (hsotg->clk) { + ret = clk_prepare_enable(hsotg->clk); + if (ret) +@@ -198,7 +186,7 @@ static int __dwc2_lowlevel_hw_disable(st + if (hsotg->clk) + clk_disable_unprepare(hsotg->clk); + +- return 0; ++ return regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); + } + + /** +@@ -658,7 +646,7 @@ error_init: + if (hsotg->params.activate_stm_id_vb_detection) + regulator_disable(hsotg->usb33d); + error: +- if (hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) ++ if (hsotg->ll_hw_enabled) + dwc2_lowlevel_hw_disable(hsotg); + return retval; + } diff --git a/queue-5.15/usb-gadget-u_audio-don-t-let-userspace-block-driver-unbind.patch b/queue-5.15/usb-gadget-u_audio-don-t-let-userspace-block-driver-unbind.patch new file mode 100644 index 00000000000..ac75b440a01 --- /dev/null +++ b/queue-5.15/usb-gadget-u_audio-don-t-let-userspace-block-driver-unbind.patch @@ -0,0 +1,72 @@ +From 6c67ed9ad9b83e453e808f9b31a931a20a25629b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alvin=20=C5=A0ipraga?= +Date: Thu, 2 Mar 2023 17:36:47 +0100 +Subject: usb: gadget: u_audio: don't let userspace block driver unbind +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alvin Å ipraga + +commit 6c67ed9ad9b83e453e808f9b31a931a20a25629b upstream. + +In the unbind callback for f_uac1 and f_uac2, a call to snd_card_free() +via g_audio_cleanup() will disconnect the card and then wait for all +resources to be released, which happens when the refcount falls to zero. +Since userspace can keep the refcount incremented by not closing the +relevant file descriptor, the call to unbind may block indefinitely. +This can cause a deadlock during reboot, as evidenced by the following +blocked task observed on my machine: + + task:reboot state:D stack:0 pid:2827 ppid:569 flags:0x0000000c + Call trace: + __switch_to+0xc8/0x140 + __schedule+0x2f0/0x7c0 + schedule+0x60/0xd0 + schedule_timeout+0x180/0x1d4 + wait_for_completion+0x78/0x180 + snd_card_free+0x90/0xa0 + g_audio_cleanup+0x2c/0x64 + afunc_unbind+0x28/0x60 + ... + kernel_restart+0x4c/0xac + __do_sys_reboot+0xcc/0x1ec + __arm64_sys_reboot+0x28/0x30 + invoke_syscall+0x4c/0x110 + ... + +The issue can also be observed by opening the card with arecord and +then stopping the process through the shell before unbinding: + + # arecord -D hw:UAC2Gadget -f S32_LE -c 2 -r 48000 /dev/null + Recording WAVE '/dev/null' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo + ^Z[1]+ Stopped arecord -D hw:UAC2Gadget -f S32_LE -c 2 -r 48000 /dev/null + # echo gadget.0 > /sys/bus/gadget/drivers/configfs-gadget/unbind + (observe that the unbind command never finishes) + +Fix the problem by using snd_card_free_when_closed() instead, which will +still disconnect the card as desired, but defer the task of freeing the +resources to the core once userspace closes its file descriptor. + +Fixes: 132fcb460839 ("usb: gadget: Add Audio Class 2.0 Driver") +Cc: stable@vger.kernel.org +Signed-off-by: Alvin Å ipraga +Reviewed-by: Ruslan Bilovol +Reviewed-by: John Keeping +Link: https://lore.kernel.org/r/20230302163648.3349669-1-alvin@pqrs.dk +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/gadget/function/u_audio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/gadget/function/u_audio.c ++++ b/drivers/usb/gadget/function/u_audio.c +@@ -1174,7 +1174,7 @@ void g_audio_cleanup(struct g_audio *g_a + uac = g_audio->uac; + card = uac->card; + if (card) +- snd_card_free(card); ++ snd_card_free_when_closed(card); + + kfree(uac->p_prm.reqs); + kfree(uac->c_prm.reqs); -- 2.47.3