--- /dev/null
+From 29c8f40b54a45dd23971e2bc395697731bcffbe1 Mon Sep 17 00:00:00 2001
+From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
+Date: Mon, 24 May 2021 23:37:26 +0300
+Subject: ALSA: hda/realtek: Chain in pop reduction fixup for ThinkStation P340
+
+From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
+
+commit 29c8f40b54a45dd23971e2bc395697731bcffbe1 upstream.
+
+Lenovo ThinkStation P340 uses ALC623 codec (SSID 17aa:1048) and it produces
+bug plock/pop noise over line out (green jack on the back) which can be
+fixed by applying ALC269_FIXUP_NO_SHUTUP tot he machine.
+
+Convert the existing entry for the same SSID to chain to apply this fixup
+as well.
+
+Suggested-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20210524203726.2278-1-peter.ujfalusi@linux.intel.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, 9 insertions(+), 1 deletion(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6559,6 +6559,7 @@ enum {
+ ALC295_FIXUP_HP_OMEN,
+ ALC285_FIXUP_HP_SPECTRE_X360,
+ ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
++ ALC623_FIXUP_LENOVO_THINKSTATION_P340,
+ };
+
+ static const struct hda_fixup alc269_fixups[] = {
+@@ -8125,6 +8126,12 @@ static const struct hda_fixup alc269_fix
+ .chained = true,
+ .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
+ },
++ [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc_fixup_no_shutup,
++ .chained = true,
++ .chain_id = ALC283_FIXUP_HEADSET_MIC,
++ },
+ };
+
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+@@ -8442,7 +8449,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
+- SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
++ SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
+ SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
+ SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
+ SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
+@@ -8709,6 +8716,7 @@ static const struct hda_model_fixup alc2
+ {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
+ {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
+ {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
++ {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
+ {}
+ };
+ #define ALC225_STANDARD_PINS \
--- /dev/null
+From e650c1a959da49f2b873cb56564b825882c22e7a Mon Sep 17 00:00:00 2001
+From: Jeremy Szu <jeremy.szu@canonical.com>
+Date: Thu, 20 May 2021 01:03:55 +0800
+Subject: ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP Zbook Fury 15 G8
+
+From: Jeremy Szu <jeremy.szu@canonical.com>
+
+commit e650c1a959da49f2b873cb56564b825882c22e7a upstream.
+
+The HP ZBook Fury 15.6 Inch G8 is using ALC285 codec which is
+using 0x04 to control mute LED and 0x01 to control micmute LED.
+In the other hand, there is no output from right channel of speaker.
+Therefore, add a quirk to make it works.
+
+Signed-off-by: Jeremy Szu <jeremy.szu@canonical.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20210519170357.58410-3-jeremy.szu@canonical.com
+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
+@@ -8314,6 +8314,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
+ SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
+ SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
++ SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
+ SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
+ SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
+ SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
--- /dev/null
+From 50dbfae972cbe0e3c631e73c7c58cbc48bfc6a49 Mon Sep 17 00:00:00 2001
+From: Jeremy Szu <jeremy.szu@canonical.com>
+Date: Thu, 20 May 2021 01:03:56 +0800
+Subject: ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP Zbook Fury 17 G8
+
+From: Jeremy Szu <jeremy.szu@canonical.com>
+
+commit 50dbfae972cbe0e3c631e73c7c58cbc48bfc6a49 upstream.
+
+The HP ZBook Studio 17.3 Inch G8 is using ALC285 codec which is
+using 0x04 to control mute LED and 0x01 to control micmute LED.
+In the other hand, there is no output from right channel of speaker.
+Therefore, add a quirk to make it works.
+
+Signed-off-by: Jeremy Szu <jeremy.szu@canonical.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20210519170357.58410-4-jeremy.szu@canonical.com
+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
+@@ -8314,6 +8314,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
+ SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
+ SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
++ SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
+ SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
+ SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
+ SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
--- /dev/null
+From bbe183e07817a46cf8d3d7fc88093df81d23a957 Mon Sep 17 00:00:00 2001
+From: Jeremy Szu <jeremy.szu@canonical.com>
+Date: Thu, 20 May 2021 01:03:54 +0800
+Subject: ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP Zbook G8
+
+From: Jeremy Szu <jeremy.szu@canonical.com>
+
+commit bbe183e07817a46cf8d3d7fc88093df81d23a957 upstream.
+
+The HP ZBook Studio 15.6 Inch G8 is using ALC285 codec which is
+using 0x04 to control mute LED and 0x01 to control micmute LED.
+In the other hand, there is no output from right channel of speaker.
+Therefore, add a quirk to make it works.
+
+Signed-off-by: Jeremy Szu <jeremy.szu@canonical.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20210519170357.58410-2-jeremy.szu@canonical.com
+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
+@@ -8314,6 +8314,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
+ SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
+ SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
++ SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
+ SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
+ SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
+ SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
--- /dev/null
+From 0e68c4b11f1e66d211ad242007e9f1076a6b7709 Mon Sep 17 00:00:00 2001
+From: Jeremy Szu <jeremy.szu@canonical.com>
+Date: Thu, 20 May 2021 01:03:53 +0800
+Subject: ALSA: hda/realtek: fix mute/micmute LEDs for HP 855 G8
+
+From: Jeremy Szu <jeremy.szu@canonical.com>
+
+commit 0e68c4b11f1e66d211ad242007e9f1076a6b7709 upstream.
+
+The HP EliteBook 855 G8 Notebook PC is using ALC285 codec which needs
+ALC285_FIXUP_HP_MUTE_LED fixup to make it works. After applying the
+fixup, the mute/micmute LEDs work good.
+
+Signed-off-by: Jeremy Szu <jeremy.szu@canonical.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20210519170357.58410-1-jeremy.szu@canonical.com
+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
+@@ -8314,6 +8314,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
+ SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
+ SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
++ SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
+ SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
+ SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
+ SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
--- /dev/null
+From 119b75c150773425a89033215eab4d15d4198f8b Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Sat, 22 May 2021 11:47:41 +0800
+Subject: ALSA: hda/realtek: Headphone volume is controlled by Front mixer
+
+From: Hui Wang <hui.wang@canonical.com>
+
+commit 119b75c150773425a89033215eab4d15d4198f8b upstream.
+
+On some ASUS and MSI machines, the audio codec is alc1220 and the
+Headphone is connected to audio mixer 0xf and DAC 0x5, in theory
+the Headphone volume is controlled by DAC 0x5 (Heapdhone Playback
+Volume), but somehow it is controlled by DAC 0x2 (Front Playback
+Volume), maybe this is a defect on the codec alc1220.
+
+Because of this issue, the PA couldn't switch the headphone and
+Lineout correctly, If we apply the quirk CLEVO_P950 to those machines,
+the Lineout and Headphone will share the audio mixer 0xc and DAC 0x2,
+and generate Headphone+LO mixer, then PA could handle them when
+switching between them.
+
+BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1206
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Link: https://lore.kernel.org/r/20210522034741.13415-1-hui.wang@canonical.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/patch_realtek.c | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -2603,6 +2603,28 @@ static const struct hda_model_fixup alc8
+ {}
+ };
+
++static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
++ SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
++ {0x14, 0x01014010},
++ {0x15, 0x01011012},
++ {0x16, 0x01016011},
++ {0x18, 0x01a19040},
++ {0x19, 0x02a19050},
++ {0x1a, 0x0181304f},
++ {0x1b, 0x0221401f},
++ {0x1e, 0x01456130}),
++ SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
++ {0x14, 0x01015010},
++ {0x15, 0x01011012},
++ {0x16, 0x01011011},
++ {0x18, 0x01a11040},
++ {0x19, 0x02a19050},
++ {0x1a, 0x0181104f},
++ {0x1b, 0x0221401f},
++ {0x1e, 0x01451130}),
++ {}
++};
++
+ /*
+ * BIOS auto configuration
+ */
+@@ -2644,6 +2666,7 @@ static int patch_alc882(struct hda_codec
+
+ snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
+ alc882_fixups);
++ snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
+ snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
+
+ alc_auto_parse_customize_define(codec);
--- /dev/null
+From 9ebaef0540a981093bce5df15af32354d32391d9 Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Sat, 22 May 2021 12:26:45 +0800
+Subject: ALSA: hda/realtek: the bass speaker can't output sound on Yoga 9i
+
+From: Hui Wang <hui.wang@canonical.com>
+
+commit 9ebaef0540a981093bce5df15af32354d32391d9 upstream.
+
+The Lenovo Yoga 9i has bass speaker, but the bass speaker can't work,
+that is because there is an i2s amplifier on that speaker, need to
+run ideapad_s740_coef() to initialize the amplifier.
+
+And also needs to apply ALC285_FIXUP_THINKPAD_HEADSET_JACK to rename
+the speaker's mixer control name, otherwise the PA can't handle them.
+
+BugLink: http://bugs.launchpad.net/bugs/1926165
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20210522042645.14221-1-hui.wang@canonical.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/patch_realtek.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6535,6 +6535,7 @@ enum {
+ ALC295_FIXUP_ASUS_DACS,
+ ALC295_FIXUP_HP_OMEN,
+ ALC285_FIXUP_HP_SPECTRE_X360,
++ ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
+ };
+
+ static const struct hda_fixup alc269_fixups[] = {
+@@ -8095,6 +8096,12 @@ static const struct hda_fixup alc269_fix
+ .chained = true,
+ .chain_id = ALC285_FIXUP_SPEAKER2_TO_DAC1,
+ },
++ [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc285_fixup_ideapad_s740_coef,
++ .chained = true,
++ .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
++ },
+ };
+
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+@@ -8462,6 +8469,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
+ SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
+ SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
++ SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
+ SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
+ SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
+ SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
+@@ -8677,6 +8685,7 @@ static const struct hda_model_fixup alc2
+ {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
+ {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
+ {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
++ {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
+ {}
+ };
+ #define ALC225_STANDARD_PINS \
--- /dev/null
+From 51cb8e206afd463e66f16869e5ddc95bef107142 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Fri, 21 May 2021 15:37:42 +0200
+Subject: ALSA: usb-audio: fix control-request direction
+
+From: Johan Hovold <johan@kernel.org>
+
+commit 51cb8e206afd463e66f16869e5ddc95bef107142 upstream.
+
+The direction of the pipe argument must match the request-type direction
+bit or control requests may fail depending on the host-controller-driver
+implementation.
+
+Fix the UAC2_CS_CUR request which erroneously used usb_sndctrlpipe().
+
+Fixes: 93db51d06b32 ("ALSA: usb-audio: Check valid altsetting at parsing rates for UAC2/3")
+Cc: stable@vger.kernel.org # 5.10
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Link: https://lore.kernel.org/r/20210521133742.18098-1-johan@kernel.org
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/usb/format.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/usb/format.c
++++ b/sound/usb/format.c
+@@ -436,7 +436,7 @@ static bool check_valid_altsetting_v2v3(
+ if (snd_BUG_ON(altsetting >= 64 - 8))
+ return false;
+
+- err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR,
++ err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
+ USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
+ UAC2_AS_VAL_ALT_SETTINGS << 8,
+ iface, &raw_data, sizeof(raw_data));
--- /dev/null
+From 764fa6e686e0107c0357a988d193de04cf047583 Mon Sep 17 00:00:00 2001
+From: "Geoffrey D. Bennett" <g@b4.vu>
+Date: Fri, 21 May 2021 17:50:12 +0930
+Subject: ALSA: usb-audio: scarlett2: Fix device hang with ehci-pci
+
+From: Geoffrey D. Bennett <g@b4.vu>
+
+commit 764fa6e686e0107c0357a988d193de04cf047583 upstream.
+
+Use usb_rcvctrlpipe() not usb_sndctrlpipe() for USB control input in
+the Scarlett Gen 2 mixer driver. This fixes the device hang during
+initialisation when used with the ehci-pci host driver.
+
+Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
+Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/66a3d05dac325d5b53e4930578e143cef1f50dbe.1621584566.git.g@b4.vu
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/usb/mixer_scarlett_gen2.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/usb/mixer_scarlett_gen2.c
++++ b/sound/usb/mixer_scarlett_gen2.c
+@@ -635,7 +635,7 @@ static int scarlett2_usb(
+ /* send a second message to get the response */
+
+ err = snd_usb_ctl_msg(mixer->chip->dev,
+- usb_sndctrlpipe(mixer->chip->dev, 0),
++ usb_rcvctrlpipe(mixer->chip->dev, 0),
+ SCARLETT2_USB_VENDOR_SPECIFIC_CMD_RESP,
+ USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
+ 0,
--- /dev/null
+From 265d1a90e4fb6d3264d8122fbd10760e5e733be6 Mon Sep 17 00:00:00 2001
+From: "Geoffrey D. Bennett" <g@b4.vu>
+Date: Fri, 21 May 2021 17:50:13 +0930
+Subject: ALSA: usb-audio: scarlett2: Improve driver startup messages
+
+From: Geoffrey D. Bennett <g@b4.vu>
+
+commit 265d1a90e4fb6d3264d8122fbd10760e5e733be6 upstream.
+
+Add separate init function to call the existing controls_create
+function so a custom error can be displayed if initialisation fails.
+
+Use info level instead of error for notifications.
+
+Display the VID/PID so device_setup is targeted to the right device.
+
+Display "enabled" message to easily confirm that the driver is loaded.
+
+Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/b5d140c65f640faf2427e085fbbc0297b32e5fce.1621584566.git.g@b4.vu
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/usb/mixer_quirks.c | 2 -
+ sound/usb/mixer_scarlett_gen2.c | 79 +++++++++++++++++++++++++---------------
+ sound/usb/mixer_scarlett_gen2.h | 2 -
+ 3 files changed, 52 insertions(+), 31 deletions(-)
+
+--- a/sound/usb/mixer_quirks.c
++++ b/sound/usb/mixer_quirks.c
+@@ -3017,7 +3017,7 @@ int snd_usb_mixer_apply_create_quirk(str
+ case USB_ID(0x1235, 0x8203): /* Focusrite Scarlett 6i6 2nd Gen */
+ case USB_ID(0x1235, 0x8204): /* Focusrite Scarlett 18i8 2nd Gen */
+ case USB_ID(0x1235, 0x8201): /* Focusrite Scarlett 18i20 2nd Gen */
+- err = snd_scarlett_gen2_controls_create(mixer);
++ err = snd_scarlett_gen2_init(mixer);
+ break;
+
+ case USB_ID(0x041e, 0x323b): /* Creative Sound Blaster E1 */
+--- a/sound/usb/mixer_scarlett_gen2.c
++++ b/sound/usb/mixer_scarlett_gen2.c
+@@ -1997,38 +1997,11 @@ static int scarlett2_mixer_status_create
+ return usb_submit_urb(mixer->urb, GFP_KERNEL);
+ }
+
+-/* Entry point */
+-int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer)
++int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer,
++ const struct scarlett2_device_info *info)
+ {
+- const struct scarlett2_device_info *info;
+ int err;
+
+- /* only use UAC_VERSION_2 */
+- if (!mixer->protocol)
+- return 0;
+-
+- switch (mixer->chip->usb_id) {
+- case USB_ID(0x1235, 0x8203):
+- info = &s6i6_gen2_info;
+- break;
+- case USB_ID(0x1235, 0x8204):
+- info = &s18i8_gen2_info;
+- break;
+- case USB_ID(0x1235, 0x8201):
+- info = &s18i20_gen2_info;
+- break;
+- default: /* device not (yet) supported */
+- return -EINVAL;
+- }
+-
+- if (!(mixer->chip->setup & SCARLETT2_ENABLE)) {
+- usb_audio_err(mixer->chip,
+- "Focusrite Scarlett Gen 2 Mixer Driver disabled; "
+- "use options snd_usb_audio device_setup=1 "
+- "to enable and report any issues to g@b4.vu");
+- return 0;
+- }
+-
+ /* Initialise private data, routing, sequence number */
+ err = scarlett2_init_private(mixer, info);
+ if (err < 0)
+@@ -2073,3 +2046,51 @@ int snd_scarlett_gen2_controls_create(st
+
+ return 0;
+ }
++
++int snd_scarlett_gen2_init(struct usb_mixer_interface *mixer)
++{
++ struct snd_usb_audio *chip = mixer->chip;
++ const struct scarlett2_device_info *info;
++ int err;
++
++ /* only use UAC_VERSION_2 */
++ if (!mixer->protocol)
++ return 0;
++
++ switch (chip->usb_id) {
++ case USB_ID(0x1235, 0x8203):
++ info = &s6i6_gen2_info;
++ break;
++ case USB_ID(0x1235, 0x8204):
++ info = &s18i8_gen2_info;
++ break;
++ case USB_ID(0x1235, 0x8201):
++ info = &s18i20_gen2_info;
++ break;
++ default: /* device not (yet) supported */
++ return -EINVAL;
++ }
++
++ if (!(chip->setup & SCARLETT2_ENABLE)) {
++ usb_audio_info(chip,
++ "Focusrite Scarlett Gen 2 Mixer Driver disabled; "
++ "use options snd_usb_audio vid=0x%04x pid=0x%04x "
++ "device_setup=1 to enable and report any issues "
++ "to g@b4.vu",
++ USB_ID_VENDOR(chip->usb_id),
++ USB_ID_PRODUCT(chip->usb_id));
++ return 0;
++ }
++
++ usb_audio_info(chip,
++ "Focusrite Scarlett Gen 2 Mixer Driver enabled pid=0x%04x",
++ USB_ID_PRODUCT(chip->usb_id));
++
++ err = snd_scarlett_gen2_controls_create(mixer, info);
++ if (err < 0)
++ usb_audio_err(mixer->chip,
++ "Error initialising Scarlett Mixer Driver: %d",
++ err);
++
++ return err;
++}
+--- a/sound/usb/mixer_scarlett_gen2.h
++++ b/sound/usb/mixer_scarlett_gen2.h
+@@ -2,6 +2,6 @@
+ #ifndef __USB_MIXER_SCARLETT_GEN2_H
+ #define __USB_MIXER_SCARLETT_GEN2_H
+
+-int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer);
++int snd_scarlett_gen2_init(struct usb_mixer_interface *mixer);
+
+ #endif /* __USB_MIXER_SCARLETT_GEN2_H */
--- /dev/null
+From 2b17c400aeb44daf041627722581ade527bb3c1d Mon Sep 17 00:00:00 2001
+From: Norbert Slusarek <nslusarek@gmx.net>
+Date: Wed, 12 May 2021 00:43:54 +0200
+Subject: can: isotp: prevent race between isotp_bind() and isotp_setsockopt()
+
+From: Norbert Slusarek <nslusarek@gmx.net>
+
+commit 2b17c400aeb44daf041627722581ade527bb3c1d upstream.
+
+A race condition was found in isotp_setsockopt() which allows to
+change socket options after the socket was bound.
+For the specific case of SF_BROADCAST support, this might lead to possible
+use-after-free because can_rx_unregister() is not called.
+
+Checking for the flag under the socket lock in isotp_bind() and taking
+the lock in isotp_setsockopt() fixes the issue.
+
+Fixes: 921ca574cd38 ("can: isotp: add SF_BROADCAST support for functional addressing")
+Link: https://lore.kernel.org/r/trinity-e6ae9efa-9afb-4326-84c0-f3609b9b8168-1620773528307@3c-app-gmx-bs06
+Reported-by: Norbert Slusarek <nslusarek@gmx.net>
+Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
+Signed-off-by: Norbert Slusarek <nslusarek@gmx.net>
+Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/can/isotp.c | 49 +++++++++++++++++++++++++++++++++----------------
+ 1 file changed, 33 insertions(+), 16 deletions(-)
+
+--- a/net/can/isotp.c
++++ b/net/can/isotp.c
+@@ -1062,27 +1062,31 @@ static int isotp_bind(struct socket *soc
+ if (len < ISOTP_MIN_NAMELEN)
+ return -EINVAL;
+
++ if (addr->can_addr.tp.tx_id & (CAN_ERR_FLAG | CAN_RTR_FLAG))
++ return -EADDRNOTAVAIL;
++
++ if (!addr->can_ifindex)
++ return -ENODEV;
++
++ lock_sock(sk);
++
+ /* do not register frame reception for functional addressing */
+ if (so->opt.flags & CAN_ISOTP_SF_BROADCAST)
+ do_rx_reg = 0;
+
+ /* do not validate rx address for functional addressing */
+ if (do_rx_reg) {
+- if (addr->can_addr.tp.rx_id == addr->can_addr.tp.tx_id)
+- return -EADDRNOTAVAIL;
++ if (addr->can_addr.tp.rx_id == addr->can_addr.tp.tx_id) {
++ err = -EADDRNOTAVAIL;
++ goto out;
++ }
+
+- if (addr->can_addr.tp.rx_id & (CAN_ERR_FLAG | CAN_RTR_FLAG))
+- return -EADDRNOTAVAIL;
++ if (addr->can_addr.tp.rx_id & (CAN_ERR_FLAG | CAN_RTR_FLAG)) {
++ err = -EADDRNOTAVAIL;
++ goto out;
++ }
+ }
+
+- if (addr->can_addr.tp.tx_id & (CAN_ERR_FLAG | CAN_RTR_FLAG))
+- return -EADDRNOTAVAIL;
+-
+- if (!addr->can_ifindex)
+- return -ENODEV;
+-
+- lock_sock(sk);
+-
+ if (so->bound && addr->can_ifindex == so->ifindex &&
+ addr->can_addr.tp.rx_id == so->rxid &&
+ addr->can_addr.tp.tx_id == so->txid)
+@@ -1164,16 +1168,13 @@ static int isotp_getname(struct socket *
+ return ISOTP_MIN_NAMELEN;
+ }
+
+-static int isotp_setsockopt(struct socket *sock, int level, int optname,
++static int isotp_setsockopt_locked(struct socket *sock, int level, int optname,
+ sockptr_t optval, unsigned int optlen)
+ {
+ struct sock *sk = sock->sk;
+ struct isotp_sock *so = isotp_sk(sk);
+ int ret = 0;
+
+- if (level != SOL_CAN_ISOTP)
+- return -EINVAL;
+-
+ if (so->bound)
+ return -EISCONN;
+
+@@ -1248,6 +1249,22 @@ static int isotp_setsockopt(struct socke
+ return ret;
+ }
+
++static int isotp_setsockopt(struct socket *sock, int level, int optname,
++ sockptr_t optval, unsigned int optlen)
++
++{
++ struct sock *sk = sock->sk;
++ int ret;
++
++ if (level != SOL_CAN_ISOTP)
++ return -EINVAL;
++
++ lock_sock(sk);
++ ret = isotp_setsockopt_locked(sock, level, optname, optval, optlen);
++ release_sock(sk);
++ return ret;
++}
++
+ static int isotp_getsockopt(struct socket *sock, int level, int optname,
+ char __user *optval, int __user *optlen)
+ {
--- /dev/null
+From eb0688180549e3b72464e9f78df58cb7a5592c7f Mon Sep 17 00:00:00 2001
+From: Shyam Prasad N <sprasad@microsoft.com>
+Date: Fri, 21 May 2021 06:35:52 +0000
+Subject: cifs: fix string declarations and assignments in tracepoints
+
+From: Shyam Prasad N <sprasad@microsoft.com>
+
+commit eb0688180549e3b72464e9f78df58cb7a5592c7f upstream.
+
+We missed using the variable length string macros in several
+tracepoints. Fixed them in this change.
+
+There's probably more useful macros that we can use to print
+others like flags etc. But I'll submit sepawrate patches for
+those at a future date.
+
+Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
+Cc: <stable@vger.kernel.org> # v5.12
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/cifs/trace.h | 29 +++++++++++++++++------------
+ 1 file changed, 17 insertions(+), 12 deletions(-)
+
+--- a/fs/cifs/trace.h
++++ b/fs/cifs/trace.h
+@@ -12,6 +12,11 @@
+
+ #include <linux/tracepoint.h>
+
++/*
++ * Please use this 3-part article as a reference for writing new tracepoints:
++ * https://lwn.net/Articles/379903/
++ */
++
+ /* For logging errors in read or write */
+ DECLARE_EVENT_CLASS(smb3_rw_err_class,
+ TP_PROTO(unsigned int xid,
+@@ -529,16 +534,16 @@ DECLARE_EVENT_CLASS(smb3_exit_err_class,
+ TP_ARGS(xid, func_name, rc),
+ TP_STRUCT__entry(
+ __field(unsigned int, xid)
+- __field(const char *, func_name)
++ __string(func_name, func_name)
+ __field(int, rc)
+ ),
+ TP_fast_assign(
+ __entry->xid = xid;
+- __entry->func_name = func_name;
++ __assign_str(func_name, func_name);
+ __entry->rc = rc;
+ ),
+ TP_printk("\t%s: xid=%u rc=%d",
+- __entry->func_name, __entry->xid, __entry->rc)
++ __get_str(func_name), __entry->xid, __entry->rc)
+ )
+
+ #define DEFINE_SMB3_EXIT_ERR_EVENT(name) \
+@@ -583,14 +588,14 @@ DECLARE_EVENT_CLASS(smb3_enter_exit_clas
+ TP_ARGS(xid, func_name),
+ TP_STRUCT__entry(
+ __field(unsigned int, xid)
+- __field(const char *, func_name)
++ __string(func_name, func_name)
+ ),
+ TP_fast_assign(
+ __entry->xid = xid;
+- __entry->func_name = func_name;
++ __assign_str(func_name, func_name);
+ ),
+ TP_printk("\t%s: xid=%u",
+- __entry->func_name, __entry->xid)
++ __get_str(func_name), __entry->xid)
+ )
+
+ #define DEFINE_SMB3_ENTER_EXIT_EVENT(name) \
+@@ -857,16 +862,16 @@ DECLARE_EVENT_CLASS(smb3_reconnect_class
+ TP_STRUCT__entry(
+ __field(__u64, currmid)
+ __field(__u64, conn_id)
+- __field(char *, hostname)
++ __string(hostname, hostname)
+ ),
+ TP_fast_assign(
+ __entry->currmid = currmid;
+ __entry->conn_id = conn_id;
+- __entry->hostname = hostname;
++ __assign_str(hostname, hostname);
+ ),
+ TP_printk("conn_id=0x%llx server=%s current_mid=%llu",
+ __entry->conn_id,
+- __entry->hostname,
++ __get_str(hostname),
+ __entry->currmid)
+ )
+
+@@ -891,7 +896,7 @@ DECLARE_EVENT_CLASS(smb3_credit_class,
+ TP_STRUCT__entry(
+ __field(__u64, currmid)
+ __field(__u64, conn_id)
+- __field(char *, hostname)
++ __string(hostname, hostname)
+ __field(int, credits)
+ __field(int, credits_to_add)
+ __field(int, in_flight)
+@@ -899,7 +904,7 @@ DECLARE_EVENT_CLASS(smb3_credit_class,
+ TP_fast_assign(
+ __entry->currmid = currmid;
+ __entry->conn_id = conn_id;
+- __entry->hostname = hostname;
++ __assign_str(hostname, hostname);
+ __entry->credits = credits;
+ __entry->credits_to_add = credits_to_add;
+ __entry->in_flight = in_flight;
+@@ -907,7 +912,7 @@ DECLARE_EVENT_CLASS(smb3_credit_class,
+ TP_printk("conn_id=0x%llx server=%s current_mid=%llu "
+ "credits=%d credit_change=%d in_flight=%d",
+ __entry->conn_id,
+- __entry->hostname,
++ __get_str(hostname),
+ __entry->currmid,
+ __entry->credits,
+ __entry->credits_to_add,
--- /dev/null
+From 6d2fcfe6b517fe7cbf2687adfb0a16cdcd5d9243 Mon Sep 17 00:00:00 2001
+From: Aurelien Aptel <aaptel@suse.com>
+Date: Fri, 21 May 2021 17:19:27 +0200
+Subject: cifs: set server->cipher_type to AES-128-CCM for SMB3.0
+
+From: Aurelien Aptel <aaptel@suse.com>
+
+commit 6d2fcfe6b517fe7cbf2687adfb0a16cdcd5d9243 upstream.
+
+SMB3.0 doesn't have encryption negotiate context but simply uses
+the SMB2_GLOBAL_CAP_ENCRYPTION flag.
+
+When that flag is present in the neg response cifs.ko uses AES-128-CCM
+which is the only cipher available in this context.
+
+cipher_type was set to the server cipher only when parsing encryption
+negotiate context (SMB3.1.1).
+
+For SMB3.0 it was set to 0. This means cipher_type value can be 0 or 1
+for AES-128-CCM.
+
+Fix this by checking for SMB3.0 and encryption capability and setting
+cipher_type appropriately.
+
+Signed-off-by: Aurelien Aptel <aaptel@suse.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/cifs/smb2pdu.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/fs/cifs/smb2pdu.c
++++ b/fs/cifs/smb2pdu.c
+@@ -958,6 +958,13 @@ SMB2_negotiate(const unsigned int xid, s
+ /* Internal types */
+ server->capabilities |= SMB2_NT_FIND | SMB2_LARGE_FILES;
+
++ /*
++ * SMB3.0 supports only 1 cipher and doesn't have a encryption neg context
++ * Set the cipher type manually.
++ */
++ if (server->dialect == SMB30_PROT_ID && (server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION))
++ server->cipher_type = SMB2_ENCRYPTION_AES128_CCM;
++
+ security_blob = smb2_get_data_area_len(&blob_offset, &blob_length,
+ (struct smb2_sync_hdr *)rsp);
+ /*
--- /dev/null
+From 0ee74d5a48635c848c20f152d0d488bf84641304 Mon Sep 17 00:00:00 2001
+From: Rolf Eike Beer <eb@emlix.com>
+Date: Tue, 25 May 2021 15:08:02 +0800
+Subject: iommu/vt-d: Fix sysfs leak in alloc_iommu()
+
+From: Rolf Eike Beer <eb@emlix.com>
+
+commit 0ee74d5a48635c848c20f152d0d488bf84641304 upstream.
+
+iommu_device_sysfs_add() is called before, so is has to be cleaned on subsequent
+errors.
+
+Fixes: 39ab9555c2411 ("iommu: Add sysfs bindings for struct iommu_device")
+Cc: stable@vger.kernel.org # 4.11.x
+Signed-off-by: Rolf Eike Beer <eb@emlix.com>
+Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
+Link: https://lore.kernel.org/r/17411490.HIIP88n32C@mobilepool36.emlix.com
+Link: https://lore.kernel.org/r/20210525070802.361755-2-baolu.lu@linux.intel.com
+Signed-off-by: Joerg Roedel <jroedel@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iommu/intel/dmar.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/iommu/intel/dmar.c
++++ b/drivers/iommu/intel/dmar.c
+@@ -1144,7 +1144,7 @@ static int alloc_iommu(struct dmar_drhd_
+
+ err = iommu_device_register(&iommu->iommu);
+ if (err)
+- goto err_unmap;
++ goto err_sysfs;
+ }
+
+ drhd->iommu = iommu;
+@@ -1152,6 +1152,8 @@ static int alloc_iommu(struct dmar_drhd_
+
+ return 0;
+
++err_sysfs:
++ iommu_device_sysfs_remove(&iommu->iommu);
+ err_unmap:
+ unmap_iommu(iommu);
+ error_free_seq_id:
--- /dev/null
+From 56a8d3fd1f342d10ee7b27e9ac0f4d00b5fbb91c Mon Sep 17 00:00:00 2001
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+Date: Tue, 13 Apr 2021 18:18:34 +0200
+Subject: mtd: rawnand: cs553x: Fix external use of SW Hamming ECC helper
+
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+
+commit 56a8d3fd1f342d10ee7b27e9ac0f4d00b5fbb91c upstream.
+
+Since the Hamming software ECC engine has been updated to become a
+proper and independent ECC engine, it is now mandatory to either
+initialize the engine before using any one of his functions or use one
+of the bare helpers which only perform the calculations. As there is no
+actual need for a proper ECC initialization, let's just use the bare
+helper instead of the rawnand one.
+
+Fixes: 90ccf0a0192f ("mtd: nand: ecc-hamming: Rename the exported functions")
+Cc: stable@vger.kernel.org
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20210413161840.345208-2-miquel.raynal@bootlin.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/nand/raw/cs553x_nand.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+--- a/drivers/mtd/nand/raw/cs553x_nand.c
++++ b/drivers/mtd/nand/raw/cs553x_nand.c
+@@ -18,6 +18,7 @@
+ #include <linux/module.h>
+ #include <linux/delay.h>
+ #include <linux/mtd/mtd.h>
++#include <linux/mtd/nand-ecc-sw-hamming.h>
+ #include <linux/mtd/rawnand.h>
+ #include <linux/mtd/partitions.h>
+ #include <linux/iopoll.h>
+@@ -240,6 +241,15 @@ static int cs_calculate_ecc(struct nand_
+ return 0;
+ }
+
++static int cs553x_ecc_correct(struct nand_chip *chip,
++ unsigned char *buf,
++ unsigned char *read_ecc,
++ unsigned char *calc_ecc)
++{
++ return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
++ chip->ecc.size, false);
++}
++
+ static struct cs553x_nand_controller *controllers[4];
+
+ static int cs553x_attach_chip(struct nand_chip *chip)
+@@ -251,7 +261,7 @@ static int cs553x_attach_chip(struct nan
+ chip->ecc.bytes = 3;
+ chip->ecc.hwctl = cs_enable_hwecc;
+ chip->ecc.calculate = cs_calculate_ecc;
+- chip->ecc.correct = rawnand_sw_hamming_correct;
++ chip->ecc.correct = cs553x_ecc_correct;
+ chip->ecc.strength = 1;
+
+ return 0;
--- /dev/null
+From ad9ffdce453934cdc22fac0a0268119bd630260f Mon Sep 17 00:00:00 2001
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+Date: Tue, 13 Apr 2021 18:18:35 +0200
+Subject: mtd: rawnand: fsmc: Fix external use of SW Hamming ECC helper
+
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+
+commit ad9ffdce453934cdc22fac0a0268119bd630260f upstream.
+
+Since the Hamming software ECC engine has been updated to become a
+proper and independent ECC engine, it is now mandatory to either
+initialize the engine before using any one of his functions or use one
+of the bare helpers which only perform the calculations. As there is no
+actual need for a proper ECC initialization, let's just use the bare
+helper instead of the rawnand one.
+
+Fixes: 90ccf0a0192f ("mtd: nand: ecc-hamming: Rename the exported functions")
+Cc: stable@vger.kernel.org
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20210413161840.345208-3-miquel.raynal@bootlin.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/nand/raw/fsmc_nand.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+--- a/drivers/mtd/nand/raw/fsmc_nand.c
++++ b/drivers/mtd/nand/raw/fsmc_nand.c
+@@ -25,6 +25,7 @@
+ #include <linux/sched.h>
+ #include <linux/types.h>
+ #include <linux/mtd/mtd.h>
++#include <linux/mtd/nand-ecc-sw-hamming.h>
+ #include <linux/mtd/rawnand.h>
+ #include <linux/platform_device.h>
+ #include <linux/of.h>
+@@ -432,6 +433,15 @@ static int fsmc_read_hwecc_ecc1(struct n
+ return 0;
+ }
+
++static int fsmc_correct_ecc1(struct nand_chip *chip,
++ unsigned char *buf,
++ unsigned char *read_ecc,
++ unsigned char *calc_ecc)
++{
++ return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
++ chip->ecc.size, false);
++}
++
+ /* Count the number of 0's in buff upto a max of max_bits */
+ static int count_written_bits(u8 *buff, int size, int max_bits)
+ {
+@@ -917,7 +927,7 @@ static int fsmc_nand_attach_chip(struct
+ case NAND_ECC_ENGINE_TYPE_ON_HOST:
+ dev_info(host->dev, "Using 1-bit HW ECC scheme\n");
+ nand->ecc.calculate = fsmc_read_hwecc_ecc1;
+- nand->ecc.correct = rawnand_sw_hamming_correct;
++ nand->ecc.correct = fsmc_correct_ecc1;
+ nand->ecc.hwctl = fsmc_enable_hwecc;
+ nand->ecc.bytes = 3;
+ nand->ecc.strength = 1;
--- /dev/null
+From c4b7d7c480d607e4f52d310d9d16b194868d0917 Mon Sep 17 00:00:00 2001
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+Date: Tue, 13 Apr 2021 18:18:36 +0200
+Subject: mtd: rawnand: lpc32xx_slc: Fix external use of SW Hamming ECC helper
+
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+
+commit c4b7d7c480d607e4f52d310d9d16b194868d0917 upstream.
+
+Since the Hamming software ECC engine has been updated to become a
+proper and independent ECC engine, it is now mandatory to either
+initialize the engine before using any one of his functions or use one
+of the bare helpers which only perform the calculations. As there is no
+actual need for a proper ECC initialization, let's just use the bare
+helper instead of the rawnand one.
+
+Fixes: 90ccf0a0192f ("mtd: nand: ecc-hamming: Rename the exported functions")
+Cc: stable@vger.kernel.org
+Cc: Vladimir Zapolskiy <vz@mleia.com>
+Reported-by: Trevor Woerner <twoerner@gmail.com>
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Tested-by: Trevor Woerner <twoerner@gmail.com>
+Acked-by: Vladimir Zapolskiy <vz@mleia.com>
+Link: https://lore.kernel.org/linux-mtd/20210413161840.345208-4-miquel.raynal@bootlin.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/nand/raw/lpc32xx_slc.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+--- a/drivers/mtd/nand/raw/lpc32xx_slc.c
++++ b/drivers/mtd/nand/raw/lpc32xx_slc.c
+@@ -27,6 +27,7 @@
+ #include <linux/of.h>
+ #include <linux/of_gpio.h>
+ #include <linux/mtd/lpc32xx_slc.h>
++#include <linux/mtd/nand-ecc-sw-hamming.h>
+
+ #define LPC32XX_MODNAME "lpc32xx-nand"
+
+@@ -345,6 +346,18 @@ static int lpc32xx_nand_ecc_calculate(st
+ }
+
+ /*
++ * Corrects the data
++ */
++static int lpc32xx_nand_ecc_correct(struct nand_chip *chip,
++ unsigned char *buf,
++ unsigned char *read_ecc,
++ unsigned char *calc_ecc)
++{
++ return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
++ chip->ecc.size, false);
++}
++
++/*
+ * Read a single byte from NAND device
+ */
+ static uint8_t lpc32xx_nand_read_byte(struct nand_chip *chip)
+@@ -802,7 +815,7 @@ static int lpc32xx_nand_attach_chip(stru
+ chip->ecc.write_oob = lpc32xx_nand_write_oob_syndrome;
+ chip->ecc.read_oob = lpc32xx_nand_read_oob_syndrome;
+ chip->ecc.calculate = lpc32xx_nand_ecc_calculate;
+- chip->ecc.correct = rawnand_sw_hamming_correct;
++ chip->ecc.correct = lpc32xx_nand_ecc_correct;
+ chip->ecc.hwctl = lpc32xx_nand_ecc_enable;
+
+ /*
--- /dev/null
+From 3e09c0252501829b14b10f14e1982aaab77d0b80 Mon Sep 17 00:00:00 2001
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+Date: Tue, 13 Apr 2021 18:18:37 +0200
+Subject: mtd: rawnand: ndfc: Fix external use of SW Hamming ECC helper
+
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+
+commit 3e09c0252501829b14b10f14e1982aaab77d0b80 upstream.
+
+Since the Hamming software ECC engine has been updated to become a
+proper and independent ECC engine, it is now mandatory to either
+initialize the engine before using any one of his functions or use one
+of the bare helpers which only perform the calculations. As there is no
+actual need for a proper ECC initialization, let's just use the bare
+helper instead of the rawnand one.
+
+Fixes: 90ccf0a0192f ("mtd: nand: ecc-hamming: Rename the exported functions")
+Cc: stable@vger.kernel.org
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20210413161840.345208-5-miquel.raynal@bootlin.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/nand/raw/ndfc.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+--- a/drivers/mtd/nand/raw/ndfc.c
++++ b/drivers/mtd/nand/raw/ndfc.c
+@@ -22,6 +22,7 @@
+ #include <linux/mtd/ndfc.h>
+ #include <linux/slab.h>
+ #include <linux/mtd/mtd.h>
++#include <linux/mtd/nand-ecc-sw-hamming.h>
+ #include <linux/of_address.h>
+ #include <linux/of_platform.h>
+ #include <asm/io.h>
+@@ -100,6 +101,15 @@ static int ndfc_calculate_ecc(struct nan
+ return 0;
+ }
+
++static int ndfc_correct_ecc(struct nand_chip *chip,
++ unsigned char *buf,
++ unsigned char *read_ecc,
++ unsigned char *calc_ecc)
++{
++ return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
++ chip->ecc.size, false);
++}
++
+ /*
+ * Speedups for buffer read/write/verify
+ *
+@@ -145,7 +155,7 @@ static int ndfc_chip_init(struct ndfc_co
+ chip->controller = &ndfc->ndfc_control;
+ chip->legacy.read_buf = ndfc_read_buf;
+ chip->legacy.write_buf = ndfc_write_buf;
+- chip->ecc.correct = rawnand_sw_hamming_correct;
++ chip->ecc.correct = ndfc_correct_ecc;
+ chip->ecc.hwctl = ndfc_enable_hwecc;
+ chip->ecc.calculate = ndfc_calculate_ecc;
+ chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
--- /dev/null
+From 46fcb57e6b7283533ebf8ba17a6bd30fa88bdc9f Mon Sep 17 00:00:00 2001
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+Date: Tue, 13 Apr 2021 18:18:38 +0200
+Subject: mtd: rawnand: sharpsl: Fix external use of SW Hamming ECC helper
+
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+
+commit 46fcb57e6b7283533ebf8ba17a6bd30fa88bdc9f upstream.
+
+Since the Hamming software ECC engine has been updated to become a
+proper and independent ECC engine, it is now mandatory to either
+initialize the engine before using any one of his functions or use one
+of the bare helpers which only perform the calculations. As there is no
+actual need for a proper ECC initialization, let's just use the bare
+helper instead of the rawnand one.
+
+Fixes: 90ccf0a0192f ("mtd: nand: ecc-hamming: Rename the exported functions")
+Cc: stable@vger.kernel.org
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20210413161840.345208-6-miquel.raynal@bootlin.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/nand/raw/sharpsl.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+--- a/drivers/mtd/nand/raw/sharpsl.c
++++ b/drivers/mtd/nand/raw/sharpsl.c
+@@ -11,6 +11,7 @@
+ #include <linux/module.h>
+ #include <linux/delay.h>
+ #include <linux/mtd/mtd.h>
++#include <linux/mtd/nand-ecc-sw-hamming.h>
+ #include <linux/mtd/rawnand.h>
+ #include <linux/mtd/partitions.h>
+ #include <linux/mtd/sharpsl.h>
+@@ -96,6 +97,15 @@ static int sharpsl_nand_calculate_ecc(st
+ return readb(sharpsl->io + ECCCNTR) != 0;
+ }
+
++static int sharpsl_nand_correct_ecc(struct nand_chip *chip,
++ unsigned char *buf,
++ unsigned char *read_ecc,
++ unsigned char *calc_ecc)
++{
++ return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
++ chip->ecc.size, false);
++}
++
+ static int sharpsl_attach_chip(struct nand_chip *chip)
+ {
+ if (chip->ecc.engine_type != NAND_ECC_ENGINE_TYPE_ON_HOST)
+@@ -106,7 +116,7 @@ static int sharpsl_attach_chip(struct na
+ chip->ecc.strength = 1;
+ chip->ecc.hwctl = sharpsl_nand_enable_hwecc;
+ chip->ecc.calculate = sharpsl_nand_calculate_ecc;
+- chip->ecc.correct = rawnand_sw_hamming_correct;
++ chip->ecc.correct = sharpsl_nand_correct_ecc;
+
+ return 0;
+ }
--- /dev/null
+From 6a4c5ada577467a5f79e06f2c5e69c09983c22fb Mon Sep 17 00:00:00 2001
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+Date: Tue, 13 Apr 2021 18:18:39 +0200
+Subject: mtd: rawnand: tmio: Fix external use of SW Hamming ECC helper
+
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+
+commit 6a4c5ada577467a5f79e06f2c5e69c09983c22fb upstream.
+
+Since the Hamming software ECC engine has been updated to become a
+proper and independent ECC engine, it is now mandatory to either
+initialize the engine before using any one of his functions or use one
+of the bare helpers which only perform the calculations. As there is no
+actual need for a proper ECC initialization, let's just use the bare
+helper instead of the rawnand one.
+
+Fixes: 90ccf0a0192f ("mtd: nand: ecc-hamming: Rename the exported functions")
+Cc: stable@vger.kernel.org
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20210413161840.345208-7-miquel.raynal@bootlin.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/nand/raw/tmio_nand.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+--- a/drivers/mtd/nand/raw/tmio_nand.c
++++ b/drivers/mtd/nand/raw/tmio_nand.c
+@@ -34,6 +34,7 @@
+ #include <linux/interrupt.h>
+ #include <linux/ioport.h>
+ #include <linux/mtd/mtd.h>
++#include <linux/mtd/nand-ecc-sw-hamming.h>
+ #include <linux/mtd/rawnand.h>
+ #include <linux/mtd/partitions.h>
+ #include <linux/slab.h>
+@@ -292,11 +293,12 @@ static int tmio_nand_correct_data(struct
+ int r0, r1;
+
+ /* assume ecc.size = 512 and ecc.bytes = 6 */
+- r0 = rawnand_sw_hamming_correct(chip, buf, read_ecc, calc_ecc);
++ r0 = ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
++ chip->ecc.size, false);
+ if (r0 < 0)
+ return r0;
+- r1 = rawnand_sw_hamming_correct(chip, buf + 256, read_ecc + 3,
+- calc_ecc + 3);
++ r1 = ecc_sw_hamming_correct(buf + 256, read_ecc + 3, calc_ecc + 3,
++ chip->ecc.size, false);
+ if (r1 < 0)
+ return r1;
+ return r0 + r1;
--- /dev/null
+From 3d227a0b0ce319edbff6fd0d8af4d66689e477cc Mon Sep 17 00:00:00 2001
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+Date: Tue, 13 Apr 2021 18:18:40 +0200
+Subject: mtd: rawnand: txx9ndfmc: Fix external use of SW Hamming ECC helper
+
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+
+commit 3d227a0b0ce319edbff6fd0d8af4d66689e477cc upstream.
+
+Since the Hamming software ECC engine has been updated to become a
+proper and independent ECC engine, it is now mandatory to either
+initialize the engine before using any one of his functions or use one
+of the bare helpers which only perform the calculations. As there is no
+actual need for a proper ECC initialization, let's just use the bare
+helper instead of the rawnand one.
+
+Fixes: 90ccf0a0192f ("mtd: nand: ecc-hamming: Rename the exported functions")
+Cc: stable@vger.kernel.org
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20210413161840.345208-8-miquel.raynal@bootlin.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/nand/raw/txx9ndfmc.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/mtd/nand/raw/txx9ndfmc.c
++++ b/drivers/mtd/nand/raw/txx9ndfmc.c
+@@ -13,6 +13,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/delay.h>
+ #include <linux/mtd/mtd.h>
++#include <linux/mtd/nand-ecc-sw-hamming.h>
+ #include <linux/mtd/rawnand.h>
+ #include <linux/mtd/partitions.h>
+ #include <linux/io.h>
+@@ -193,8 +194,8 @@ static int txx9ndfmc_correct_data(struct
+ int stat;
+
+ for (eccsize = chip->ecc.size; eccsize > 0; eccsize -= 256) {
+- stat = rawnand_sw_hamming_correct(chip, buf, read_ecc,
+- calc_ecc);
++ stat = ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
++ chip->ecc.size, false);
+ if (stat < 0)
+ return stat;
+ corrected += stat;
--- /dev/null
+From a421d218603ffa822a0b8045055c03eae394a7eb Mon Sep 17 00:00:00 2001
+From: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Date: Wed, 19 May 2021 12:54:51 -0400
+Subject: NFSv4: Fix a NULL pointer dereference in pnfs_mark_matching_lsegs_return()
+
+From: Anna Schumaker <Anna.Schumaker@Netapp.com>
+
+commit a421d218603ffa822a0b8045055c03eae394a7eb upstream.
+
+Commit de144ff4234f changes _pnfs_return_layout() to call
+pnfs_mark_matching_lsegs_return() passing NULL as the struct
+pnfs_layout_range argument. Unfortunately,
+pnfs_mark_matching_lsegs_return() doesn't check if we have a value here
+before dereferencing it, causing an oops.
+
+I'm able to hit this crash consistently when running connectathon basic
+tests on NFS v4.1/v4.2 against Ontap.
+
+Fixes: de144ff4234f ("NFSv4: Don't discard segments marked for return in _pnfs_return_layout()")
+Cc: stable@vger.kernel.org
+Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/nfs/pnfs.c | 15 +++++++--------
+ 1 file changed, 7 insertions(+), 8 deletions(-)
+
+--- a/fs/nfs/pnfs.c
++++ b/fs/nfs/pnfs.c
+@@ -1317,6 +1317,11 @@ _pnfs_return_layout(struct inode *ino)
+ {
+ struct pnfs_layout_hdr *lo = NULL;
+ struct nfs_inode *nfsi = NFS_I(ino);
++ struct pnfs_layout_range range = {
++ .iomode = IOMODE_ANY,
++ .offset = 0,
++ .length = NFS4_MAX_UINT64,
++ };
+ LIST_HEAD(tmp_list);
+ const struct cred *cred;
+ nfs4_stateid stateid;
+@@ -1344,16 +1349,10 @@ _pnfs_return_layout(struct inode *ino)
+ }
+ valid_layout = pnfs_layout_is_valid(lo);
+ pnfs_clear_layoutcommit(ino, &tmp_list);
+- pnfs_mark_matching_lsegs_return(lo, &tmp_list, NULL, 0);
++ pnfs_mark_matching_lsegs_return(lo, &tmp_list, &range, 0);
+
+- if (NFS_SERVER(ino)->pnfs_curr_ld->return_range) {
+- struct pnfs_layout_range range = {
+- .iomode = IOMODE_ANY,
+- .offset = 0,
+- .length = NFS4_MAX_UINT64,
+- };
++ if (NFS_SERVER(ino)->pnfs_curr_ld->return_range)
+ NFS_SERVER(ino)->pnfs_curr_ld->return_range(lo, &range);
+- }
+
+ /* Don't send a LAYOUTRETURN if list was initially empty */
+ if (!test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags) ||
--- /dev/null
+From 70ca3c57ff914113f681e657634f7fbfa68e1ad1 Mon Sep 17 00:00:00 2001
+From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
+Date: Sat, 15 May 2021 16:03:15 +0900
+Subject: scsi: target: core: Avoid smp_processor_id() in preemptible code
+
+From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
+
+commit 70ca3c57ff914113f681e657634f7fbfa68e1ad1 upstream.
+
+The BUG message "BUG: using smp_processor_id() in preemptible [00000000]
+code" was observed for TCMU devices with kernel config DEBUG_PREEMPT.
+
+The message was observed when blktests block/005 was run on TCMU devices
+with fileio backend or user:zbc backend [1]. The commit 1130b499b4a7
+("scsi: target: tcm_loop: Use LIO wq cmd submission helper") triggered the
+symptom. The commit modified work queue to handle commands and changed
+'current->nr_cpu_allowed' at smp_processor_id() call.
+
+The message was also observed at system shutdown when TCMU devices were not
+cleaned up [2]. The function smp_processor_id() was called in SCSI host
+work queue for abort handling, and triggered the BUG message. This symptom
+was observed regardless of the commit 1130b499b4a7 ("scsi: target:
+tcm_loop: Use LIO wq cmd submission helper").
+
+To avoid the preemptible code check at smp_processor_id(), get CPU ID with
+raw_smp_processor_id() instead. The CPU ID is used for performance
+improvement then thread move to other CPU will not affect the code.
+
+[1]
+
+[ 56.468103] run blktests block/005 at 2021-05-12 14:16:38
+[ 57.369473] check_preemption_disabled: 85 callbacks suppressed
+[ 57.369480] BUG: using smp_processor_id() in preemptible [00000000] code: fio/1511
+[ 57.369506] BUG: using smp_processor_id() in preemptible [00000000] code: fio/1510
+[ 57.369512] BUG: using smp_processor_id() in preemptible [00000000] code: fio/1506
+[ 57.369552] caller is __target_init_cmd+0x157/0x170 [target_core_mod]
+[ 57.369606] CPU: 4 PID: 1506 Comm: fio Not tainted 5.13.0-rc1+ #34
+[ 57.369613] Hardware name: System manufacturer System Product Name/PRIME Z270-A, BIOS 1302 03/15/2018
+[ 57.369617] Call Trace:
+[ 57.369621] BUG: using smp_processor_id() in preemptible [00000000] code: fio/1507
+[ 57.369628] dump_stack+0x6d/0x89
+[ 57.369642] check_preemption_disabled+0xc8/0xd0
+[ 57.369628] caller is __target_init_cmd+0x157/0x170 [target_core_mod]
+[ 57.369655] __target_init_cmd+0x157/0x170 [target_core_mod]
+[ 57.369695] target_init_cmd+0x76/0x90 [target_core_mod]
+[ 57.369732] tcm_loop_queuecommand+0x109/0x210 [tcm_loop]
+[ 57.369744] scsi_queue_rq+0x38e/0xc40
+[ 57.369761] __blk_mq_try_issue_directly+0x109/0x1c0
+[ 57.369779] blk_mq_try_issue_directly+0x43/0x90
+[ 57.369790] blk_mq_submit_bio+0x4e5/0x5d0
+[ 57.369812] submit_bio_noacct+0x46e/0x4e0
+[ 57.369830] __blkdev_direct_IO_simple+0x1a3/0x2d0
+[ 57.369859] ? set_init_blocksize.isra.0+0x60/0x60
+[ 57.369880] generic_file_read_iter+0x89/0x160
+[ 57.369898] blkdev_read_iter+0x44/0x60
+[ 57.369906] new_sync_read+0x102/0x170
+[ 57.369929] vfs_read+0xd4/0x160
+[ 57.369941] __x64_sys_pread64+0x6e/0xa0
+[ 57.369946] ? lockdep_hardirqs_on+0x79/0x100
+[ 57.369958] do_syscall_64+0x3a/0x70
+[ 57.369965] entry_SYSCALL_64_after_hwframe+0x44/0xae
+[ 57.369973] RIP: 0033:0x7f7ed4c1399f
+[ 57.369979] Code: 08 89 3c 24 48 89 4c 24 18 e8 7d f3 ff ff 4c 8b 54 24 18 48 8b 54 24 10 41 89 c0 48 8b 74 24 08 8b 3c 24 b8 11 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 04 24 e8 cd f3 ff ff 48 8b
+[ 57.369983] RSP: 002b:00007ffd7918c580 EFLAGS: 00000293 ORIG_RAX: 0000000000000011
+[ 57.369990] RAX: ffffffffffffffda RBX: 00000000015b4540 RCX: 00007f7ed4c1399f
+[ 57.369993] RDX: 0000000000001000 RSI: 00000000015de000 RDI: 0000000000000009
+[ 57.369996] RBP: 00000000015b4540 R08: 0000000000000000 R09: 0000000000000001
+[ 57.369999] R10: 0000000000e5c000 R11: 0000000000000293 R12: 00007f7eb5269a70
+[ 57.370002] R13: 0000000000000000 R14: 0000000000001000 R15: 00000000015b4568
+[ 57.370031] CPU: 7 PID: 1507 Comm: fio Not tainted 5.13.0-rc1+ #34
+[ 57.370036] Hardware name: System manufacturer System Product Name/PRIME Z270-A, BIOS 1302 03/15/2018
+[ 57.370039] Call Trace:
+[ 57.370045] dump_stack+0x6d/0x89
+[ 57.370056] check_preemption_disabled+0xc8/0xd0
+[ 57.370068] __target_init_cmd+0x157/0x170 [target_core_mod]
+[ 57.370121] target_init_cmd+0x76/0x90 [target_core_mod]
+[ 57.370178] tcm_loop_queuecommand+0x109/0x210 [tcm_loop]
+[ 57.370197] scsi_queue_rq+0x38e/0xc40
+[ 57.370224] __blk_mq_try_issue_directly+0x109/0x1c0
+...
+
+[2]
+
+[ 117.458597] BUG: using smp_processor_id() in preemptible [00000000] code: kworker/u16:8
+[ 117.467279] caller is __target_init_cmd+0x157/0x170 [target_core_mod]
+[ 117.473893] CPU: 1 PID: 418 Comm: kworker/u16:6 Not tainted 5.13.0-rc1+ #34
+[ 117.481150] Hardware name: System manufacturer System Product Name/PRIME Z270-A, BIOS 8
+[ 117.481153] Workqueue: scsi_tmf_7 scmd_eh_abort_handler
+[ 117.481156] Call Trace:
+[ 117.481158] dump_stack+0x6d/0x89
+[ 117.481162] check_preemption_disabled+0xc8/0xd0
+[ 117.512575] target_submit_tmr+0x41/0x150 [target_core_mod]
+[ 117.519705] tcm_loop_issue_tmr+0xa7/0x100 [tcm_loop]
+[ 117.524913] tcm_loop_abort_task+0x43/0x60 [tcm_loop]
+[ 117.530137] scmd_eh_abort_handler+0x7b/0x230
+[ 117.534681] process_one_work+0x268/0x580
+[ 117.538862] worker_thread+0x55/0x3b0
+[ 117.542652] ? process_one_work+0x580/0x580
+[ 117.548351] kthread+0x143/0x160
+[ 117.551675] ? kthread_create_worker_on_cpu+0x40/0x40
+[ 117.556873] ret_from_fork+0x1f/0x30
+
+Link: https://lore.kernel.org/r/20210515070315.215801-1-shinichiro.kawasaki@wdc.com
+Fixes: 1526d9f10c61 ("scsi: target: Make state_list per CPU")
+Cc: stable@vger.kernel.org # v5.11+
+Reviewed-by: Mike Christie <michael.christie@oracle.com>
+Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/target/target_core_transport.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/target/target_core_transport.c
++++ b/drivers/target/target_core_transport.c
+@@ -1400,7 +1400,7 @@ void transport_init_se_cmd(
+ cmd->orig_fe_lun = unpacked_lun;
+
+ if (!(cmd->se_cmd_flags & SCF_USE_CPUID))
+- cmd->cpuid = smp_processor_id();
++ cmd->cpuid = raw_smp_processor_id();
+
+ cmd->state_active = false;
+ }
--- /dev/null
+alsa-hda-realtek-the-bass-speaker-can-t-output-sound-on-yoga-9i.patch
+alsa-hda-realtek-headphone-volume-is-controlled-by-front-mixer.patch
+alsa-hda-realtek-chain-in-pop-reduction-fixup-for-thinkstation-p340.patch
+alsa-hda-realtek-fix-mute-micmute-leds-for-hp-855-g8.patch
+alsa-hda-realtek-fix-mute-micmute-leds-and-speaker-for-hp-zbook-g8.patch
+alsa-hda-realtek-fix-mute-micmute-leds-and-speaker-for-hp-zbook-fury-15-g8.patch
+alsa-hda-realtek-fix-mute-micmute-leds-and-speaker-for-hp-zbook-fury-17-g8.patch
+alsa-usb-audio-fix-control-request-direction.patch
+alsa-usb-audio-scarlett2-fix-device-hang-with-ehci-pci.patch
+alsa-usb-audio-scarlett2-improve-driver-startup-messages.patch
+cifs-fix-string-declarations-and-assignments-in-tracepoints.patch
+cifs-set-server-cipher_type-to-aes-128-ccm-for-smb3.0.patch
+mtd-rawnand-cs553x-fix-external-use-of-sw-hamming-ecc-helper.patch
+mtd-rawnand-txx9ndfmc-fix-external-use-of-sw-hamming-ecc-helper.patch
+mtd-rawnand-sharpsl-fix-external-use-of-sw-hamming-ecc-helper.patch
+mtd-rawnand-lpc32xx_slc-fix-external-use-of-sw-hamming-ecc-helper.patch
+mtd-rawnand-ndfc-fix-external-use-of-sw-hamming-ecc-helper.patch
+mtd-rawnand-tmio-fix-external-use-of-sw-hamming-ecc-helper.patch
+mtd-rawnand-fsmc-fix-external-use-of-sw-hamming-ecc-helper.patch
+can-isotp-prevent-race-between-isotp_bind-and-isotp_setsockopt.patch
+nfsv4-fix-a-null-pointer-dereference-in-pnfs_mark_matching_lsegs_return.patch
+scsi-target-core-avoid-smp_processor_id-in-preemptible-code.patch
+iommu-vt-d-fix-sysfs-leak-in-alloc_iommu.patch