--- /dev/null
+From a204b490595de71016b2360a1886ec8c12d0afac Mon Sep 17 00:00:00 2001
+From: Joel Selvaraj <joelselvaraj.oss@gmail.com>
+Date: Sun, 12 Mar 2023 23:14:02 -0500
+Subject: scsi: core: Add BLIST_SKIP_VPD_PAGES for SKhynix H28U74301AMR
+
+From: Joel Selvaraj <joelselvaraj.oss@gmail.com>
+
+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 <joelselvaraj.oss@gmail.com>
+Link: https://lore.kernel.org/r/20230313041402.39330-1-joelselvaraj.oss@gmail.com
+Cc: stable@vger.kernel.org
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/scsi/scsi_devinfo.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/scsi/scsi_devinfo.c
++++ b/drivers/scsi/scsi_devinfo.c
+@@ -241,6 +241,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},
net-usb-cdc_mbim-avoid-altsetting-toggling-for-telit.patch
net-usb-qmi_wwan-add-telit-0x1080-composition.patch
sh-sanitize-the-flags-on-sigreturn.patch
+scsi-core-add-blist_skip_vpd_pages-for-skhynix-h28u74301amr.patch
+usb-gadget-u_audio-don-t-let-userspace-block-driver-unbind.patch
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
- arch/sh/include/asm/processor_32.h | 1 +
- arch/sh/kernel/signal_32.c | 3 +++
+ arch/sh/include/asm/processor_32.h | 1 +
+ arch/sh/kernel/signal_32.c | 3 +++
2 files changed, 4 insertions(+)
-diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
-index 95100d8a0b7b4..fc94603724b86 100644
--- a/arch/sh/include/asm/processor_32.h
+++ b/arch/sh/include/asm/processor_32.h
@@ -57,6 +57,7 @@
/*
* DSP structure and data
*/
-diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
-index c46c0020ff55e..ce93ae78c3002 100644
--- a/arch/sh/kernel/signal_32.c
+++ b/arch/sh/kernel/signal_32.c
@@ -116,6 +116,7 @@ static int
#define COPY(x) err |= __get_user(regs->x, &sc->sc_##x)
COPY(regs[1]);
-@@ -131,6 +132,8 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *r0_p
+@@ -131,6 +132,8 @@ restore_sigcontext(struct pt_regs *regs,
COPY(sr); COPY(pc);
#undef COPY
#ifdef CONFIG_SH_FPU
if (boot_cpu_data.flags & CPU_HAS_FPU) {
int owned_fp;
---
-2.39.2
-
--- /dev/null
+From 6c67ed9ad9b83e453e808f9b31a931a20a25629b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alvin=20=C5=A0ipraga?= <alsi@bang-olufsen.dk>
+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 <alsi@bang-olufsen.dk>
+
+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 <alsi@bang-olufsen.dk>
+Reviewed-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
+Reviewed-by: John Keeping <john@metanate.com>
+Link: https://lore.kernel.org/r/20230302163648.3349669-1-alvin@pqrs.dk
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -635,7 +635,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.ureq);
+ kfree(uac->c_prm.ureq);