]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.17-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Jun 2022 07:28:07 +0000 (09:28 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Jun 2022 07:28:07 +0000 (09:28 +0200)
added patches:
alsa-hda-realtek-add-new-type-for-alc245.patch
alsa-hda-realtek-enable-4-speaker-output-for-dell-xps-15-9520-laptop.patch
alsa-hda-realtek-fix-microphone-noise-on-asus-tuf-b550m-plus.patch
alsa-usb-audio-cancel-pending-work-at-closing-a-midi-substream.patch
fs-ntfs3-check-new-size-for-limits.patch
fs-ntfs3-fix-fiemap-fix-shrink-file-size-to-remove-preallocated-space.patch
fs-ntfs3-fix-some-memory-leaks-in-an-error-handling-path-of-log_replay.patch
fs-ntfs3-in-function-ntfs_set_acl_ex-do-not-change-inode-i_mode-if-called-from-function-ntfs_init_acl.patch
fs-ntfs3-keep-preallocated-only-if-option-prealloc-enabled.patch
fs-ntfs3-restore-ntfs_xattr_get_acl-and-ntfs_xattr_set_acl-functions.patch
fs-ntfs3-update-i_ctime-when-xattr-is-added.patch
fs-ntfs3-update-valid-size-if-eiocbqueued.patch
parisc-stifb-keep-track-of-hardware-path-of-graphics-card.patch
risc-v-mark-ioresource_exclusive-for-reserved-mem-instead-of-ioresource_busy.patch
riscv-fix-irq_work-when-smp-is-disabled.patch
riscv-initialize-thread-pointer-before-calling-c-functions.patch
riscv-move-alternative-length-validation-into-subsection.patch
riscv-wire-up-memfd_secret-in-uapi-header.patch
usb-core-hcd-add-support-for-deferring-roothub-registration.patch
usb-dwc3-gadget-move-null-pinter-check-to-proper-place.patch
usb-isp1760-fix-out-of-bounds-array-access.patch
usb-new-quirk-for-dell-gen-2-devices.patch
usb-serial-option-add-quectel-bg95-modem.patch
usb-serial-pl2303-fix-type-detection-for-odd-device.patch

25 files changed:
queue-5.17/alsa-hda-realtek-add-new-type-for-alc245.patch [new file with mode: 0644]
queue-5.17/alsa-hda-realtek-enable-4-speaker-output-for-dell-xps-15-9520-laptop.patch [new file with mode: 0644]
queue-5.17/alsa-hda-realtek-fix-microphone-noise-on-asus-tuf-b550m-plus.patch [new file with mode: 0644]
queue-5.17/alsa-usb-audio-cancel-pending-work-at-closing-a-midi-substream.patch [new file with mode: 0644]
queue-5.17/fs-ntfs3-check-new-size-for-limits.patch [new file with mode: 0644]
queue-5.17/fs-ntfs3-fix-fiemap-fix-shrink-file-size-to-remove-preallocated-space.patch [new file with mode: 0644]
queue-5.17/fs-ntfs3-fix-some-memory-leaks-in-an-error-handling-path-of-log_replay.patch [new file with mode: 0644]
queue-5.17/fs-ntfs3-in-function-ntfs_set_acl_ex-do-not-change-inode-i_mode-if-called-from-function-ntfs_init_acl.patch [new file with mode: 0644]
queue-5.17/fs-ntfs3-keep-preallocated-only-if-option-prealloc-enabled.patch [new file with mode: 0644]
queue-5.17/fs-ntfs3-restore-ntfs_xattr_get_acl-and-ntfs_xattr_set_acl-functions.patch [new file with mode: 0644]
queue-5.17/fs-ntfs3-update-i_ctime-when-xattr-is-added.patch [new file with mode: 0644]
queue-5.17/fs-ntfs3-update-valid-size-if-eiocbqueued.patch [new file with mode: 0644]
queue-5.17/parisc-stifb-keep-track-of-hardware-path-of-graphics-card.patch [new file with mode: 0644]
queue-5.17/risc-v-mark-ioresource_exclusive-for-reserved-mem-instead-of-ioresource_busy.patch [new file with mode: 0644]
queue-5.17/riscv-fix-irq_work-when-smp-is-disabled.patch [new file with mode: 0644]
queue-5.17/riscv-initialize-thread-pointer-before-calling-c-functions.patch [new file with mode: 0644]
queue-5.17/riscv-move-alternative-length-validation-into-subsection.patch [new file with mode: 0644]
queue-5.17/riscv-wire-up-memfd_secret-in-uapi-header.patch [new file with mode: 0644]
queue-5.17/series
queue-5.17/usb-core-hcd-add-support-for-deferring-roothub-registration.patch [new file with mode: 0644]
queue-5.17/usb-dwc3-gadget-move-null-pinter-check-to-proper-place.patch [new file with mode: 0644]
queue-5.17/usb-isp1760-fix-out-of-bounds-array-access.patch [new file with mode: 0644]
queue-5.17/usb-new-quirk-for-dell-gen-2-devices.patch [new file with mode: 0644]
queue-5.17/usb-serial-option-add-quectel-bg95-modem.patch [new file with mode: 0644]
queue-5.17/usb-serial-pl2303-fix-type-detection-for-odd-device.patch [new file with mode: 0644]

diff --git a/queue-5.17/alsa-hda-realtek-add-new-type-for-alc245.patch b/queue-5.17/alsa-hda-realtek-add-new-type-for-alc245.patch
new file mode 100644 (file)
index 0000000..8bd33df
--- /dev/null
@@ -0,0 +1,60 @@
+From 60571929d06b028800f27b51a7c81de1144944cf Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Tue, 24 May 2022 16:14:04 +0800
+Subject: ALSA: hda/realtek - Add new type for ALC245
+
+From: Kailang Yang <kailang@realtek.com>
+
+commit 60571929d06b028800f27b51a7c81de1144944cf upstream.
+
+Add new type for ALC245.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/cef26a7cd3d146eb96a3994ce79e34d2@realtek.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/patch_realtek.c |   10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -3131,6 +3131,7 @@ enum {
+       ALC269_TYPE_ALC257,
+       ALC269_TYPE_ALC215,
+       ALC269_TYPE_ALC225,
++      ALC269_TYPE_ALC245,
+       ALC269_TYPE_ALC287,
+       ALC269_TYPE_ALC294,
+       ALC269_TYPE_ALC300,
+@@ -3168,6 +3169,7 @@ static int alc269_parse_auto_config(stru
+       case ALC269_TYPE_ALC257:
+       case ALC269_TYPE_ALC215:
+       case ALC269_TYPE_ALC225:
++      case ALC269_TYPE_ALC245:
+       case ALC269_TYPE_ALC287:
+       case ALC269_TYPE_ALC294:
+       case ALC269_TYPE_ALC300:
+@@ -3695,7 +3697,8 @@ static void alc225_init(struct hda_codec
+       hda_nid_t hp_pin = alc_get_hp_pin(spec);
+       bool hp1_pin_sense, hp2_pin_sense;
+-      if (spec->codec_variant != ALC269_TYPE_ALC287)
++      if (spec->codec_variant != ALC269_TYPE_ALC287 &&
++              spec->codec_variant != ALC269_TYPE_ALC245)
+               /* required only at boot or S3 and S4 resume time */
+               if (!spec->done_hp_init ||
+                       is_s3_resume(codec) ||
+@@ -10093,7 +10096,10 @@ static int patch_alc269(struct hda_codec
+       case 0x10ec0245:
+       case 0x10ec0285:
+       case 0x10ec0289:
+-              spec->codec_variant = ALC269_TYPE_ALC215;
++              if (alc_get_coef0(codec) & 0x0010)
++                      spec->codec_variant = ALC269_TYPE_ALC245;
++              else
++                      spec->codec_variant = ALC269_TYPE_ALC215;
+               spec->shutup = alc225_shutup;
+               spec->init_hook = alc225_init;
+               spec->gen.mixer_nid = 0;
diff --git a/queue-5.17/alsa-hda-realtek-enable-4-speaker-output-for-dell-xps-15-9520-laptop.patch b/queue-5.17/alsa-hda-realtek-enable-4-speaker-output-for-dell-xps-15-9520-laptop.patch
new file mode 100644 (file)
index 0000000..ace7cd7
--- /dev/null
@@ -0,0 +1,35 @@
+From 15dad62f4bdb5dc0f0efde8181d680db9963544c Mon Sep 17 00:00:00 2001
+From: Rik van der Kemp <rik@upto11.nl>
+Date: Fri, 27 May 2022 14:07:26 +0200
+Subject: ALSA: hda/realtek: Enable 4-speaker output for Dell XPS 15 9520 laptop
+
+From: Rik van der Kemp <rik@upto11.nl>
+
+commit 15dad62f4bdb5dc0f0efde8181d680db9963544c upstream.
+
+The 2022-model XPS 15 appears to use the same 4-speakers-on-ALC289
+audio setup as the Dell XPS 15 9510, so requires the same quirk to
+enable woofer output. Tested on my own 9520.
+
+[ Move the entry to the right position in the SSID order -- tiwai ]
+
+BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=216035
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Rik van der Kemp <rik@upto11.nl>
+Link: https://lore.kernel.org/r/181056a137b.d14baf90133058.8425453735588429828@upto11.nl
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/patch_realtek.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -8921,6 +8921,7 @@ static const struct snd_pci_quirk alc269
+       SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
+       SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
+       SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
++      SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
+       SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
+       SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
+       SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
diff --git a/queue-5.17/alsa-hda-realtek-fix-microphone-noise-on-asus-tuf-b550m-plus.patch b/queue-5.17/alsa-hda-realtek-fix-microphone-noise-on-asus-tuf-b550m-plus.patch
new file mode 100644 (file)
index 0000000..edb04ef
--- /dev/null
@@ -0,0 +1,68 @@
+From 9bfa7b36343c7d84370bc61c9ed774635b05e4eb Mon Sep 17 00:00:00 2001
+From: Marios Levogiannis <marios.levogiannis@gmail.com>
+Date: Mon, 30 May 2022 10:41:31 +0300
+Subject: ALSA: hda/realtek - Fix microphone noise on ASUS TUF B550M-PLUS
+
+From: Marios Levogiannis <marios.levogiannis@gmail.com>
+
+commit 9bfa7b36343c7d84370bc61c9ed774635b05e4eb upstream.
+
+Set microphone pins 0x18 (rear) and 0x19 (front) to VREF_50 to fix the
+microphone noise on ASUS TUF B550M-PLUS which uses the ALCS1200A codec.
+The initial value was VREF_80.
+
+The same issue is also present on Windows using both the default Windows
+driver and all tested Realtek drivers before version 6.0.9049.1. Comparing
+Realtek driver 6.0.9049.1 (the first one without the microphone noise) to
+Realtek driver 6.0.9047.1 (the last one with the microphone noise)
+revealed that the fix is the result of setting pins 0x18 and 0x19 to
+VREF_50.
+
+This fix may also work for other boards that have been reported to have
+the same microphone issue and use the ALC1150 and ALCS1200A codecs, since
+these codecs are similar and the fix in the Realtek driver on Windows is
+common for both. However, it is currently enabled only for ASUS TUF
+B550M-PLUS as this is the only board that could be tested.
+
+Signed-off-by: Marios Levogiannis <marios.levogiannis@gmail.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20220530074131.12258-1-marios.levogiannis@gmail.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/patch_realtek.c |   10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -1981,6 +1981,7 @@ enum {
+       ALC1220_FIXUP_CLEVO_PB51ED_PINS,
+       ALC887_FIXUP_ASUS_AUDIO,
+       ALC887_FIXUP_ASUS_HMIC,
++      ALCS1200A_FIXUP_MIC_VREF,
+ };
+ static void alc889_fixup_coef(struct hda_codec *codec,
+@@ -2526,6 +2527,14 @@ static const struct hda_fixup alc882_fix
+               .chained = true,
+               .chain_id = ALC887_FIXUP_ASUS_AUDIO,
+       },
++      [ALCS1200A_FIXUP_MIC_VREF] = {
++              .type = HDA_FIXUP_PINCTLS,
++              .v.pins = (const struct hda_pintbl[]) {
++                      { 0x18, PIN_VREF50 }, /* rear mic */
++                      { 0x19, PIN_VREF50 }, /* front mic */
++                      {}
++              }
++      },
+ };
+ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
+@@ -2563,6 +2572,7 @@ static const struct snd_pci_quirk alc882
+       SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
+       SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
+       SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
++      SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
+       SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
+       SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
+       SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
diff --git a/queue-5.17/alsa-usb-audio-cancel-pending-work-at-closing-a-midi-substream.patch b/queue-5.17/alsa-usb-audio-cancel-pending-work-at-closing-a-midi-substream.patch
new file mode 100644 (file)
index 0000000..57642b0
--- /dev/null
@@ -0,0 +1,36 @@
+From 0125de38122f0f66bf61336158d12a1aabfe6425 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Wed, 25 May 2022 15:12:03 +0200
+Subject: ALSA: usb-audio: Cancel pending work at closing a MIDI substream
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 0125de38122f0f66bf61336158d12a1aabfe6425 upstream.
+
+At closing a USB MIDI output substream, there might be still a pending
+work, which would eventually access the rawmidi runtime object that is
+being released.  For fixing the race, make sure to cancel the pending
+work at closing.
+
+Reported-by: syzbot+6912c9592caca7ca0e7d@syzkaller.appspotmail.com
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/000000000000e7e75005dfd07cf6@google.com
+Link: https://lore.kernel.org/r/20220525131203.11299-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/usb/midi.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/sound/usb/midi.c
++++ b/sound/usb/midi.c
+@@ -1145,6 +1145,9 @@ static int snd_usbmidi_output_open(struc
+ static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream)
+ {
++      struct usbmidi_out_port *port = substream->runtime->private_data;
++
++      cancel_work_sync(&port->ep->work);
+       return substream_open(substream, 0, 0);
+ }
diff --git a/queue-5.17/fs-ntfs3-check-new-size-for-limits.patch b/queue-5.17/fs-ntfs3-check-new-size-for-limits.patch
new file mode 100644 (file)
index 0000000..d3af4f5
--- /dev/null
@@ -0,0 +1,38 @@
+From 114346978cf61de02832cc3cc68432a3de70fb38 Mon Sep 17 00:00:00 2001
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Date: Mon, 25 Oct 2021 18:34:06 +0300
+Subject: fs/ntfs3: Check new size for limits
+
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+
+commit 114346978cf61de02832cc3cc68432a3de70fb38 upstream.
+
+We must check size before trying to allocate.
+Size can be set for example by "ulimit -f".
+Fixes xfstest generic/228
+Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation")
+
+Reviewed-by: Kari Argillander <kari.argillander@gmail.com>
+Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ntfs3/file.c |    8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- a/fs/ntfs3/file.c
++++ b/fs/ntfs3/file.c
+@@ -662,7 +662,13 @@ static long ntfs_fallocate(struct file *
+               /*
+                * Normal file: Allocate clusters, do not change 'valid' size.
+                */
+-              err = ntfs_set_size(inode, max(end, i_size));
++              loff_t new_size = max(end, i_size);
++
++              err = inode_newsize_ok(inode, new_size);
++              if (err)
++                      goto out;
++
++              err = ntfs_set_size(inode, new_size);
+               if (err)
+                       goto out;
diff --git a/queue-5.17/fs-ntfs3-fix-fiemap-fix-shrink-file-size-to-remove-preallocated-space.patch b/queue-5.17/fs-ntfs3-fix-fiemap-fix-shrink-file-size-to-remove-preallocated-space.patch
new file mode 100644 (file)
index 0000000..7343654
--- /dev/null
@@ -0,0 +1,70 @@
+From 3880f2b816a7e4ca889b7e8a42e6c62c5706ed36 Mon Sep 17 00:00:00 2001
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Date: Mon, 25 Oct 2021 18:31:28 +0300
+Subject: fs/ntfs3: Fix fiemap + fix shrink file size (to remove preallocated space)
+
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+
+commit 3880f2b816a7e4ca889b7e8a42e6c62c5706ed36 upstream.
+
+Two problems:
+1. ntfs3_setattr can't truncate preallocated space;
+2. if allocated fragment "cross" valid size, then fragment splits into two parts:
+- normal part;
+- unwritten part (here we must return FIEMAP_EXTENT_LAST).
+Before this commit we returned FIEMAP_EXTENT_LAST for whole fragment.
+Fixes xfstest generic/092
+Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation")
+
+Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ntfs3/file.c    |    2 +-
+ fs/ntfs3/frecord.c |   10 +++++++---
+ 2 files changed, 8 insertions(+), 4 deletions(-)
+
+--- a/fs/ntfs3/file.c
++++ b/fs/ntfs3/file.c
+@@ -762,7 +762,7 @@ int ntfs3_setattr(struct user_namespace
+               }
+               inode_dio_wait(inode);
+-              if (attr->ia_size < oldsize)
++              if (attr->ia_size <= oldsize)
+                       err = ntfs_truncate(inode, attr->ia_size);
+               else if (attr->ia_size > oldsize)
+                       err = ntfs_extend(inode, attr->ia_size, 0, NULL);
+--- a/fs/ntfs3/frecord.c
++++ b/fs/ntfs3/frecord.c
+@@ -1964,10 +1964,8 @@ int ni_fiemap(struct ntfs_inode *ni, str
+               vcn += clen;
+-              if (vbo + bytes >= end) {
++              if (vbo + bytes >= end)
+                       bytes = end - vbo;
+-                      flags |= FIEMAP_EXTENT_LAST;
+-              }
+               if (vbo + bytes <= valid) {
+                       ;
+@@ -1977,6 +1975,9 @@ int ni_fiemap(struct ntfs_inode *ni, str
+                       /* vbo < valid && valid < vbo + bytes */
+                       u64 dlen = valid - vbo;
++                      if (vbo + dlen >= end)
++                              flags |= FIEMAP_EXTENT_LAST;
++
+                       err = fiemap_fill_next_extent(fieinfo, vbo, lbo, dlen,
+                                                     flags);
+                       if (err < 0)
+@@ -1995,6 +1996,9 @@ int ni_fiemap(struct ntfs_inode *ni, str
+                       flags |= FIEMAP_EXTENT_UNWRITTEN;
+               }
++              if (vbo + bytes >= end)
++                      flags |= FIEMAP_EXTENT_LAST;
++
+               err = fiemap_fill_next_extent(fieinfo, vbo, lbo, bytes, flags);
+               if (err < 0)
+                       break;
diff --git a/queue-5.17/fs-ntfs3-fix-some-memory-leaks-in-an-error-handling-path-of-log_replay.patch b/queue-5.17/fs-ntfs3-fix-some-memory-leaks-in-an-error-handling-path-of-log_replay.patch
new file mode 100644 (file)
index 0000000..afb038e
--- /dev/null
@@ -0,0 +1,37 @@
+From e589f9b7078e1c0191613cd736f598e81d2390de Mon Sep 17 00:00:00 2001
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Date: Thu, 11 Nov 2021 08:45:44 +0100
+Subject: fs/ntfs3: Fix some memory leaks in an error handling path of 'log_replay()'
+
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+
+commit e589f9b7078e1c0191613cd736f598e81d2390de upstream.
+
+All error handling paths lead to 'out' where many resources are freed.
+
+Do it as well here instead of a direct return, otherwise 'log', 'ra' and
+'log->one_page_buf' (at least) will leak.
+
+Fixes: b46acd6a6a62 ("fs/ntfs3: Add NTFS journal")
+Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ntfs3/fslog.c |    6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/fs/ntfs3/fslog.c
++++ b/fs/ntfs3/fslog.c
+@@ -4085,8 +4085,10 @@ process_log:
+               if (client == LFS_NO_CLIENT_LE) {
+                       /* Insert "NTFS" client LogFile. */
+                       client = ra->client_idx[0];
+-                      if (client == LFS_NO_CLIENT_LE)
+-                              return -EINVAL;
++                      if (client == LFS_NO_CLIENT_LE) {
++                              err = -EINVAL;
++                              goto out;
++                      }
+                       t16 = le16_to_cpu(client);
+                       cr = ca + t16;
diff --git a/queue-5.17/fs-ntfs3-in-function-ntfs_set_acl_ex-do-not-change-inode-i_mode-if-called-from-function-ntfs_init_acl.patch b/queue-5.17/fs-ntfs3-in-function-ntfs_set_acl_ex-do-not-change-inode-i_mode-if-called-from-function-ntfs_init_acl.patch
new file mode 100644 (file)
index 0000000..92089f6
--- /dev/null
@@ -0,0 +1,71 @@
+From 9186d472ee780fabf74424756c4c00545166157e Mon Sep 17 00:00:00 2001
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Date: Wed, 24 Nov 2021 15:08:19 +0300
+Subject: fs/ntfs3: In function ntfs_set_acl_ex do not change inode->i_mode if called from function ntfs_init_acl
+
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+
+commit 9186d472ee780fabf74424756c4c00545166157e upstream.
+
+ntfs_init_acl sets mode. ntfs_init_acl calls ntfs_set_acl_ex.
+ntfs_set_acl_ex must not change this mode.
+Fixes xfstest generic/444
+Fixes: be71b5cba2e6 ("fs/ntfs3: Add attrib operations")
+
+Reviewed-by: Joe Perches <joe@perches.com>
+Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ntfs3/xattr.c |   13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+--- a/fs/ntfs3/xattr.c
++++ b/fs/ntfs3/xattr.c
+@@ -541,7 +541,7 @@ struct posix_acl *ntfs_get_acl(struct in
+ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
+                                   struct inode *inode, struct posix_acl *acl,
+-                                  int type)
++                                  int type, bool init_acl)
+ {
+       const char *name;
+       size_t size, name_len;
+@@ -554,8 +554,9 @@ static noinline int ntfs_set_acl_ex(stru
+       switch (type) {
+       case ACL_TYPE_ACCESS:
+-              if (acl) {
+-                      umode_t mode = inode->i_mode;
++              /* Do not change i_mode if we are in init_acl */
++              if (acl && !init_acl) {
++                      umode_t mode;
+                       err = posix_acl_update_mode(mnt_userns, inode, &mode,
+                                                   &acl);
+@@ -616,7 +617,7 @@ out:
+ int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+                struct posix_acl *acl, int type)
+ {
+-      return ntfs_set_acl_ex(mnt_userns, inode, acl, type);
++      return ntfs_set_acl_ex(mnt_userns, inode, acl, type, false);
+ }
+ /*
+@@ -636,7 +637,7 @@ int ntfs_init_acl(struct user_namespace
+       if (default_acl) {
+               err = ntfs_set_acl_ex(mnt_userns, inode, default_acl,
+-                                    ACL_TYPE_DEFAULT);
++                                    ACL_TYPE_DEFAULT, true);
+               posix_acl_release(default_acl);
+       } else {
+               inode->i_default_acl = NULL;
+@@ -647,7 +648,7 @@ int ntfs_init_acl(struct user_namespace
+       else {
+               if (!err)
+                       err = ntfs_set_acl_ex(mnt_userns, inode, acl,
+-                                            ACL_TYPE_ACCESS);
++                                            ACL_TYPE_ACCESS, true);
+               posix_acl_release(acl);
+       }
diff --git a/queue-5.17/fs-ntfs3-keep-preallocated-only-if-option-prealloc-enabled.patch b/queue-5.17/fs-ntfs3-keep-preallocated-only-if-option-prealloc-enabled.patch
new file mode 100644 (file)
index 0000000..9be0ce6
--- /dev/null
@@ -0,0 +1,34 @@
+From e95113ed4d428219e3395044e29f5713fc446720 Mon Sep 17 00:00:00 2001
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Date: Fri, 22 Oct 2021 17:37:52 +0300
+Subject: fs/ntfs3: Keep preallocated only if option prealloc enabled
+
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+
+commit e95113ed4d428219e3395044e29f5713fc446720 upstream.
+
+If size of file was reduced, we still kept allocated blocks.
+This commit makes ntfs3 work as other fs like btrfs.
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=214719
+Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation")
+
+Reported-by: Ganapathi Kamath <hgkamath@hotmail.com>
+Tested-by: Ganapathi Kamath <hgkamath@hotmail.com>
+Reviewed-by: Kari Argillander <kari.argillander@gmail.com>
+Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ntfs3/file.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/ntfs3/file.c
++++ b/fs/ntfs3/file.c
+@@ -495,7 +495,7 @@ static int ntfs_truncate(struct inode *i
+       down_write(&ni->file.run_lock);
+       err = attr_set_size(ni, ATTR_DATA, NULL, 0, &ni->file.run, new_size,
+-                          &new_valid, true, NULL);
++                          &new_valid, ni->mi.sbi->options->prealloc, NULL);
+       up_write(&ni->file.run_lock);
+       if (new_valid < ni->i_valid)
diff --git a/queue-5.17/fs-ntfs3-restore-ntfs_xattr_get_acl-and-ntfs_xattr_set_acl-functions.patch b/queue-5.17/fs-ntfs3-restore-ntfs_xattr_get_acl-and-ntfs_xattr_set_acl-functions.patch
new file mode 100644 (file)
index 0000000..7e45c79
--- /dev/null
@@ -0,0 +1,147 @@
+From 87e21c99bad763524c953ff4d1a61ee19038ddc2 Mon Sep 17 00:00:00 2001
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Date: Fri, 22 Oct 2021 18:15:36 +0300
+Subject: fs/ntfs3: Restore ntfs_xattr_get_acl and ntfs_xattr_set_acl functions
+
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+
+commit 87e21c99bad763524c953ff4d1a61ee19038ddc2 upstream.
+
+Apparently we need to maintain these functions with
+ntfs_get_acl_ex and ntfs_set_acl_ex.
+This commit fixes xfstest generic/099
+Fixes: 95dd8b2c1ed0 ("fs/ntfs3: Remove unnecessary functions")
+
+Reviewed-by: Kari Argillander <kari.argillander@gmail.com>
+Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ntfs3/xattr.c |   96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 95 insertions(+), 1 deletion(-)
+
+--- a/fs/ntfs3/xattr.c
++++ b/fs/ntfs3/xattr.c
+@@ -112,7 +112,7 @@ static int ntfs_read_ea(struct ntfs_inod
+               return -ENOMEM;
+       if (!size) {
+-              ;
++              /* EA info persists, but xattr is empty. Looks like EA problem. */
+       } else if (attr_ea->non_res) {
+               struct runs_tree run;
+@@ -620,6 +620,67 @@ int ntfs_set_acl(struct user_namespace *
+       return ntfs_set_acl_ex(mnt_userns, inode, acl, type, false);
+ }
++static int ntfs_xattr_get_acl(struct user_namespace *mnt_userns,
++                            struct inode *inode, int type, void *buffer,
++                            size_t size)
++{
++      struct posix_acl *acl;
++      int err;
++
++      if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
++              ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
++              return -EOPNOTSUPP;
++      }
++
++      acl = ntfs_get_acl(inode, type, false);
++      if (IS_ERR(acl))
++              return PTR_ERR(acl);
++
++      if (!acl)
++              return -ENODATA;
++
++      err = posix_acl_to_xattr(mnt_userns, acl, buffer, size);
++      posix_acl_release(acl);
++
++      return err;
++}
++
++static int ntfs_xattr_set_acl(struct user_namespace *mnt_userns,
++                            struct inode *inode, int type, const void *value,
++                            size_t size)
++{
++      struct posix_acl *acl;
++      int err;
++
++      if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
++              ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
++              return -EOPNOTSUPP;
++      }
++
++      if (!inode_owner_or_capable(mnt_userns, inode))
++              return -EPERM;
++
++      if (!value) {
++              acl = NULL;
++      } else {
++              acl = posix_acl_from_xattr(mnt_userns, value, size);
++              if (IS_ERR(acl))
++                      return PTR_ERR(acl);
++
++              if (acl) {
++                      err = posix_acl_valid(mnt_userns, acl);
++                      if (err)
++                              goto release_and_out;
++              }
++      }
++
++      err = ntfs_set_acl(mnt_userns, inode, acl, type);
++
++release_and_out:
++      posix_acl_release(acl);
++      return err;
++}
++
+ /*
+  * ntfs_init_acl - Initialize the ACLs of a new inode.
+  *
+@@ -786,6 +847,23 @@ static int ntfs_getxattr(const struct xa
+               goto out;
+       }
++#ifdef CONFIG_NTFS3_FS_POSIX_ACL
++      if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
++           !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
++                   sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
++          (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
++           !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
++                   sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
++              /* TODO: init_user_ns? */
++              err = ntfs_xattr_get_acl(
++                      &init_user_ns, inode,
++                      name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
++                              ? ACL_TYPE_ACCESS
++                              : ACL_TYPE_DEFAULT,
++                      buffer, size);
++              goto out;
++      }
++#endif
+       /* Deal with NTFS extended attribute. */
+       err = ntfs_get_ea(inode, name, name_len, buffer, size, NULL);
+@@ -898,6 +976,22 @@ set_new_fa:
+               goto out;
+       }
++#ifdef CONFIG_NTFS3_FS_POSIX_ACL
++      if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
++           !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
++                   sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
++          (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
++           !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
++                   sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
++              err = ntfs_xattr_set_acl(
++                      mnt_userns, inode,
++                      name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
++                              ? ACL_TYPE_ACCESS
++                              : ACL_TYPE_DEFAULT,
++                      value, size);
++              goto out;
++      }
++#endif
+       /* Deal with NTFS extended attribute. */
+       err = ntfs_set_ea(inode, name, name_len, value, size, flags);
diff --git a/queue-5.17/fs-ntfs3-update-i_ctime-when-xattr-is-added.patch b/queue-5.17/fs-ntfs3-update-i_ctime-when-xattr-is-added.patch
new file mode 100644 (file)
index 0000000..4e67b4a
--- /dev/null
@@ -0,0 +1,31 @@
+From 2d44667c306e7806848a3478820f87343feb5421 Mon Sep 17 00:00:00 2001
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Date: Fri, 22 Oct 2021 18:35:43 +0300
+Subject: fs/ntfs3: Update i_ctime when xattr is added
+
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+
+commit 2d44667c306e7806848a3478820f87343feb5421 upstream.
+
+Ctime wasn't updated after setfacl command.
+This commit fixes xfstest generic/307
+Fixes: be71b5cba2e6 ("fs/ntfs3: Add attrib operations")
+
+Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ntfs3/xattr.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/fs/ntfs3/xattr.c
++++ b/fs/ntfs3/xattr.c
+@@ -902,6 +902,9 @@ set_new_fa:
+       err = ntfs_set_ea(inode, name, name_len, value, size, flags);
+ out:
++      inode->i_ctime = current_time(inode);
++      mark_inode_dirty(inode);
++
+       return err;
+ }
diff --git a/queue-5.17/fs-ntfs3-update-valid-size-if-eiocbqueued.patch b/queue-5.17/fs-ntfs3-update-valid-size-if-eiocbqueued.patch
new file mode 100644 (file)
index 0000000..2e4d0a6
--- /dev/null
@@ -0,0 +1,50 @@
+From 52e00ea6b26e45fb8159e3b57cdde8d3f9bdd8e9 Mon Sep 17 00:00:00 2001
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Date: Mon, 25 Oct 2021 18:48:38 +0300
+Subject: fs/ntfs3: Update valid size if -EIOCBQUEUED
+
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+
+commit 52e00ea6b26e45fb8159e3b57cdde8d3f9bdd8e9 upstream.
+
+Update valid size if write is still in I/O queue.
+Fixes xfstest generic/240
+Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
+
+Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ntfs3/inode.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
+index 859951d785cb..879952254071 100644
+--- a/fs/ntfs3/inode.c
++++ b/fs/ntfs3/inode.c
+@@ -757,6 +757,7 @@ static ssize_t ntfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
+       loff_t vbo = iocb->ki_pos;
+       loff_t end;
+       int wr = iov_iter_rw(iter) & WRITE;
++      size_t iter_count = iov_iter_count(iter);
+       loff_t valid;
+       ssize_t ret;
+@@ -770,10 +771,13 @@ static ssize_t ntfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
+                                wr ? ntfs_get_block_direct_IO_W
+                                   : ntfs_get_block_direct_IO_R);
+-      if (ret <= 0)
++      if (ret > 0)
++              end = vbo + ret;
++      else if (wr && ret == -EIOCBQUEUED)
++              end = vbo + iter_count;
++      else
+               goto out;
+-      end = vbo + ret;
+       valid = ni->i_valid;
+       if (wr) {
+               if (end > valid && !S_ISBLK(inode->i_mode)) {
+-- 
+2.36.1
+
diff --git a/queue-5.17/parisc-stifb-keep-track-of-hardware-path-of-graphics-card.patch b/queue-5.17/parisc-stifb-keep-track-of-hardware-path-of-graphics-card.patch
new file mode 100644 (file)
index 0000000..eb842c5
--- /dev/null
@@ -0,0 +1,113 @@
+From b046f984814af7985f444150ec28716d42d00d9a Mon Sep 17 00:00:00 2001
+From: Helge Deller <deller@gmx.de>
+Date: Thu, 2 Jun 2022 13:55:26 +0200
+Subject: parisc/stifb: Keep track of hardware path of graphics card
+
+From: Helge Deller <deller@gmx.de>
+
+commit b046f984814af7985f444150ec28716d42d00d9a upstream.
+
+Keep the pa_path (hardware path) of the graphics card in sti_struct and use
+this info to give more useful info which card is currently being used.
+
+Signed-off-by: Helge Deller <deller@gmx.de>
+Cc: stable@vger.kernel.org   # v5.10+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/video/console/sticon.c  |    5 ++++-
+ drivers/video/console/sticore.c |   15 +++++++--------
+ drivers/video/fbdev/sticore.h   |    3 +++
+ 3 files changed, 14 insertions(+), 9 deletions(-)
+
+--- a/drivers/video/console/sticon.c
++++ b/drivers/video/console/sticon.c
+@@ -46,6 +46,7 @@
+ #include <linux/slab.h>
+ #include <linux/font.h>
+ #include <linux/crc32.h>
++#include <linux/fb.h>
+ #include <asm/io.h>
+@@ -392,7 +393,9 @@ static int __init sticonsole_init(void)
+     for (i = 0; i < MAX_NR_CONSOLES; i++)
+       font_data[i] = STI_DEF_FONT;
+-    pr_info("sticon: Initializing STI text console.\n");
++    pr_info("sticon: Initializing STI text console on %s at [%s]\n",
++      sticon_sti->sti_data->inq_outptr.dev_name,
++      sticon_sti->pa_path);
+     console_lock();
+     err = do_take_over_console(&sti_con, 0, MAX_NR_CONSOLES - 1,
+               PAGE0->mem_cons.cl_class != CL_DUPLEX);
+--- a/drivers/video/console/sticore.c
++++ b/drivers/video/console/sticore.c
+@@ -34,7 +34,7 @@
+ #include "../fbdev/sticore.h"
+-#define STI_DRIVERVERSION "Version 0.9b"
++#define STI_DRIVERVERSION "Version 0.9c"
+ static struct sti_struct *default_sti __read_mostly;
+@@ -503,7 +503,7 @@ sti_select_fbfont(struct sti_cooked_rom
+       if (!fbfont)
+               return NULL;
+-      pr_info("STI selected %ux%u framebuffer font %s for sticon\n",
++      pr_info("    using %ux%u framebuffer font %s\n",
+                       fbfont->width, fbfont->height, fbfont->name);
+                       
+       bpc = ((fbfont->width+7)/8) * fbfont->height; 
+@@ -947,6 +947,7 @@ out_err:
+ static void sticore_check_for_default_sti(struct sti_struct *sti, char *path)
+ {
++      pr_info("    located at [%s]\n", sti->pa_path);
+       if (strcmp (path, default_sti_path) == 0)
+               default_sti = sti;
+ }
+@@ -958,7 +959,6 @@ static void sticore_check_for_default_st
+  */
+ static int __init sticore_pa_init(struct parisc_device *dev)
+ {
+-      char pa_path[21];
+       struct sti_struct *sti = NULL;
+       int hpa = dev->hpa.start;
+@@ -971,8 +971,8 @@ static int __init sticore_pa_init(struct
+       if (!sti)
+               return 1;
+-      print_pa_hwpath(dev, pa_path);
+-      sticore_check_for_default_sti(sti, pa_path);
++      print_pa_hwpath(dev, sti->pa_path);
++      sticore_check_for_default_sti(sti, sti->pa_path);
+       return 0;
+ }
+@@ -1008,9 +1008,8 @@ static int sticore_pci_init(struct pci_d
+       sti = sti_try_rom_generic(rom_base, fb_base, pd);
+       if (sti) {
+-              char pa_path[30];
+-              print_pci_hwpath(pd, pa_path);
+-              sticore_check_for_default_sti(sti, pa_path);
++              print_pci_hwpath(pd, sti->pa_path);
++              sticore_check_for_default_sti(sti, sti->pa_path);
+       }
+       
+       if (!sti) {
+--- a/drivers/video/fbdev/sticore.h
++++ b/drivers/video/fbdev/sticore.h
+@@ -370,6 +370,9 @@ struct sti_struct {
+       /* pointer to all internal data */
+       struct sti_all_data *sti_data;
++
++      /* pa_path of this device */
++      char pa_path[24];
+ };
diff --git a/queue-5.17/risc-v-mark-ioresource_exclusive-for-reserved-mem-instead-of-ioresource_busy.patch b/queue-5.17/risc-v-mark-ioresource_exclusive-for-reserved-mem-instead-of-ioresource_busy.patch
new file mode 100644 (file)
index 0000000..04660aa
--- /dev/null
@@ -0,0 +1,68 @@
+From e61bf5c071148c80d091f8e7220b3b9130780ae3 Mon Sep 17 00:00:00 2001
+From: Xianting Tian <xianting.tian@linux.alibaba.com>
+Date: Wed, 18 May 2022 09:34:28 +0800
+Subject: RISC-V: Mark IORESOURCE_EXCLUSIVE for reserved mem instead of IORESOURCE_BUSY
+
+From: Xianting Tian <xianting.tian@linux.alibaba.com>
+
+commit e61bf5c071148c80d091f8e7220b3b9130780ae3 upstream.
+
+Commit 00ab027a3b82 ("RISC-V: Add kernel image sections to the resource tree")
+marked IORESOURCE_BUSY for reserved memory, which caused resource map
+failed in subsequent operations of related driver, so remove the
+IORESOURCE_BUSY flag. In order to prohibit userland mapping reserved
+memory, mark IORESOURCE_EXCLUSIVE for it.
+
+The code to reproduce the issue,
+dts:
+        mem0: memory@a0000000 {
+                reg = <0x0 0xa0000000 0 0x1000000>;
+                no-map;
+        };
+
+        &test {
+                status = "okay";
+                memory-region = <&mem0>;
+        };
+
+code:
+        np = of_parse_phandle(pdev->dev.of_node, "memory-region", 0);
+        ret = of_address_to_resource(np, 0, &r);
+        base = devm_ioremap_resource(&pdev->dev, &r);
+        // base = -EBUSY
+
+Fixes: 00ab027a3b82 ("RISC-V: Add kernel image sections to the resource tree")
+Reported-by: Huaming Jiang <jianghuaming.jhm@alibaba-inc.com>
+Reviewed-by: Guo Ren <guoren@kernel.org>
+Reviewed-by: Heiko Stuebner <heiko@sntech.de>
+Tested-by: Heiko Stuebner <heiko@sntech.de>
+Co-developed-by: Nick Kossifidis <mick@ics.forth.gr>
+Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
+Link: https://lore.kernel.org/r/20220518013428.1338983-1-xianting.tian@linux.alibaba.com
+Cc: stable@vger.kernel.org
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/riscv/kernel/setup.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/riscv/kernel/setup.c
++++ b/arch/riscv/kernel/setup.c
+@@ -189,7 +189,7 @@ static void __init init_resources(void)
+               res = &mem_res[res_idx--];
+               res->name = "Reserved";
+-              res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
++              res->flags = IORESOURCE_MEM | IORESOURCE_EXCLUSIVE;
+               res->start = __pfn_to_phys(memblock_region_reserved_base_pfn(region));
+               res->end = __pfn_to_phys(memblock_region_reserved_end_pfn(region)) - 1;
+@@ -214,7 +214,7 @@ static void __init init_resources(void)
+               if (unlikely(memblock_is_nomap(region))) {
+                       res->name = "Reserved";
+-                      res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
++                      res->flags = IORESOURCE_MEM | IORESOURCE_EXCLUSIVE;
+               } else {
+                       res->name = "System RAM";
+                       res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
diff --git a/queue-5.17/riscv-fix-irq_work-when-smp-is-disabled.patch b/queue-5.17/riscv-fix-irq_work-when-smp-is-disabled.patch
new file mode 100644 (file)
index 0000000..bbcce78
--- /dev/null
@@ -0,0 +1,36 @@
+From 2273272823db6f67d57761df8116ae32e7f05bed Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Fri, 29 Apr 2022 22:00:23 -0500
+Subject: riscv: Fix irq_work when SMP is disabled
+
+From: Samuel Holland <samuel@sholland.org>
+
+commit 2273272823db6f67d57761df8116ae32e7f05bed upstream.
+
+irq_work is triggered via an IPI, but the IPI infrastructure is not
+included in uniprocessor kernels. As a result, irq_work never runs.
+Fall back to the tick-based irq_work implementation on uniprocessor
+configurations.
+
+Fixes: 298447928bb1 ("riscv: Support irq_work via self IPIs")
+Signed-off-by: Samuel Holland <samuel@sholland.org>
+Reviewed-by: Heiko Stuebner <heiko@sntech.de>
+Link: https://lore.kernel.org/r/20220430030025.58405-1-samuel@sholland.org
+Cc: stable@vger.kernel.org
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/riscv/include/asm/irq_work.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/riscv/include/asm/irq_work.h
++++ b/arch/riscv/include/asm/irq_work.h
+@@ -4,7 +4,7 @@
+ static inline bool arch_irq_work_has_interrupt(void)
+ {
+-      return true;
++      return IS_ENABLED(CONFIG_SMP);
+ }
+ extern void arch_irq_work_raise(void);
+ #endif /* _ASM_RISCV_IRQ_WORK_H */
diff --git a/queue-5.17/riscv-initialize-thread-pointer-before-calling-c-functions.patch b/queue-5.17/riscv-initialize-thread-pointer-before-calling-c-functions.patch
new file mode 100644 (file)
index 0000000..3d96906
--- /dev/null
@@ -0,0 +1,35 @@
+From 35d33c76d68dfacc330a8eb477b51cc647c5a847 Mon Sep 17 00:00:00 2001
+From: Alexandre Ghiti <alexandre.ghiti@canonical.com>
+Date: Mon, 6 Dec 2021 11:46:56 +0100
+Subject: riscv: Initialize thread pointer before calling C functions
+
+From: Alexandre Ghiti <alexandre.ghiti@canonical.com>
+
+commit 35d33c76d68dfacc330a8eb477b51cc647c5a847 upstream.
+
+Because of the stack canary feature that reads from the current task
+structure the stack canary value, the thread pointer register "tp" must
+be set before calling any C function from head.S: by chance, setup_vm
+and all the functions that it calls does not seem to be part of the
+functions where the canary check is done, but in the following commits,
+some functions will.
+
+Fixes: f2c9699f65557a31 ("riscv: Add STACKPROTECTOR supported")
+Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/riscv/kernel/head.S |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/riscv/kernel/head.S
++++ b/arch/riscv/kernel/head.S
+@@ -316,6 +316,7 @@ clear_bss_done:
+       REG_S a0, (a2)
+       /* Initialize page tables and relocate to virtual addresses */
++      la tp, init_task
+       la sp, init_thread_union + THREAD_SIZE
+       XIP_FIXUP_OFFSET sp
+ #ifdef CONFIG_BUILTIN_DTB
diff --git a/queue-5.17/riscv-move-alternative-length-validation-into-subsection.patch b/queue-5.17/riscv-move-alternative-length-validation-into-subsection.patch
new file mode 100644 (file)
index 0000000..1660f9f
--- /dev/null
@@ -0,0 +1,92 @@
+From 61114e734ccb804bc12561ab4020745e02c468c2 Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Mon, 16 May 2022 14:45:21 -0700
+Subject: riscv: Move alternative length validation into subsection
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit 61114e734ccb804bc12561ab4020745e02c468c2 upstream.
+
+After commit 49b290e430d3 ("riscv: prevent compressed instructions in
+alternatives"), builds with LLVM's integrated assembler fail:
+
+  In file included from arch/riscv/mm/init.c:10:
+  In file included from ./include/linux/mm.h:29:
+  In file included from ./include/linux/pgtable.h:6:
+  In file included from ./arch/riscv/include/asm/pgtable.h:108:
+  ./arch/riscv/include/asm/tlbflush.h:23:2: error: expected assembly-time absolute expression
+          ALT_FLUSH_TLB_PAGE(__asm__ __volatile__ ("sfence.vma %0" : : "r" (addr) : "memory"));
+          ^
+  ./arch/riscv/include/asm/errata_list.h:33:5: note: expanded from macro 'ALT_FLUSH_TLB_PAGE'
+  asm(ALTERNATIVE("sfence.vma %0", "sfence.vma", SIFIVE_VENDOR_ID,        \
+      ^
+  ./arch/riscv/include/asm/alternative-macros.h:187:2: note: expanded from macro 'ALTERNATIVE'
+          _ALTERNATIVE_CFG(old_content, new_content, vendor_id, errata_id, CONFIG_k)
+          ^
+  ./arch/riscv/include/asm/alternative-macros.h:113:2: note: expanded from macro '_ALTERNATIVE_CFG'
+          __ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, IS_ENABLED(CONFIG_k))
+          ^
+  ./arch/riscv/include/asm/alternative-macros.h:110:2: note: expanded from macro '__ALTERNATIVE_CFG'
+          ALT_NEW_CONTENT(vendor_id, errata_id, enable, new_c)
+          ^
+  ./arch/riscv/include/asm/alternative-macros.h:99:3: note: expanded from macro 'ALT_NEW_CONTENT'
+          ".org   . - (889b - 888b) + (887b - 886b)\n"                    \
+           ^
+  <inline asm>:26:6: note: instantiated into assembly here
+  .org    . - (889b - 888b) + (887b - 886b)
+          ^
+
+This error happens because LLVM's integrated assembler has a one-pass
+design, which means it cannot figure out the instruction lengths when
+the .org directive is outside of the subsection that contains the
+instructions, which was changed by the .option directives added by the
+above change.
+
+Move the .org directives before the .previous directive so that these
+directives are always within the same subsection, which resolves the
+failures and does not introduce any new issues with GNU as. This was
+done for arm64 in commit 966a0acce2fc ("arm64/alternatives: move length
+validation inside the subsection") and commit 22315a2296f4 ("arm64:
+alternatives: Move length validation in alternative_{insn, endif}").
+
+While there is no error from the assembly versions of the macro, they
+appear to have the same problem so just make the same change there as
+well so that there are no problems in the future.
+
+Link: https://github.com/ClangBuiltLinux/linux/issues/1640
+Reported-by: kernel test robot <lkp@intel.com>
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Reviewed-by: Heiko Stuebner <heiko@sntech.de>
+Tested-by: Heiko Stuebner <heiko@sntech.de>
+Link: https://lore.kernel.org/r/20220516214520.3252074-1-nathan@kernel.org
+Cc: stable@vger.kernel.org
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/riscv/include/asm/alternative-macros.h |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/riscv/include/asm/alternative-macros.h
++++ b/arch/riscv/include/asm/alternative-macros.h
+@@ -23,9 +23,9 @@
+ 888 :
+       \new_c
+ 889 :
+-      .previous
+       .org    . - (889b - 888b) + (887b - 886b)
+       .org    . - (887b - 886b) + (889b - 888b)
++      .previous
+       .endif
+ .endm
+@@ -60,9 +60,9 @@
+       "888 :\n"                                                       \
+       new_c "\n"                                                      \
+       "889 :\n"                                                       \
+-      ".previous\n"                                                   \
+       ".org   . - (887b - 886b) + (889b - 888b)\n"                    \
+       ".org   . - (889b - 888b) + (887b - 886b)\n"                    \
++      ".previous\n"                                                   \
+       ".endif\n"
+ #define __ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, enable) \
diff --git a/queue-5.17/riscv-wire-up-memfd_secret-in-uapi-header.patch b/queue-5.17/riscv-wire-up-memfd_secret-in-uapi-header.patch
new file mode 100644 (file)
index 0000000..ac410ee
--- /dev/null
@@ -0,0 +1,47 @@
+From 02d88b40cb2e9614e0117c3385afdce878f0d377 Mon Sep 17 00:00:00 2001
+From: Tobias Klauser <tklauser@distanz.ch>
+Date: Thu, 5 May 2022 10:18:15 +0200
+Subject: riscv: Wire up memfd_secret in UAPI header
+
+From: Tobias Klauser <tklauser@distanz.ch>
+
+commit 02d88b40cb2e9614e0117c3385afdce878f0d377 upstream.
+
+Move the __ARCH_WANT_MEMFD_SECRET define added in commit 7bb7f2ac24a0
+("arch, mm: wire up memfd_secret system call where relevant") to
+<uapi/asm/unistd.h> so __NR_memfd_secret is defined when including
+<unistd.h> in userspace.
+
+This allows the memfd_secret selftest to pass on riscv.
+
+Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
+Link: https://lore.kernel.org/r/20220505081815.22808-1-tklauser@distanz.ch
+Fixes: 7bb7f2ac24a0 ("arch, mm: wire up memfd_secret system call where relevant")
+Cc: stable@vger.kernel.org
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/riscv/include/asm/unistd.h      |    1 -
+ arch/riscv/include/uapi/asm/unistd.h |    1 +
+ 2 files changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/riscv/include/asm/unistd.h
++++ b/arch/riscv/include/asm/unistd.h
+@@ -9,7 +9,6 @@
+  */
+ #define __ARCH_WANT_SYS_CLONE
+-#define __ARCH_WANT_MEMFD_SECRET
+ #include <uapi/asm/unistd.h>
+--- a/arch/riscv/include/uapi/asm/unistd.h
++++ b/arch/riscv/include/uapi/asm/unistd.h
+@@ -21,6 +21,7 @@
+ #endif /* __LP64__ */
+ #define __ARCH_WANT_SYS_CLONE3
++#define __ARCH_WANT_MEMFD_SECRET
+ #include <asm-generic/unistd.h>
index 5f83c64d9b443bc4e2f8d8f9b6ca57f052c0ca32..bba00a762b84a69411e96bf4d45e13c714e9864d 100644 (file)
@@ -1,3 +1,27 @@
 arm64-initialize-jump-labels-before-setup_machine_fdt.patch
 binfmt_flat-do-not-stop-relocating-got-entries-prematurely-on-riscv.patch
 parisc-stifb-implement-fb_is_primary_device.patch
+parisc-stifb-keep-track-of-hardware-path-of-graphics-card.patch
+risc-v-mark-ioresource_exclusive-for-reserved-mem-instead-of-ioresource_busy.patch
+riscv-initialize-thread-pointer-before-calling-c-functions.patch
+riscv-fix-irq_work-when-smp-is-disabled.patch
+riscv-wire-up-memfd_secret-in-uapi-header.patch
+riscv-move-alternative-length-validation-into-subsection.patch
+alsa-hda-realtek-add-new-type-for-alc245.patch
+alsa-hda-realtek-enable-4-speaker-output-for-dell-xps-15-9520-laptop.patch
+alsa-hda-realtek-fix-microphone-noise-on-asus-tuf-b550m-plus.patch
+alsa-usb-audio-cancel-pending-work-at-closing-a-midi-substream.patch
+usb-serial-pl2303-fix-type-detection-for-odd-device.patch
+usb-serial-option-add-quectel-bg95-modem.patch
+usb-new-quirk-for-dell-gen-2-devices.patch
+usb-isp1760-fix-out-of-bounds-array-access.patch
+usb-dwc3-gadget-move-null-pinter-check-to-proper-place.patch
+usb-core-hcd-add-support-for-deferring-roothub-registration.patch
+fs-ntfs3-update-valid-size-if-eiocbqueued.patch
+fs-ntfs3-fix-fiemap-fix-shrink-file-size-to-remove-preallocated-space.patch
+fs-ntfs3-keep-preallocated-only-if-option-prealloc-enabled.patch
+fs-ntfs3-check-new-size-for-limits.patch
+fs-ntfs3-in-function-ntfs_set_acl_ex-do-not-change-inode-i_mode-if-called-from-function-ntfs_init_acl.patch
+fs-ntfs3-fix-some-memory-leaks-in-an-error-handling-path-of-log_replay.patch
+fs-ntfs3-update-i_ctime-when-xattr-is-added.patch
+fs-ntfs3-restore-ntfs_xattr_get_acl-and-ntfs_xattr_set_acl-functions.patch
diff --git a/queue-5.17/usb-core-hcd-add-support-for-deferring-roothub-registration.patch b/queue-5.17/usb-core-hcd-add-support-for-deferring-roothub-registration.patch
new file mode 100644 (file)
index 0000000..44f331a
--- /dev/null
@@ -0,0 +1,122 @@
+From a44623d9279086c89f631201d993aa332f7c9e66 Mon Sep 17 00:00:00 2001
+From: Kishon Vijay Abraham I <kishon@ti.com>
+Date: Tue, 10 May 2022 14:46:29 +0530
+Subject: usb: core: hcd: Add support for deferring roothub registration
+
+From: Kishon Vijay Abraham I <kishon@ti.com>
+
+commit a44623d9279086c89f631201d993aa332f7c9e66 upstream.
+
+It has been observed with certain PCIe USB cards (like Inateck connected
+to AM64 EVM or J7200 EVM) that as soon as the primary roothub is
+registered, port status change is handled even before xHC is running
+leading to cold plug USB devices not detected. For such cases, registering
+both the root hubs along with the second HCD is required. Add support for
+deferring roothub registration in usb_add_hcd(), so that both primary and
+secondary roothubs are registered along with the second HCD.
+
+This patch has been added and reverted earier as it triggered a race
+in usb device enumeration.
+That race is now fixed in 5.16-rc3, and in stable back to 5.4
+commit 6cca13de26ee ("usb: hub: Fix locking issues with address0_mutex")
+commit 6ae6dc22d2d1 ("usb: hub: Fix usb enumeration issue due to address0
+race")
+
+CC: stable@vger.kernel.org # 5.4+
+Suggested-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Tested-by: Chris Chiu <chris.chiu@canonical.com>
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
+Link: https://lore.kernel.org/r/20220510091630.16564-2-kishon@ti.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/core/hcd.c  |   29 +++++++++++++++++++++++------
+ include/linux/usb/hcd.h |    2 ++
+ 2 files changed, 25 insertions(+), 6 deletions(-)
+
+--- a/drivers/usb/core/hcd.c
++++ b/drivers/usb/core/hcd.c
+@@ -2816,6 +2816,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
+ {
+       int retval;
+       struct usb_device *rhdev;
++      struct usb_hcd *shared_hcd;
+       if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) {
+               hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev);
+@@ -2976,13 +2977,26 @@ int usb_add_hcd(struct usb_hcd *hcd,
+               goto err_hcd_driver_start;
+       }
++      /* starting here, usbcore will pay attention to the shared HCD roothub */
++      shared_hcd = hcd->shared_hcd;
++      if (!usb_hcd_is_primary_hcd(hcd) && shared_hcd && HCD_DEFER_RH_REGISTER(shared_hcd)) {
++              retval = register_root_hub(shared_hcd);
++              if (retval != 0)
++                      goto err_register_root_hub;
++
++              if (shared_hcd->uses_new_polling && HCD_POLL_RH(shared_hcd))
++                      usb_hcd_poll_rh_status(shared_hcd);
++      }
++
+       /* starting here, usbcore will pay attention to this root hub */
+-      retval = register_root_hub(hcd);
+-      if (retval != 0)
+-              goto err_register_root_hub;
++      if (!HCD_DEFER_RH_REGISTER(hcd)) {
++              retval = register_root_hub(hcd);
++              if (retval != 0)
++                      goto err_register_root_hub;
+-      if (hcd->uses_new_polling && HCD_POLL_RH(hcd))
+-              usb_hcd_poll_rh_status(hcd);
++              if (hcd->uses_new_polling && HCD_POLL_RH(hcd))
++                      usb_hcd_poll_rh_status(hcd);
++      }
+       return retval;
+@@ -3020,6 +3034,7 @@ EXPORT_SYMBOL_GPL(usb_add_hcd);
+ void usb_remove_hcd(struct usb_hcd *hcd)
+ {
+       struct usb_device *rhdev = hcd->self.root_hub;
++      bool rh_registered;
+       dev_info(hcd->self.controller, "remove, state %x\n", hcd->state);
+@@ -3030,6 +3045,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
+       dev_dbg(hcd->self.controller, "roothub graceful disconnect\n");
+       spin_lock_irq (&hcd_root_hub_lock);
++      rh_registered = hcd->rh_registered;
+       hcd->rh_registered = 0;
+       spin_unlock_irq (&hcd_root_hub_lock);
+@@ -3039,7 +3055,8 @@ void usb_remove_hcd(struct usb_hcd *hcd)
+       cancel_work_sync(&hcd->died_work);
+       mutex_lock(&usb_bus_idr_lock);
+-      usb_disconnect(&rhdev);         /* Sets rhdev to NULL */
++      if (rh_registered)
++              usb_disconnect(&rhdev);         /* Sets rhdev to NULL */
+       mutex_unlock(&usb_bus_idr_lock);
+       /*
+--- a/include/linux/usb/hcd.h
++++ b/include/linux/usb/hcd.h
+@@ -124,6 +124,7 @@ struct usb_hcd {
+ #define HCD_FLAG_RH_RUNNING           5       /* root hub is running? */
+ #define HCD_FLAG_DEAD                 6       /* controller has died? */
+ #define HCD_FLAG_INTF_AUTHORIZED      7       /* authorize interfaces? */
++#define HCD_FLAG_DEFER_RH_REGISTER    8       /* Defer roothub registration */
+       /* The flags can be tested using these macros; they are likely to
+        * be slightly faster than test_bit().
+@@ -134,6 +135,7 @@ struct usb_hcd {
+ #define HCD_WAKEUP_PENDING(hcd)       ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
+ #define HCD_RH_RUNNING(hcd)   ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING))
+ #define HCD_DEAD(hcd)         ((hcd)->flags & (1U << HCD_FLAG_DEAD))
++#define HCD_DEFER_RH_REGISTER(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEFER_RH_REGISTER))
+       /*
+        * Specifies if interfaces are authorized by default
diff --git a/queue-5.17/usb-dwc3-gadget-move-null-pinter-check-to-proper-place.patch b/queue-5.17/usb-dwc3-gadget-move-null-pinter-check-to-proper-place.patch
new file mode 100644 (file)
index 0000000..613f82c
--- /dev/null
@@ -0,0 +1,71 @@
+From 3c5880745b4439ac64eccdb040e37fc1cc4c5406 Mon Sep 17 00:00:00 2001
+From: Albert Wang <albertccwang@google.com>
+Date: Wed, 18 May 2022 14:13:15 +0800
+Subject: usb: dwc3: gadget: Move null pinter check to proper place
+
+From: Albert Wang <albertccwang@google.com>
+
+commit 3c5880745b4439ac64eccdb040e37fc1cc4c5406 upstream.
+
+When dwc3_gadget_ep_cleanup_completed_requests() called to
+dwc3_gadget_giveback() where the dwc3 lock is released, other thread is
+able to execute. In this situation, usb_ep_disable() gets the chance to
+clear endpoint descriptor pointer which leds to the null pointer
+dereference problem. So needs to move the null pointer check to a proper
+place.
+
+Example call stack:
+
+Thread#1:
+dwc3_thread_interrupt()
+  spin_lock
+  -> dwc3_process_event_buf()
+   -> dwc3_process_event_entry()
+    -> dwc3_endpoint_interrupt()
+     -> dwc3_gadget_endpoint_trbs_complete()
+      -> dwc3_gadget_ep_cleanup_completed_requests()
+       ...
+       -> dwc3_giveback()
+          spin_unlock
+          Thread#2 executes
+
+Thread#2:
+configfs_composite_disconnect()
+  -> __composite_disconnect()
+   -> ffs_func_disable()
+    -> ffs_func_set_alt()
+     -> ffs_func_eps_disable()
+      -> usb_ep_disable()
+         wait for dwc3 spin_lock
+         Thread#1 released lock
+         clear endpoint.desc
+
+Fixes: 26288448120b ("usb: dwc3: gadget: Fix null pointer exception")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Albert Wang <albertccwang@google.com>
+Link: https://lore.kernel.org/r/20220518061315.3359198-1-albertccwang@google.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/dwc3/gadget.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/dwc3/gadget.c
++++ b/drivers/usb/dwc3/gadget.c
+@@ -3335,14 +3335,14 @@ static bool dwc3_gadget_endpoint_trbs_co
+       struct dwc3             *dwc = dep->dwc;
+       bool                    no_started_trb = true;
+-      if (!dep->endpoint.desc)
+-              return no_started_trb;
+-
+       dwc3_gadget_ep_cleanup_completed_requests(dep, event, status);
+       if (dep->flags & DWC3_EP_END_TRANSFER_PENDING)
+               goto out;
++      if (!dep->endpoint.desc)
++              return no_started_trb;
++
+       if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
+               list_empty(&dep->started_list) &&
+               (list_empty(&dep->pending_list) || status == -EXDEV))
diff --git a/queue-5.17/usb-isp1760-fix-out-of-bounds-array-access.patch b/queue-5.17/usb-isp1760-fix-out-of-bounds-array-access.patch
new file mode 100644 (file)
index 0000000..d0a6a69
--- /dev/null
@@ -0,0 +1,85 @@
+From 26ae2c942b5702f2e43d36b2a4389cfb7d616b6a Mon Sep 17 00:00:00 2001
+From: Linus Walleij <linus.walleij@linaro.org>
+Date: Mon, 16 May 2022 11:14:24 +0200
+Subject: usb: isp1760: Fix out-of-bounds array access
+
+From: Linus Walleij <linus.walleij@linaro.org>
+
+commit 26ae2c942b5702f2e43d36b2a4389cfb7d616b6a upstream.
+
+Running the driver through kasan gives an interesting splat:
+
+  BUG: KASAN: global-out-of-bounds in isp1760_register+0x180/0x70c
+  Read of size 20 at addr f1db2e64 by task swapper/0/1
+  (...)
+  isp1760_register from isp1760_plat_probe+0x1d8/0x220
+  (...)
+
+This happens because the loop reading the regmap fields for the
+different ISP1760 variants look like this:
+
+  for (i = 0; i < HC_FIELD_MAX; i++) { ... }
+
+Meaning it expects the arrays to be at least HC_FIELD_MAX - 1 long.
+
+However the arrays isp1760_hc_reg_fields[], isp1763_hc_reg_fields[],
+isp1763_hc_volatile_ranges[] and isp1763_dc_volatile_ranges[] are
+dynamically sized during compilation.
+
+Fix this by putting an empty assignment to the [HC_FIELD_MAX]
+and [DC_FIELD_MAX] array member at the end of each array.
+This will make the array one member longer than it needs to be,
+but avoids the risk of overwriting whatever is inside
+[HC_FIELD_MAX - 1] and is simple and intuitive to read. Also
+add comments explaining what is going on.
+
+Fixes: 1da9e1c06873 ("usb: isp1760: move to regmap for register access")
+Cc: stable@vger.kernel.org
+Cc: Rui Miguel Silva <rui.silva@linaro.org>
+Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
+Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Link: https://lore.kernel.org/r/20220516091424.391209-1-linus.walleij@linaro.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/isp1760/isp1760-core.c |    8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/usb/isp1760/isp1760-core.c
++++ b/drivers/usb/isp1760/isp1760-core.c
+@@ -251,6 +251,8 @@ static const struct reg_field isp1760_hc
+       [HW_DM_PULLDOWN]        = REG_FIELD(ISP176x_HC_OTG_CTRL, 2, 2),
+       [HW_DP_PULLDOWN]        = REG_FIELD(ISP176x_HC_OTG_CTRL, 1, 1),
+       [HW_DP_PULLUP]          = REG_FIELD(ISP176x_HC_OTG_CTRL, 0, 0),
++      /* Make sure the array is sized properly during compilation */
++      [HC_FIELD_MAX]          = {},
+ };
+ static const struct reg_field isp1763_hc_reg_fields[] = {
+@@ -321,6 +323,8 @@ static const struct reg_field isp1763_hc
+       [HW_DM_PULLDOWN_CLEAR]  = REG_FIELD(ISP1763_HC_OTG_CTRL_CLEAR, 2, 2),
+       [HW_DP_PULLDOWN_CLEAR]  = REG_FIELD(ISP1763_HC_OTG_CTRL_CLEAR, 1, 1),
+       [HW_DP_PULLUP_CLEAR]    = REG_FIELD(ISP1763_HC_OTG_CTRL_CLEAR, 0, 0),
++      /* Make sure the array is sized properly during compilation */
++      [HC_FIELD_MAX]          = {},
+ };
+ static const struct regmap_range isp1763_hc_volatile_ranges[] = {
+@@ -405,6 +409,8 @@ static const struct reg_field isp1761_dc
+       [DC_CHIP_ID_HIGH]       = REG_FIELD(ISP176x_DC_CHIPID, 16, 31),
+       [DC_CHIP_ID_LOW]        = REG_FIELD(ISP176x_DC_CHIPID, 0, 15),
+       [DC_SCRATCH]            = REG_FIELD(ISP176x_DC_SCRATCH, 0, 15),
++      /* Make sure the array is sized properly during compilation */
++      [DC_FIELD_MAX]          = {},
+ };
+ static const struct regmap_range isp1763_dc_volatile_ranges[] = {
+@@ -458,6 +464,8 @@ static const struct reg_field isp1763_dc
+       [DC_CHIP_ID_HIGH]       = REG_FIELD(ISP1763_DC_CHIPID_HIGH, 0, 15),
+       [DC_CHIP_ID_LOW]        = REG_FIELD(ISP1763_DC_CHIPID_LOW, 0, 15),
+       [DC_SCRATCH]            = REG_FIELD(ISP1763_DC_SCRATCH, 0, 15),
++      /* Make sure the array is sized properly during compilation */
++      [DC_FIELD_MAX]          = {},
+ };
+ static const struct regmap_config isp1763_dc_regmap_conf = {
diff --git a/queue-5.17/usb-new-quirk-for-dell-gen-2-devices.patch b/queue-5.17/usb-new-quirk-for-dell-gen-2-devices.patch
new file mode 100644 (file)
index 0000000..628492a
--- /dev/null
@@ -0,0 +1,34 @@
+From 97fa5887cf283bb75ffff5f6b2c0e71794c02400 Mon Sep 17 00:00:00 2001
+From: Monish Kumar R <monish.kumar.r@intel.com>
+Date: Fri, 20 May 2022 18:30:44 +0530
+Subject: USB: new quirk for Dell Gen 2 devices
+
+From: Monish Kumar R <monish.kumar.r@intel.com>
+
+commit 97fa5887cf283bb75ffff5f6b2c0e71794c02400 upstream.
+
+Add USB_QUIRK_NO_LPM and USB_QUIRK_RESET_RESUME quirks for Dell usb gen
+2 device to not fail during enumeration.
+
+Found this bug on own testing
+
+Signed-off-by: Monish Kumar R <monish.kumar.r@intel.com>
+Cc: stable <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20220520130044.17303-1-monish.kumar.r@intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/core/quirks.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/usb/core/quirks.c
++++ b/drivers/usb/core/quirks.c
+@@ -510,6 +510,9 @@ static const struct usb_device_id usb_qu
+       /* DJI CineSSD */
+       { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
++      /* DELL USB GEN2 */
++      { USB_DEVICE(0x413c, 0xb062), .driver_info = USB_QUIRK_NO_LPM | USB_QUIRK_RESET_RESUME },
++
+       /* VCOM device */
+       { USB_DEVICE(0x4296, 0x7570), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
diff --git a/queue-5.17/usb-serial-option-add-quectel-bg95-modem.patch b/queue-5.17/usb-serial-option-add-quectel-bg95-modem.patch
new file mode 100644 (file)
index 0000000..5954b1a
--- /dev/null
@@ -0,0 +1,115 @@
+From 33b7af2f459df453feb0d44628d820c47fefe7a8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Carl=20Yin=28=E6=AE=B7=E5=BC=A0=E6=88=90=29?=
+ <carl.yin@quectel.com>
+Date: Thu, 19 May 2022 02:34:43 +0000
+Subject: USB: serial: option: add Quectel BG95 modem
+
+From: Carl Yin(殷张成) <carl.yin@quectel.com>
+
+commit 33b7af2f459df453feb0d44628d820c47fefe7a8 upstream.
+
+The BG95 modem has 3 USB configurations that are configurable via the AT
+command AT+QCFGEXT="usbnet",["ecm"|"modem"|"rmnet"] which make the modem
+enumerate with the following interfaces, respectively:
+
+"modem": Diag + GNSS + Modem + Modem
+"ecm"  : Diag + GNSS + Modem + ECM
+"rmnet": Diag + GNSS + Modem + QMI
+         Don't support Full QMI messages (e.g WDS_START_NETWORK_INTERFACE)
+
+A detailed description of the USB configuration for each mode follows:
+
++QCFGEXT: "usbnet","modem"
+--------------------------
+T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
+D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
+P:  Vendor=2c7c ProdID=0700 Rev= 0.00
+S:  Manufacturer=Quectel, Incorporated
+S:  Product=Quectel LPWA Module
+S:  SerialNumber=884328a2
+C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
+I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
+E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
+E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
+E:  Ad=83(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
+E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option
+E:  Ad=85(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
+E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+
++QCFGEXT: "usbnet","ecm"
+------------------------
+T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  4 Spd=480  MxCh= 0
+D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
+P:  Vendor=2c7c ProdID=0700 Rev= 0.00
+S:  Manufacturer=Quectel, Incorporated
+S:  Product=Quectel LPWA Module
+S:  SerialNumber=884328a2
+C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
+A:  FirstIf#= 3 IfCount= 2 Cls=02(comm.) Sub=00 Prot=00
+I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
+E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
+E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
+E:  Ad=83(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
+E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 3 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
+E:  Ad=85(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
+I:  If#= 4 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
+I:* If#= 4 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
+E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+
++QCFGEXT: "usbnet","rmnet"
+--------------------------
+T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  4 Spd=480  MxCh= 0
+D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
+P:  Vendor=2c7c ProdID=0700 Rev= 0.00
+S:  Manufacturer=Quectel, Incorporated
+S:  Product=Quectel LPWA Module
+S:  SerialNumber=884328a2
+C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
+I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
+E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
+E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
+E:  Ad=83(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
+E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
+E:  Ad=85(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
+E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+
+Signed-off-by: Carl Yin <carl.yin@quectel.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/serial/option.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -1137,6 +1137,8 @@ static const struct usb_device_id option
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, 0x0620, 0xff, 0xff, 0x30) }, /* EM160R-GL */
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, 0x0620, 0xff, 0, 0) },
++      { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, 0x0700, 0xff), /* BG95 */
++        .driver_info = RSVD(3) | ZLP },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x30) },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10),
diff --git a/queue-5.17/usb-serial-pl2303-fix-type-detection-for-odd-device.patch b/queue-5.17/usb-serial-pl2303-fix-type-detection-for-odd-device.patch
new file mode 100644 (file)
index 0000000..15fbd63
--- /dev/null
@@ -0,0 +1,37 @@
+From e82e7c6dde91acd6748d672a44dc1980ce239f86 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Tue, 17 May 2022 18:17:36 +0200
+Subject: USB: serial: pl2303: fix type detection for odd device
+
+From: Johan Hovold <johan@kernel.org>
+
+commit e82e7c6dde91acd6748d672a44dc1980ce239f86 upstream.
+
+At least one pl2303 device has a bcdUSB of 1.0.1 which most likely was
+was intended as 1.1.
+
+Allow bcdDevice 1.0.1 but interpret it as 1.1.
+
+Fixes: 1e9faef4d26d ("USB: serial: pl2303: fix HX type detection")
+Cc: stable@vger.kernel.org      # 5.13
+Link: https://lore.kernel.org/linux-usb/CAJixRzqf4a9-ZKZDgWxicc_BpfdZVE9qqGmkiO7xEstOXUbGvQ@mail.gmail.com
+Reported-by: Gary van der Merwe <gary.vandermerwe@fnb.co.za>
+Link: https://lore.kernel.org/r/20220517161736.13313-1-johan@kernel.org
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/serial/pl2303.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/usb/serial/pl2303.c
++++ b/drivers/usb/serial/pl2303.c
+@@ -421,6 +421,9 @@ static int pl2303_detect_type(struct usb
+       bcdUSB = le16_to_cpu(desc->bcdUSB);
+       switch (bcdUSB) {
++      case 0x101:
++              /* USB 1.0.1? Let's assume they meant 1.1... */
++              fallthrough;
+       case 0x110:
+               switch (bcdDevice) {
+               case 0x300: