From: Greg Kroah-Hartman Date: Sat, 5 Feb 2022 14:50:48 +0000 (+0100) Subject: 5.10-stable patches X-Git-Tag: v5.10.98~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fef7bb9b7ac5e1c6f865393e83446debfdcdb4dc;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: alsa-hda-fix-uaf-of-leds-class-devs-at-unbinding.patch alsa-hda-realtek-add-missing-fixup-model-entry-for-gigabyte-x570-alc1220-quirks.patch alsa-hda-realtek-add-quirk-for-asus-gu603.patch alsa-hda-realtek-fix-race-at-concurrent-coef-updates.patch alsa-hda-realtek-fix-silent-output-on-gigabyte-x570-aorus-xtreme-after-reboot-from-windows.patch alsa-hda-realtek-fix-silent-output-on-gigabyte-x570s-aorus-master-newer-chipset.patch alsa-usb-audio-correct-quirk-for-vf0770.patch asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_volsw.patch asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_volsw_sx.patch asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_xr_sx.patch audit-improve-audit-queue-handling-when-audit-1-on-cmdline.patch block-bio-integrity-advance-seed-correctly-for-larger-interval-sizes.patch btrfs-fix-deadlock-between-quota-disable-and-qgroup-rescan-worker.patch dma-buf-heaps-fix-potential-spectre-v1-gadget.patch drm-amd-display-force-link_rate-as-link_rate_rbr2-for-2018-15-apple-retina-panels.patch drm-nouveau-fix-off-by-one-in-bios-boundary-checking.patch ib-hfi1-fix-aip-early-init-panic.patch mm-debug_vm_pgtable-remove-pte-entry-from-the-page-table.patch mm-kmemleak-avoid-scanning-potential-huge-holes.patch mm-pgtable-define-pte_index-so-that-preprocessor-could-recognize-it.patch nvme-fabrics-fix-state-check-in-nvmf_ctlr_matches_baseopts.patch --- diff --git a/queue-5.10/alsa-hda-fix-uaf-of-leds-class-devs-at-unbinding.patch b/queue-5.10/alsa-hda-fix-uaf-of-leds-class-devs-at-unbinding.patch new file mode 100644 index 00000000000..7ce78a87b8b --- /dev/null +++ b/queue-5.10/alsa-hda-fix-uaf-of-leds-class-devs-at-unbinding.patch @@ -0,0 +1,86 @@ +From 549f8ffc7b2f7561bea7f90930b6c5104318e87b Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 26 Jan 2022 15:50:11 +0100 +Subject: ALSA: hda: Fix UAF of leds class devs at unbinding + +From: Takashi Iwai + +commit 549f8ffc7b2f7561bea7f90930b6c5104318e87b upstream. + +The LED class devices that are created by HD-audio codec drivers are +registered via devm_led_classdev_register() and associated with the +HD-audio codec device. Unfortunately, it turned out that the devres +release doesn't work for this case; namely, since the codec resource +release happens before the devm call chain, it triggers a NULL +dereference or a UAF for a stale set_brightness_delay callback. + +For fixing the bug, this patch changes the LED class device register +and unregister in a manual manner without devres, keeping the +instances in hda_gen_spec. + +Reported-by: Alexander Sergeyev +Cc: +Link: https://lore.kernel.org/r/20220111195229.a77wrpjclqwrx4bx@localhost.localdomain +Link: https://lore.kernel.org/r/20220126145011.16728-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/hda/hda_generic.c | 17 +++++++++++++++-- + sound/pci/hda/hda_generic.h | 3 +++ + 2 files changed, 18 insertions(+), 2 deletions(-) + +--- a/sound/pci/hda/hda_generic.c ++++ b/sound/pci/hda/hda_generic.c +@@ -91,6 +91,12 @@ static void snd_hda_gen_spec_free(struct + free_kctls(spec); + snd_array_free(&spec->paths); + snd_array_free(&spec->loopback_list); ++#ifdef CONFIG_SND_HDA_GENERIC_LEDS ++ if (spec->led_cdevs[LED_AUDIO_MUTE]) ++ led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MUTE]); ++ if (spec->led_cdevs[LED_AUDIO_MICMUTE]) ++ led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MICMUTE]); ++#endif + } + + /* +@@ -3911,7 +3917,10 @@ static int create_mute_led_cdev(struct h + enum led_brightness), + bool micmute) + { ++ struct hda_gen_spec *spec = codec->spec; + struct led_classdev *cdev; ++ int idx = micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE; ++ int err; + + cdev = devm_kzalloc(&codec->core.dev, sizeof(*cdev), GFP_KERNEL); + if (!cdev) +@@ -3921,10 +3930,14 @@ static int create_mute_led_cdev(struct h + cdev->max_brightness = 1; + cdev->default_trigger = micmute ? "audio-micmute" : "audio-mute"; + cdev->brightness_set_blocking = callback; +- cdev->brightness = ledtrig_audio_get(micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE); ++ cdev->brightness = ledtrig_audio_get(idx); + cdev->flags = LED_CORE_SUSPENDRESUME; + +- return devm_led_classdev_register(&codec->core.dev, cdev); ++ err = led_classdev_register(&codec->core.dev, cdev); ++ if (err < 0) ++ return err; ++ spec->led_cdevs[idx] = cdev; ++ return 0; + } + + static void vmaster_update_mute_led(void *private_data, int enabled) +--- a/sound/pci/hda/hda_generic.h ++++ b/sound/pci/hda/hda_generic.h +@@ -305,6 +305,9 @@ struct hda_gen_spec { + struct hda_jack_callback *cb); + void (*mic_autoswitch_hook)(struct hda_codec *codec, + struct hda_jack_callback *cb); ++ ++ /* leds */ ++ struct led_classdev *led_cdevs[NUM_AUDIO_LEDS]; + }; + + /* values for add_stereo_mix_input flag */ diff --git a/queue-5.10/alsa-hda-realtek-add-missing-fixup-model-entry-for-gigabyte-x570-alc1220-quirks.patch b/queue-5.10/alsa-hda-realtek-add-missing-fixup-model-entry-for-gigabyte-x570-alc1220-quirks.patch new file mode 100644 index 00000000000..c7603d7cee6 --- /dev/null +++ b/queue-5.10/alsa-hda-realtek-add-missing-fixup-model-entry-for-gigabyte-x570-alc1220-quirks.patch @@ -0,0 +1,32 @@ +From 63394a16086fc2152869d7902621e2525e14bc40 Mon Sep 17 00:00:00 2001 +From: Christian Lachner +Date: Sat, 29 Jan 2022 12:32:41 +0100 +Subject: ALSA: hda/realtek: Add missing fixup-model entry for Gigabyte X570 ALC1220 quirks + +From: Christian Lachner + +commit 63394a16086fc2152869d7902621e2525e14bc40 upstream. + +The initial commit of the new Gigabyte X570 ALC1220 quirks lacked the +fixup-model entry in alc882_fixup_models[]. It seemed not to cause any ill +effects but for completeness sake this commit makes up for that. + +Signed-off-by: Christian Lachner +Cc: +Link: https://lore.kernel.org/r/20220129113243.93068-2-gladiac@gmail.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + 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 +@@ -2672,6 +2672,7 @@ static const struct hda_model_fixup alc8 + {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"}, + {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"}, + {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"}, ++ {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"}, + {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"}, + {} + }; diff --git a/queue-5.10/alsa-hda-realtek-add-quirk-for-asus-gu603.patch b/queue-5.10/alsa-hda-realtek-add-quirk-for-asus-gu603.patch new file mode 100644 index 00000000000..1907560c5ab --- /dev/null +++ b/queue-5.10/alsa-hda-realtek-add-quirk-for-asus-gu603.patch @@ -0,0 +1,36 @@ +From 94db9cc8f8fa2d5426ce79ec4ca16028f7084224 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Albert=20Geant=C4=83?= +Date: Mon, 31 Jan 2022 03:05:23 +0200 +Subject: ALSA: hda/realtek: Add quirk for ASUS GU603 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Albert Geantă + +commit 94db9cc8f8fa2d5426ce79ec4ca16028f7084224 upstream. + +The ASUS GU603 (Zephyrus M16 - SSID 1043:16b2) requires a quirk similar to +other ASUS devices for correctly routing the 4 integrated speakers. This +fixes it by adding a corresponding quirk entry, which connects the bass +speakers to the proper DAC. + +Signed-off-by: Albert Geantă +Cc: +Link: https://lore.kernel.org/r/20220131010523.546386-1-albertgeanta@gmail.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + 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 +@@ -8789,6 +8789,7 @@ static const struct snd_pci_quirk alc269 + SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS), + SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), ++ SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), + SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), + SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), diff --git a/queue-5.10/alsa-hda-realtek-fix-race-at-concurrent-coef-updates.patch b/queue-5.10/alsa-hda-realtek-fix-race-at-concurrent-coef-updates.patch new file mode 100644 index 00000000000..d557a764e51 --- /dev/null +++ b/queue-5.10/alsa-hda-realtek-fix-race-at-concurrent-coef-updates.patch @@ -0,0 +1,148 @@ +From b837a9f5ab3bdfab9233c9f98a6bef717673a3e5 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Mon, 31 Jan 2022 08:57:38 +0100 +Subject: ALSA: hda: realtek: Fix race at concurrent COEF updates + +From: Takashi Iwai + +commit b837a9f5ab3bdfab9233c9f98a6bef717673a3e5 upstream. + +The COEF access is done with two steps: setting the index then read or +write the data. When multiple COEF accesses are performed +concurrently, the index and data might be paired unexpectedly. +In most cases, this isn't a big problem as the COEF setup is done at +the initialization, but some dynamic changes like the mute LED may hit +such a race. + +For avoiding the racy COEF accesses, this patch introduces a new +mutex coef_mutex to alc_spec, and wrap the COEF accessing functions +with it. + +Reported-by: Alexander Sergeyev +Cc: +Link: https://lore.kernel.org/r/20220111195229.a77wrpjclqwrx4bx@localhost.localdomain +Link: https://lore.kernel.org/r/20220131075738.24323-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/hda/patch_realtek.c | 61 ++++++++++++++++++++++++++++++++++-------- + 1 file changed, 50 insertions(+), 11 deletions(-) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -97,6 +97,7 @@ struct alc_spec { + unsigned int gpio_mic_led_mask; + struct alc_coef_led mute_led_coef; + struct alc_coef_led mic_led_coef; ++ struct mutex coef_mutex; + + hda_nid_t headset_mic_pin; + hda_nid_t headphone_mic_pin; +@@ -133,8 +134,8 @@ struct alc_spec { + * COEF access helper functions + */ + +-static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, +- unsigned int coef_idx) ++static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, ++ unsigned int coef_idx) + { + unsigned int val; + +@@ -143,28 +144,61 @@ static int alc_read_coefex_idx(struct hd + return val; + } + ++static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, ++ unsigned int coef_idx) ++{ ++ struct alc_spec *spec = codec->spec; ++ unsigned int val; ++ ++ mutex_lock(&spec->coef_mutex); ++ val = __alc_read_coefex_idx(codec, nid, coef_idx); ++ mutex_unlock(&spec->coef_mutex); ++ return val; ++} ++ + #define alc_read_coef_idx(codec, coef_idx) \ + alc_read_coefex_idx(codec, 0x20, coef_idx) + +-static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, +- unsigned int coef_idx, unsigned int coef_val) ++static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, ++ unsigned int coef_idx, unsigned int coef_val) + { + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); + } + ++static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, ++ unsigned int coef_idx, unsigned int coef_val) ++{ ++ struct alc_spec *spec = codec->spec; ++ ++ mutex_lock(&spec->coef_mutex); ++ __alc_write_coefex_idx(codec, nid, coef_idx, coef_val); ++ mutex_unlock(&spec->coef_mutex); ++} ++ + #define alc_write_coef_idx(codec, coef_idx, coef_val) \ + alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val) + ++static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, ++ unsigned int coef_idx, unsigned int mask, ++ unsigned int bits_set) ++{ ++ unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx); ++ ++ if (val != -1) ++ __alc_write_coefex_idx(codec, nid, coef_idx, ++ (val & ~mask) | bits_set); ++} ++ + static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, + unsigned int coef_idx, unsigned int mask, + unsigned int bits_set) + { +- unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx); ++ struct alc_spec *spec = codec->spec; + +- if (val != -1) +- alc_write_coefex_idx(codec, nid, coef_idx, +- (val & ~mask) | bits_set); ++ mutex_lock(&spec->coef_mutex); ++ __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set); ++ mutex_unlock(&spec->coef_mutex); + } + + #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ +@@ -197,13 +231,17 @@ struct coef_fw { + static void alc_process_coef_fw(struct hda_codec *codec, + const struct coef_fw *fw) + { ++ struct alc_spec *spec = codec->spec; ++ ++ mutex_lock(&spec->coef_mutex); + for (; fw->nid; fw++) { + if (fw->mask == (unsigned short)-1) +- alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); ++ __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); + else +- alc_update_coefex_idx(codec, fw->nid, fw->idx, +- fw->mask, fw->val); ++ __alc_update_coefex_idx(codec, fw->nid, fw->idx, ++ fw->mask, fw->val); + } ++ mutex_unlock(&spec->coef_mutex); + } + + /* +@@ -1160,6 +1198,7 @@ static int alc_alloc_spec(struct hda_cod + codec->spdif_status_reset = 1; + codec->forced_resume = 1; + codec->patch_ops = alc_patch_ops; ++ mutex_init(&spec->coef_mutex); + + err = alc_codec_rename_from_preset(codec); + if (err < 0) { diff --git a/queue-5.10/alsa-hda-realtek-fix-silent-output-on-gigabyte-x570-aorus-xtreme-after-reboot-from-windows.patch b/queue-5.10/alsa-hda-realtek-fix-silent-output-on-gigabyte-x570-aorus-xtreme-after-reboot-from-windows.patch new file mode 100644 index 00000000000..2696f36b862 --- /dev/null +++ b/queue-5.10/alsa-hda-realtek-fix-silent-output-on-gigabyte-x570-aorus-xtreme-after-reboot-from-windows.patch @@ -0,0 +1,34 @@ +From ea3541961376f733373839cc90493aafa8a7f733 Mon Sep 17 00:00:00 2001 +From: Christian Lachner +Date: Sat, 29 Jan 2022 12:32:43 +0100 +Subject: ALSA: hda/realtek: Fix silent output on Gigabyte X570 Aorus Xtreme after reboot from Windows + +From: Christian Lachner + +commit ea3541961376f733373839cc90493aafa8a7f733 upstream. + +This commit switches the Gigabyte X570 Aorus Xtreme from using the +ALC1220_FIXUP_CLEVO_P950 to the ALC1220_FIXUP_GB_X570 quirk. This fixes +the no-audio after reboot from windows problem. + +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205275 +Signed-off-by: Christian Lachner +Cc: +Link: https://lore.kernel.org/r/20220129113243.93068-4-gladiac@gmail.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/hda/patch_realtek.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -2598,7 +2598,7 @@ static const struct snd_pci_quirk alc882 + SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE), + SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS), + SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570), +- SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950), ++ SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570), + SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570), + SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950), diff --git a/queue-5.10/alsa-hda-realtek-fix-silent-output-on-gigabyte-x570s-aorus-master-newer-chipset.patch b/queue-5.10/alsa-hda-realtek-fix-silent-output-on-gigabyte-x570s-aorus-master-newer-chipset.patch new file mode 100644 index 00000000000..47f332d8347 --- /dev/null +++ b/queue-5.10/alsa-hda-realtek-fix-silent-output-on-gigabyte-x570s-aorus-master-newer-chipset.patch @@ -0,0 +1,51 @@ +From 41a8601302ecbe704ac970552c33dc942300fc37 Mon Sep 17 00:00:00 2001 +From: Christian Lachner +Date: Sat, 29 Jan 2022 12:32:42 +0100 +Subject: ALSA: hda/realtek: Fix silent output on Gigabyte X570S Aorus Master (newer chipset) + +From: Christian Lachner + +commit 41a8601302ecbe704ac970552c33dc942300fc37 upstream. + +Newer versions of the X570 Master come with a newer revision of the +mainboard chipset - the X570S. These boards have the same ALC1220 codec +but seem to initialize the codec with a different parameter in Coef 0x7 +which causes the output audio to be very low. We therefore write a +known-good value to Coef 0x7 to fix that. As the value is the exact same +as on the other X570(non-S) boards the same quirk-function can be shared +between both generations. + +This commit adds the Gigabyte X570S Aorus Master to the list of boards +using the ALC1220_FIXUP_GB_X570 quirk. This fixes both, the silent output +and the no-audio after reboot from windows problems. + +This work has been tested by the folks over at the level1techs forum here: +https://forum.level1techs.com/t/has-anybody-gotten-audio-working-in-linux-on-aorus-x570-master/154072 + +Signed-off-by: Christian Lachner +Cc: +Link: https://lore.kernel.org/r/20220129113243.93068-3-gladiac@gmail.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/hda/patch_realtek.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -2171,6 +2171,7 @@ static void alc1220_fixup_gb_x570(struct + { + static const hda_nid_t conn1[] = { 0x0c }; + static const struct coef_fw gb_x570_coefs[] = { ++ WRITE_COEF(0x07, 0x03c0), + WRITE_COEF(0x1a, 0x01c1), + WRITE_COEF(0x1b, 0x0202), + WRITE_COEF(0x43, 0x3005), +@@ -2598,6 +2599,7 @@ static const struct snd_pci_quirk alc882 + SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS), + SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570), + SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950), ++ SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570), + SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950), diff --git a/queue-5.10/alsa-usb-audio-correct-quirk-for-vf0770.patch b/queue-5.10/alsa-usb-audio-correct-quirk-for-vf0770.patch new file mode 100644 index 00000000000..024c52e9316 --- /dev/null +++ b/queue-5.10/alsa-usb-audio-correct-quirk-for-vf0770.patch @@ -0,0 +1,44 @@ +From 4ee02e20893d2f9e951c7888f2284fa608ddaa35 Mon Sep 17 00:00:00 2001 +From: Jonas Hahnfeld +Date: Mon, 31 Jan 2022 19:35:16 +0100 +Subject: ALSA: usb-audio: Correct quirk for VF0770 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jonas Hahnfeld + +commit 4ee02e20893d2f9e951c7888f2284fa608ddaa35 upstream. + +This device provides both audio and video. The original quirk added in +commit 48827e1d6af5 ("ALSA: usb-audio: Add quirk for VF0770") used +USB_DEVICE to match the vendor and product ID. Depending on module order, +if snd-usb-audio was asked first, it would match the entire device and +uvcvideo wouldn't get to see it. Change the matching to USB_AUDIO_DEVICE +to restore uvcvideo matching in all cases. + +Fixes: 48827e1d6af5 ("ALSA: usb-audio: Add quirk for VF0770") +Reported-by: Jukka Heikintalo +Tested-by: Jukka Heikintalo +Reported-by: Paweł Susicki +Tested-by: Paweł Susicki +Cc: # 5.4, 5.10, 5.14, 5.15 +Signed-off-by: Jonas Hahnfeld +Link: https://lore.kernel.org/r/20220131183516.61191-1-hahnjo@hahnjo.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/usb/quirks-table.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -84,7 +84,7 @@ + * combination. + */ + { +- USB_DEVICE(0x041e, 0x4095), ++ USB_AUDIO_DEVICE(0x041e, 0x4095), + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { + .ifnum = QUIRK_ANY_INTERFACE, + .type = QUIRK_COMPOSITE, diff --git a/queue-5.10/asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_volsw.patch b/queue-5.10/asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_volsw.patch new file mode 100644 index 00000000000..0afbe9a94c1 --- /dev/null +++ b/queue-5.10/asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_volsw.patch @@ -0,0 +1,54 @@ +From 817f7c9335ec01e0f5e8caffc4f1dcd5e458a4c0 Mon Sep 17 00:00:00 2001 +From: Mark Brown +Date: Mon, 24 Jan 2022 15:32:51 +0000 +Subject: ASoC: ops: Reject out of bounds values in snd_soc_put_volsw() + +From: Mark Brown + +commit 817f7c9335ec01e0f5e8caffc4f1dcd5e458a4c0 upstream. + +We don't currently validate that the values being set are within the range +we advertised to userspace as being valid, do so and reject any values +that are out of range. + +Signed-off-by: Mark Brown +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20220124153253.3548853-2-broonie@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman +--- + sound/soc/soc-ops.c | 18 ++++++++++++++++-- + 1 file changed, 16 insertions(+), 2 deletions(-) + +--- a/sound/soc/soc-ops.c ++++ b/sound/soc/soc-ops.c +@@ -316,13 +316,27 @@ int snd_soc_put_volsw(struct snd_kcontro + if (sign_bit) + mask = BIT(sign_bit + 1) - 1; + +- val = ((ucontrol->value.integer.value[0] + min) & mask); ++ val = ucontrol->value.integer.value[0]; ++ if (mc->platform_max && val > mc->platform_max) ++ return -EINVAL; ++ if (val > max - min) ++ return -EINVAL; ++ if (val < 0) ++ return -EINVAL; ++ val = (val + min) & mask; + if (invert) + val = max - val; + val_mask = mask << shift; + val = val << shift; + if (snd_soc_volsw_is_stereo(mc)) { +- val2 = ((ucontrol->value.integer.value[1] + min) & mask); ++ val2 = ucontrol->value.integer.value[1]; ++ if (mc->platform_max && val2 > mc->platform_max) ++ return -EINVAL; ++ if (val2 > max - min) ++ return -EINVAL; ++ if (val2 < 0) ++ return -EINVAL; ++ val2 = (val2 + min) & mask; + if (invert) + val2 = max - val2; + if (reg == reg2) { diff --git a/queue-5.10/asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_volsw_sx.patch b/queue-5.10/asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_volsw_sx.patch new file mode 100644 index 00000000000..52f34318fd0 --- /dev/null +++ b/queue-5.10/asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_volsw_sx.patch @@ -0,0 +1,41 @@ +From 4f1e50d6a9cf9c1b8c859d449b5031cacfa8404e Mon Sep 17 00:00:00 2001 +From: Mark Brown +Date: Mon, 24 Jan 2022 15:32:52 +0000 +Subject: ASoC: ops: Reject out of bounds values in snd_soc_put_volsw_sx() + +From: Mark Brown + +commit 4f1e50d6a9cf9c1b8c859d449b5031cacfa8404e upstream. + +We don't currently validate that the values being set are within the range +we advertised to userspace as being valid, do so and reject any values +that are out of range. + +Signed-off-by: Mark Brown +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20220124153253.3548853-3-broonie@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman +--- + sound/soc/soc-ops.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/sound/soc/soc-ops.c ++++ b/sound/soc/soc-ops.c +@@ -423,8 +423,15 @@ int snd_soc_put_volsw_sx(struct snd_kcon + int err = 0; + unsigned int val, val_mask, val2 = 0; + ++ val = ucontrol->value.integer.value[0]; ++ if (mc->platform_max && val > mc->platform_max) ++ return -EINVAL; ++ if (val > max - min) ++ return -EINVAL; ++ if (val < 0) ++ return -EINVAL; + val_mask = mask << shift; +- val = (ucontrol->value.integer.value[0] + min) & mask; ++ val = (val + min) & mask; + val = val << shift; + + err = snd_soc_component_update_bits(component, reg, val_mask, val); diff --git a/queue-5.10/asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_xr_sx.patch b/queue-5.10/asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_xr_sx.patch new file mode 100644 index 00000000000..8a4eb47955e --- /dev/null +++ b/queue-5.10/asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_xr_sx.patch @@ -0,0 +1,33 @@ +From 4cf28e9ae6e2e11a044be1bcbcfa1b0d8675fe4d Mon Sep 17 00:00:00 2001 +From: Mark Brown +Date: Mon, 24 Jan 2022 15:32:53 +0000 +Subject: ASoC: ops: Reject out of bounds values in snd_soc_put_xr_sx() + +From: Mark Brown + +commit 4cf28e9ae6e2e11a044be1bcbcfa1b0d8675fe4d upstream. + +We don't currently validate that the values being set are within the range +we advertised to userspace as being valid, do so and reject any values +that are out of range. + +Signed-off-by: Mark Brown +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20220124153253.3548853-4-broonie@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman +--- + sound/soc/soc-ops.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/sound/soc/soc-ops.c ++++ b/sound/soc/soc-ops.c +@@ -880,6 +880,8 @@ int snd_soc_put_xr_sx(struct snd_kcontro + unsigned int i, regval, regmask; + int err; + ++ if (val < mc->min || val > mc->max) ++ return -EINVAL; + if (invert) + val = max - val; + val &= mask; diff --git a/queue-5.10/audit-improve-audit-queue-handling-when-audit-1-on-cmdline.patch b/queue-5.10/audit-improve-audit-queue-handling-when-audit-1-on-cmdline.patch new file mode 100644 index 00000000000..d8c69777213 --- /dev/null +++ b/queue-5.10/audit-improve-audit-queue-handling-when-audit-1-on-cmdline.patch @@ -0,0 +1,207 @@ +From f26d04331360d42dbd6b58448bd98e4edbfbe1c5 Mon Sep 17 00:00:00 2001 +From: Paul Moore +Date: Thu, 13 Jan 2022 18:54:38 -0500 +Subject: audit: improve audit queue handling when "audit=1" on cmdline + +From: Paul Moore + +commit f26d04331360d42dbd6b58448bd98e4edbfbe1c5 upstream. + +When an admin enables audit at early boot via the "audit=1" kernel +command line the audit queue behavior is slightly different; the +audit subsystem goes to greater lengths to avoid dropping records, +which unfortunately can result in problems when the audit daemon is +forcibly stopped for an extended period of time. + +This patch makes a number of changes designed to improve the audit +queuing behavior so that leaving the audit daemon in a stopped state +for an extended period does not cause a significant impact to the +system. + +- kauditd_send_queue() is now limited to looping through the + passed queue only once per call. This not only prevents the + function from looping indefinitely when records are returned + to the current queue, it also allows any recovery handling in + kauditd_thread() to take place when kauditd_send_queue() + returns. + +- Transient netlink send errors seen as -EAGAIN now cause the + record to be returned to the retry queue instead of going to + the hold queue. The intention of the hold queue is to store, + perhaps for an extended period of time, the events which led + up to the audit daemon going offline. The retry queue remains + a temporary queue intended to protect against transient issues + between the kernel and the audit daemon. + +- The retry queue is now limited by the audit_backlog_limit + setting, the same as the other queues. This allows admins + to bound the size of all of the audit queues on the system. + +- kauditd_rehold_skb() now returns records to the end of the + hold queue to ensure ordering is preserved in the face of + recent changes to kauditd_send_queue(). + +Cc: stable@vger.kernel.org +Fixes: 5b52330bbfe63 ("audit: fix auditd/kernel connection state tracking") +Fixes: f4b3ee3c85551 ("audit: improve robustness of the audit queue handling") +Reported-by: Gaosheng Cui +Tested-by: Gaosheng Cui +Reviewed-by: Richard Guy Briggs +Signed-off-by: Paul Moore +Signed-off-by: Greg Kroah-Hartman +--- + kernel/audit.c | 62 +++++++++++++++++++++++++++++++++++++++------------------ + 1 file changed, 43 insertions(+), 19 deletions(-) + +--- a/kernel/audit.c ++++ b/kernel/audit.c +@@ -541,20 +541,22 @@ static void kauditd_printk_skb(struct sk + /** + * kauditd_rehold_skb - Handle a audit record send failure in the hold queue + * @skb: audit record ++ * @error: error code (unused) + * + * Description: + * This should only be used by the kauditd_thread when it fails to flush the + * hold queue. + */ +-static void kauditd_rehold_skb(struct sk_buff *skb) ++static void kauditd_rehold_skb(struct sk_buff *skb, __always_unused int error) + { +- /* put the record back in the queue at the same place */ +- skb_queue_head(&audit_hold_queue, skb); ++ /* put the record back in the queue */ ++ skb_queue_tail(&audit_hold_queue, skb); + } + + /** + * kauditd_hold_skb - Queue an audit record, waiting for auditd + * @skb: audit record ++ * @error: error code + * + * Description: + * Queue the audit record, waiting for an instance of auditd. When this +@@ -564,19 +566,31 @@ static void kauditd_rehold_skb(struct sk + * and queue it, if we have room. If we want to hold on to the record, but we + * don't have room, record a record lost message. + */ +-static void kauditd_hold_skb(struct sk_buff *skb) ++static void kauditd_hold_skb(struct sk_buff *skb, int error) + { + /* at this point it is uncertain if we will ever send this to auditd so + * try to send the message via printk before we go any further */ + kauditd_printk_skb(skb); + + /* can we just silently drop the message? */ +- if (!audit_default) { +- kfree_skb(skb); +- return; ++ if (!audit_default) ++ goto drop; ++ ++ /* the hold queue is only for when the daemon goes away completely, ++ * not -EAGAIN failures; if we are in a -EAGAIN state requeue the ++ * record on the retry queue unless it's full, in which case drop it ++ */ ++ if (error == -EAGAIN) { ++ if (!audit_backlog_limit || ++ skb_queue_len(&audit_retry_queue) < audit_backlog_limit) { ++ skb_queue_tail(&audit_retry_queue, skb); ++ return; ++ } ++ audit_log_lost("kauditd retry queue overflow"); ++ goto drop; + } + +- /* if we have room, queue the message */ ++ /* if we have room in the hold queue, queue the message */ + if (!audit_backlog_limit || + skb_queue_len(&audit_hold_queue) < audit_backlog_limit) { + skb_queue_tail(&audit_hold_queue, skb); +@@ -585,24 +599,32 @@ static void kauditd_hold_skb(struct sk_b + + /* we have no other options - drop the message */ + audit_log_lost("kauditd hold queue overflow"); ++drop: + kfree_skb(skb); + } + + /** + * kauditd_retry_skb - Queue an audit record, attempt to send again to auditd + * @skb: audit record ++ * @error: error code (unused) + * + * Description: + * Not as serious as kauditd_hold_skb() as we still have a connected auditd, + * but for some reason we are having problems sending it audit records so + * queue the given record and attempt to resend. + */ +-static void kauditd_retry_skb(struct sk_buff *skb) ++static void kauditd_retry_skb(struct sk_buff *skb, __always_unused int error) + { +- /* NOTE: because records should only live in the retry queue for a +- * short period of time, before either being sent or moved to the hold +- * queue, we don't currently enforce a limit on this queue */ +- skb_queue_tail(&audit_retry_queue, skb); ++ if (!audit_backlog_limit || ++ skb_queue_len(&audit_retry_queue) < audit_backlog_limit) { ++ skb_queue_tail(&audit_retry_queue, skb); ++ return; ++ } ++ ++ /* we have to drop the record, send it via printk as a last effort */ ++ kauditd_printk_skb(skb); ++ audit_log_lost("kauditd retry queue overflow"); ++ kfree_skb(skb); + } + + /** +@@ -640,7 +662,7 @@ static void auditd_reset(const struct au + /* flush the retry queue to the hold queue, but don't touch the main + * queue since we need to process that normally for multicast */ + while ((skb = skb_dequeue(&audit_retry_queue))) +- kauditd_hold_skb(skb); ++ kauditd_hold_skb(skb, -ECONNREFUSED); + } + + /** +@@ -714,16 +736,18 @@ static int kauditd_send_queue(struct soc + struct sk_buff_head *queue, + unsigned int retry_limit, + void (*skb_hook)(struct sk_buff *skb), +- void (*err_hook)(struct sk_buff *skb)) ++ void (*err_hook)(struct sk_buff *skb, int error)) + { + int rc = 0; +- struct sk_buff *skb; ++ struct sk_buff *skb = NULL; ++ struct sk_buff *skb_tail; + unsigned int failed = 0; + + /* NOTE: kauditd_thread takes care of all our locking, we just use + * the netlink info passed to us (e.g. sk and portid) */ + +- while ((skb = skb_dequeue(queue))) { ++ skb_tail = skb_peek_tail(queue); ++ while ((skb != skb_tail) && (skb = skb_dequeue(queue))) { + /* call the skb_hook for each skb we touch */ + if (skb_hook) + (*skb_hook)(skb); +@@ -731,7 +755,7 @@ static int kauditd_send_queue(struct soc + /* can we send to anyone via unicast? */ + if (!sk) { + if (err_hook) +- (*err_hook)(skb); ++ (*err_hook)(skb, -ECONNREFUSED); + continue; + } + +@@ -745,7 +769,7 @@ retry: + rc == -ECONNREFUSED || rc == -EPERM) { + sk = NULL; + if (err_hook) +- (*err_hook)(skb); ++ (*err_hook)(skb, rc); + if (rc == -EAGAIN) + rc = 0; + /* continue to drain the queue */ diff --git a/queue-5.10/block-bio-integrity-advance-seed-correctly-for-larger-interval-sizes.patch b/queue-5.10/block-bio-integrity-advance-seed-correctly-for-larger-interval-sizes.patch new file mode 100644 index 00000000000..4211cfe9281 --- /dev/null +++ b/queue-5.10/block-bio-integrity-advance-seed-correctly-for-larger-interval-sizes.patch @@ -0,0 +1,43 @@ +From b13e0c71856817fca67159b11abac350e41289f5 Mon Sep 17 00:00:00 2001 +From: "Martin K. Petersen" +Date: Thu, 3 Feb 2022 22:42:09 -0500 +Subject: block: bio-integrity: Advance seed correctly for larger interval sizes + +From: Martin K. Petersen + +commit b13e0c71856817fca67159b11abac350e41289f5 upstream. + +Commit 309a62fa3a9e ("bio-integrity: bio_integrity_advance must update +integrity seed") added code to update the integrity seed value when +advancing a bio. However, it failed to take into account that the +integrity interval might be larger than the 512-byte block layer +sector size. This broke bio splitting on PI devices with 4KB logical +blocks. + +The seed value should be advanced by bio_integrity_intervals() and not +the number of sectors. + +Cc: Dmitry Monakhov +Cc: stable@vger.kernel.org +Fixes: 309a62fa3a9e ("bio-integrity: bio_integrity_advance must update integrity seed") +Tested-by: Dmitry Ivanov +Reported-by: Alexey Lyashkov +Signed-off-by: Martin K. Petersen +Link: https://lore.kernel.org/r/20220204034209.4193-1-martin.petersen@oracle.com +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + block/bio-integrity.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/block/bio-integrity.c ++++ b/block/bio-integrity.c +@@ -384,7 +384,7 @@ void bio_integrity_advance(struct bio *b + struct blk_integrity *bi = blk_get_integrity(bio->bi_disk); + unsigned bytes = bio_integrity_bytes(bi, bytes_done >> 9); + +- bip->bip_iter.bi_sector += bytes_done >> 9; ++ bip->bip_iter.bi_sector += bio_integrity_intervals(bi, bytes_done >> 9); + bvec_iter_advance(bip->bip_vec, &bip->bip_iter, bytes); + } + diff --git a/queue-5.10/btrfs-fix-deadlock-between-quota-disable-and-qgroup-rescan-worker.patch b/queue-5.10/btrfs-fix-deadlock-between-quota-disable-and-qgroup-rescan-worker.patch new file mode 100644 index 00000000000..f8ddaae1d82 --- /dev/null +++ b/queue-5.10/btrfs-fix-deadlock-between-quota-disable-and-qgroup-rescan-worker.patch @@ -0,0 +1,305 @@ +From e804861bd4e69cc5fe1053eedcb024982dde8e48 Mon Sep 17 00:00:00 2001 +From: Shin'ichiro Kawasaki +Date: Thu, 20 Jan 2022 20:09:16 +0900 +Subject: btrfs: fix deadlock between quota disable and qgroup rescan worker + +From: Shin'ichiro Kawasaki + +commit e804861bd4e69cc5fe1053eedcb024982dde8e48 upstream. + +Quota disable ioctl starts a transaction before waiting for the qgroup +rescan worker completes. However, this wait can be infinite and results +in deadlock because of circular dependency among the quota disable +ioctl, the qgroup rescan worker and the other task with transaction such +as block group relocation task. + +The deadlock happens with the steps following: + +1) Task A calls ioctl to disable quota. It starts a transaction and + waits for qgroup rescan worker completes. +2) Task B such as block group relocation task starts a transaction and + joins to the transaction that task A started. Then task B commits to + the transaction. In this commit, task B waits for a commit by task A. +3) Task C as the qgroup rescan worker starts its job and starts a + transaction. In this transaction start, task C waits for completion + of the transaction that task A started and task B committed. + +This deadlock was found with fstests test case btrfs/115 and a zoned +null_blk device. The test case enables and disables quota, and the +block group reclaim was triggered during the quota disable by chance. +The deadlock was also observed by running quota enable and disable in +parallel with 'btrfs balance' command on regular null_blk devices. + +An example report of the deadlock: + + [372.469894] INFO: task kworker/u16:6:103 blocked for more than 122 seconds. + [372.479944] Not tainted 5.16.0-rc8 #7 + [372.485067] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. + [372.493898] task:kworker/u16:6 state:D stack: 0 pid: 103 ppid: 2 flags:0x00004000 + [372.503285] Workqueue: btrfs-qgroup-rescan btrfs_work_helper [btrfs] + [372.510782] Call Trace: + [372.514092] + [372.521684] __schedule+0xb56/0x4850 + [372.530104] ? io_schedule_timeout+0x190/0x190 + [372.538842] ? lockdep_hardirqs_on+0x7e/0x100 + [372.547092] ? _raw_spin_unlock_irqrestore+0x3e/0x60 + [372.555591] schedule+0xe0/0x270 + [372.561894] btrfs_commit_transaction+0x18bb/0x2610 [btrfs] + [372.570506] ? btrfs_apply_pending_changes+0x50/0x50 [btrfs] + [372.578875] ? free_unref_page+0x3f2/0x650 + [372.585484] ? finish_wait+0x270/0x270 + [372.591594] ? release_extent_buffer+0x224/0x420 [btrfs] + [372.599264] btrfs_qgroup_rescan_worker+0xc13/0x10c0 [btrfs] + [372.607157] ? lock_release+0x3a9/0x6d0 + [372.613054] ? btrfs_qgroup_account_extent+0xda0/0xda0 [btrfs] + [372.620960] ? do_raw_spin_lock+0x11e/0x250 + [372.627137] ? rwlock_bug.part.0+0x90/0x90 + [372.633215] ? lock_is_held_type+0xe4/0x140 + [372.639404] btrfs_work_helper+0x1ae/0xa90 [btrfs] + [372.646268] process_one_work+0x7e9/0x1320 + [372.652321] ? lock_release+0x6d0/0x6d0 + [372.658081] ? pwq_dec_nr_in_flight+0x230/0x230 + [372.664513] ? rwlock_bug.part.0+0x90/0x90 + [372.670529] worker_thread+0x59e/0xf90 + [372.676172] ? process_one_work+0x1320/0x1320 + [372.682440] kthread+0x3b9/0x490 + [372.687550] ? _raw_spin_unlock_irq+0x24/0x50 + [372.693811] ? set_kthread_struct+0x100/0x100 + [372.700052] ret_from_fork+0x22/0x30 + [372.705517] + [372.709747] INFO: task btrfs-transacti:2347 blocked for more than 123 seconds. + [372.729827] Not tainted 5.16.0-rc8 #7 + [372.745907] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. + [372.767106] task:btrfs-transacti state:D stack: 0 pid: 2347 ppid: 2 flags:0x00004000 + [372.787776] Call Trace: + [372.801652] + [372.812961] __schedule+0xb56/0x4850 + [372.830011] ? io_schedule_timeout+0x190/0x190 + [372.852547] ? lockdep_hardirqs_on+0x7e/0x100 + [372.871761] ? _raw_spin_unlock_irqrestore+0x3e/0x60 + [372.886792] schedule+0xe0/0x270 + [372.901685] wait_current_trans+0x22c/0x310 [btrfs] + [372.919743] ? btrfs_put_transaction+0x3d0/0x3d0 [btrfs] + [372.938923] ? finish_wait+0x270/0x270 + [372.959085] ? join_transaction+0xc75/0xe30 [btrfs] + [372.977706] start_transaction+0x938/0x10a0 [btrfs] + [372.997168] transaction_kthread+0x19d/0x3c0 [btrfs] + [373.013021] ? btrfs_cleanup_transaction.isra.0+0xfc0/0xfc0 [btrfs] + [373.031678] kthread+0x3b9/0x490 + [373.047420] ? _raw_spin_unlock_irq+0x24/0x50 + [373.064645] ? set_kthread_struct+0x100/0x100 + [373.078571] ret_from_fork+0x22/0x30 + [373.091197] + [373.105611] INFO: task btrfs:3145 blocked for more than 123 seconds. + [373.114147] Not tainted 5.16.0-rc8 #7 + [373.120401] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. + [373.130393] task:btrfs state:D stack: 0 pid: 3145 ppid: 3141 flags:0x00004000 + [373.140998] Call Trace: + [373.145501] + [373.149654] __schedule+0xb56/0x4850 + [373.155306] ? io_schedule_timeout+0x190/0x190 + [373.161965] ? lockdep_hardirqs_on+0x7e/0x100 + [373.168469] ? _raw_spin_unlock_irqrestore+0x3e/0x60 + [373.175468] schedule+0xe0/0x270 + [373.180814] wait_for_commit+0x104/0x150 [btrfs] + [373.187643] ? test_and_set_bit+0x20/0x20 [btrfs] + [373.194772] ? kmem_cache_free+0x124/0x550 + [373.201191] ? btrfs_put_transaction+0x69/0x3d0 [btrfs] + [373.208738] ? finish_wait+0x270/0x270 + [373.214704] ? __btrfs_end_transaction+0x347/0x7b0 [btrfs] + [373.222342] btrfs_commit_transaction+0x44d/0x2610 [btrfs] + [373.230233] ? join_transaction+0x255/0xe30 [btrfs] + [373.237334] ? btrfs_record_root_in_trans+0x4d/0x170 [btrfs] + [373.245251] ? btrfs_apply_pending_changes+0x50/0x50 [btrfs] + [373.253296] relocate_block_group+0x105/0xc20 [btrfs] + [373.260533] ? mutex_lock_io_nested+0x1270/0x1270 + [373.267516] ? btrfs_wait_nocow_writers+0x85/0x180 [btrfs] + [373.275155] ? merge_reloc_roots+0x710/0x710 [btrfs] + [373.283602] ? btrfs_wait_ordered_extents+0xd30/0xd30 [btrfs] + [373.291934] ? kmem_cache_free+0x124/0x550 + [373.298180] btrfs_relocate_block_group+0x35c/0x930 [btrfs] + [373.306047] btrfs_relocate_chunk+0x85/0x210 [btrfs] + [373.313229] btrfs_balance+0x12f4/0x2d20 [btrfs] + [373.320227] ? lock_release+0x3a9/0x6d0 + [373.326206] ? btrfs_relocate_chunk+0x210/0x210 [btrfs] + [373.333591] ? lock_is_held_type+0xe4/0x140 + [373.340031] ? rcu_read_lock_sched_held+0x3f/0x70 + [373.346910] btrfs_ioctl_balance+0x548/0x700 [btrfs] + [373.354207] btrfs_ioctl+0x7f2/0x71b0 [btrfs] + [373.360774] ? lockdep_hardirqs_on_prepare+0x410/0x410 + [373.367957] ? lockdep_hardirqs_on_prepare+0x410/0x410 + [373.375327] ? btrfs_ioctl_get_supported_features+0x20/0x20 [btrfs] + [373.383841] ? find_held_lock+0x2c/0x110 + [373.389993] ? lock_release+0x3a9/0x6d0 + [373.395828] ? mntput_no_expire+0xf7/0xad0 + [373.402083] ? lock_is_held_type+0xe4/0x140 + [373.408249] ? vfs_fileattr_set+0x9f0/0x9f0 + [373.414486] ? selinux_file_ioctl+0x349/0x4e0 + [373.420938] ? trace_raw_output_lock+0xb4/0xe0 + [373.427442] ? selinux_inode_getsecctx+0x80/0x80 + [373.434224] ? lockdep_hardirqs_on+0x7e/0x100 + [373.440660] ? force_qs_rnp+0x2a0/0x6b0 + [373.446534] ? lock_is_held_type+0x9b/0x140 + [373.452763] ? __blkcg_punt_bio_submit+0x1b0/0x1b0 + [373.459732] ? security_file_ioctl+0x50/0x90 + [373.466089] __x64_sys_ioctl+0x127/0x190 + [373.472022] do_syscall_64+0x3b/0x90 + [373.477513] entry_SYSCALL_64_after_hwframe+0x44/0xae + [373.484823] RIP: 0033:0x7f8f4af7e2bb + [373.490493] RSP: 002b:00007ffcbf936178 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 + [373.500197] RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f8f4af7e2bb + [373.509451] RDX: 00007ffcbf936220 RSI: 00000000c4009420 RDI: 0000000000000003 + [373.518659] RBP: 00007ffcbf93774a R08: 0000000000000013 R09: 00007f8f4b02d4e0 + [373.527872] R10: 00007f8f4ae87740 R11: 0000000000000246 R12: 0000000000000001 + [373.537222] R13: 00007ffcbf936220 R14: 0000000000000000 R15: 0000000000000002 + [373.546506] + [373.550878] INFO: task btrfs:3146 blocked for more than 123 seconds. + [373.559383] Not tainted 5.16.0-rc8 #7 + [373.565748] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. + [373.575748] task:btrfs state:D stack: 0 pid: 3146 ppid: 2168 flags:0x00000000 + [373.586314] Call Trace: + [373.590846] + [373.595121] __schedule+0xb56/0x4850 + [373.600901] ? __lock_acquire+0x23db/0x5030 + [373.607176] ? io_schedule_timeout+0x190/0x190 + [373.613954] schedule+0xe0/0x270 + [373.619157] schedule_timeout+0x168/0x220 + [373.625170] ? usleep_range_state+0x150/0x150 + [373.631653] ? mark_held_locks+0x9e/0xe0 + [373.637767] ? do_raw_spin_lock+0x11e/0x250 + [373.643993] ? lockdep_hardirqs_on_prepare+0x17b/0x410 + [373.651267] ? _raw_spin_unlock_irq+0x24/0x50 + [373.657677] ? lockdep_hardirqs_on+0x7e/0x100 + [373.664103] wait_for_completion+0x163/0x250 + [373.670437] ? bit_wait_timeout+0x160/0x160 + [373.676585] btrfs_quota_disable+0x176/0x9a0 [btrfs] + [373.683979] ? btrfs_quota_enable+0x12f0/0x12f0 [btrfs] + [373.691340] ? down_write+0xd0/0x130 + [373.696880] ? down_write_killable+0x150/0x150 + [373.703352] btrfs_ioctl+0x3945/0x71b0 [btrfs] + [373.710061] ? find_held_lock+0x2c/0x110 + [373.716192] ? lock_release+0x3a9/0x6d0 + [373.722047] ? __handle_mm_fault+0x23cd/0x3050 + [373.728486] ? btrfs_ioctl_get_supported_features+0x20/0x20 [btrfs] + [373.737032] ? set_pte+0x6a/0x90 + [373.742271] ? do_raw_spin_unlock+0x55/0x1f0 + [373.748506] ? lock_is_held_type+0xe4/0x140 + [373.754792] ? vfs_fileattr_set+0x9f0/0x9f0 + [373.761083] ? selinux_file_ioctl+0x349/0x4e0 + [373.767521] ? selinux_inode_getsecctx+0x80/0x80 + [373.774247] ? __up_read+0x182/0x6e0 + [373.780026] ? count_memcg_events.constprop.0+0x46/0x60 + [373.787281] ? up_write+0x460/0x460 + [373.792932] ? security_file_ioctl+0x50/0x90 + [373.799232] __x64_sys_ioctl+0x127/0x190 + [373.805237] do_syscall_64+0x3b/0x90 + [373.810947] entry_SYSCALL_64_after_hwframe+0x44/0xae + [373.818102] RIP: 0033:0x7f1383ea02bb + [373.823847] RSP: 002b:00007fffeb4d71f8 EFLAGS: 00000202 ORIG_RAX: 0000000000000010 + [373.833641] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f1383ea02bb + [373.842961] RDX: 00007fffeb4d7210 RSI: 00000000c0109428 RDI: 0000000000000003 + [373.852179] RBP: 0000000000000003 R08: 0000000000000003 R09: 0000000000000078 + [373.861408] R10: 00007f1383daec78 R11: 0000000000000202 R12: 00007fffeb4d874a + [373.870647] R13: 0000000000493099 R14: 0000000000000001 R15: 0000000000000000 + [373.879838] + [373.884018] + Showing all locks held in the system: + [373.894250] 3 locks held by kworker/4:1/58: + [373.900356] 1 lock held by khungtaskd/63: + [373.906333] #0: ffffffff8945ff60 (rcu_read_lock){....}-{1:2}, at: debug_show_all_locks+0x53/0x260 + [373.917307] 3 locks held by kworker/u16:6/103: + [373.923938] #0: ffff888127b4f138 ((wq_completion)btrfs-qgroup-rescan){+.+.}-{0:0}, at: process_one_work+0x712/0x1320 + [373.936555] #1: ffff88810b817dd8 ((work_completion)(&work->normal_work)){+.+.}-{0:0}, at: process_one_work+0x73f/0x1320 + [373.951109] #2: ffff888102dd4650 (sb_internal#2){.+.+}-{0:0}, at: btrfs_qgroup_rescan_worker+0x1f6/0x10c0 [btrfs] + [373.964027] 2 locks held by less/1803: + [373.969982] #0: ffff88813ed56098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x24/0x80 + [373.981295] #1: ffffc90000b3b2e8 (&ldata->atomic_read_lock){+.+.}-{3:3}, at: n_tty_read+0x9e2/0x1060 + [373.992969] 1 lock held by btrfs-transacti/2347: + [373.999893] #0: ffff88813d4887a8 (&fs_info->transaction_kthread_mutex){+.+.}-{3:3}, at: transaction_kthread+0xe3/0x3c0 [btrfs] + [374.015872] 3 locks held by btrfs/3145: + [374.022298] #0: ffff888102dd4460 (sb_writers#18){.+.+}-{0:0}, at: btrfs_ioctl_balance+0xc3/0x700 [btrfs] + [374.034456] #1: ffff88813d48a0a0 (&fs_info->reclaim_bgs_lock){+.+.}-{3:3}, at: btrfs_balance+0xfe5/0x2d20 [btrfs] + [374.047646] #2: ffff88813d488838 (&fs_info->cleaner_mutex){+.+.}-{3:3}, at: btrfs_relocate_block_group+0x354/0x930 [btrfs] + [374.063295] 4 locks held by btrfs/3146: + [374.069647] #0: ffff888102dd4460 (sb_writers#18){.+.+}-{0:0}, at: btrfs_ioctl+0x38b1/0x71b0 [btrfs] + [374.081601] #1: ffff88813d488bb8 (&fs_info->subvol_sem){+.+.}-{3:3}, at: btrfs_ioctl+0x38fd/0x71b0 [btrfs] + [374.094283] #2: ffff888102dd4650 (sb_internal#2){.+.+}-{0:0}, at: btrfs_quota_disable+0xc8/0x9a0 [btrfs] + [374.106885] #3: ffff88813d489800 (&fs_info->qgroup_ioctl_lock){+.+.}-{3:3}, at: btrfs_quota_disable+0xd5/0x9a0 [btrfs] + + [374.126780] ============================================= + +To avoid the deadlock, wait for the qgroup rescan worker to complete +before starting the transaction for the quota disable ioctl. Clear +BTRFS_FS_QUOTA_ENABLE flag before the wait and the transaction to +request the worker to complete. On transaction start failure, set the +BTRFS_FS_QUOTA_ENABLE flag again. These BTRFS_FS_QUOTA_ENABLE flag +changes can be done safely since the function btrfs_quota_disable is not +called concurrently because of fs_info->subvol_sem. + +Also check the BTRFS_FS_QUOTA_ENABLE flag in qgroup_rescan_init to avoid +another qgroup rescan worker to start after the previous qgroup worker +completed. + +CC: stable@vger.kernel.org # 5.4+ +Suggested-by: Nikolay Borisov +Reviewed-by: Filipe Manana +Signed-off-by: Shin'ichiro Kawasaki +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman +--- + fs/btrfs/qgroup.c | 21 +++++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +--- a/fs/btrfs/qgroup.c ++++ b/fs/btrfs/qgroup.c +@@ -1186,9 +1186,24 @@ int btrfs_quota_disable(struct btrfs_fs_ + struct btrfs_trans_handle *trans = NULL; + int ret = 0; + ++ /* ++ * We need to have subvol_sem write locked, to prevent races between ++ * concurrent tasks trying to disable quotas, because we will unlock ++ * and relock qgroup_ioctl_lock across BTRFS_FS_QUOTA_ENABLED changes. ++ */ ++ lockdep_assert_held_write(&fs_info->subvol_sem); ++ + mutex_lock(&fs_info->qgroup_ioctl_lock); + if (!fs_info->quota_root) + goto out; ++ ++ /* ++ * Request qgroup rescan worker to complete and wait for it. This wait ++ * must be done before transaction start for quota disable since it may ++ * deadlock with transaction by the qgroup rescan worker. ++ */ ++ clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); ++ btrfs_qgroup_wait_for_completion(fs_info, false); + mutex_unlock(&fs_info->qgroup_ioctl_lock); + + /* +@@ -1206,14 +1221,13 @@ int btrfs_quota_disable(struct btrfs_fs_ + if (IS_ERR(trans)) { + ret = PTR_ERR(trans); + trans = NULL; ++ set_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); + goto out; + } + + if (!fs_info->quota_root) + goto out; + +- clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); +- btrfs_qgroup_wait_for_completion(fs_info, false); + spin_lock(&fs_info->qgroup_lock); + quota_root = fs_info->quota_root; + fs_info->quota_root = NULL; +@@ -3390,6 +3404,9 @@ qgroup_rescan_init(struct btrfs_fs_info + btrfs_warn(fs_info, + "qgroup rescan init failed, qgroup is not enabled"); + ret = -EINVAL; ++ } else if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) { ++ /* Quota disable is in progress */ ++ ret = -EBUSY; + } + + if (ret) { diff --git a/queue-5.10/dma-buf-heaps-fix-potential-spectre-v1-gadget.patch b/queue-5.10/dma-buf-heaps-fix-potential-spectre-v1-gadget.patch new file mode 100644 index 00000000000..5c10d2685be --- /dev/null +++ b/queue-5.10/dma-buf-heaps-fix-potential-spectre-v1-gadget.patch @@ -0,0 +1,44 @@ +From 92c4cfaee6872038563c5b6f2e8e613f9d84d47d Mon Sep 17 00:00:00 2001 +From: Jordy Zomer +Date: Sat, 29 Jan 2022 16:06:04 +0100 +Subject: dma-buf: heaps: Fix potential spectre v1 gadget + +From: Jordy Zomer + +commit 92c4cfaee6872038563c5b6f2e8e613f9d84d47d upstream. + +It appears like nr could be a Spectre v1 gadget as it's supplied by a +user and used as an array index. Prevent the contents +of kernel memory from being leaked to userspace via speculative +execution by using array_index_nospec. + +Signed-off-by: Jordy Zomer +Fixes: c02a81fba74f ("dma-buf: Add dma-buf heaps framework") +Cc: # v5.6+ +Acked-by: John Stultz +Signed-off-by: Sumit Semwal + [sumits: added fixes and cc: stable tags] +Link: https://patchwork.freedesktop.org/patch/msgid/20220129150604.3461652-1-jordy@pwning.systems +Signed-off-by: Greg Kroah-Hartman +--- + drivers/dma-buf/dma-heap.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/dma-buf/dma-heap.c ++++ b/drivers/dma-buf/dma-heap.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -123,6 +124,7 @@ static long dma_heap_ioctl(struct file * + if (nr >= ARRAY_SIZE(dma_heap_ioctl_cmds)) + return -EINVAL; + ++ nr = array_index_nospec(nr, ARRAY_SIZE(dma_heap_ioctl_cmds)); + /* Get the kernel ioctl cmd that matches */ + kcmd = dma_heap_ioctl_cmds[nr]; + diff --git a/queue-5.10/drm-amd-display-force-link_rate-as-link_rate_rbr2-for-2018-15-apple-retina-panels.patch b/queue-5.10/drm-amd-display-force-link_rate-as-link_rate_rbr2-for-2018-15-apple-retina-panels.patch new file mode 100644 index 00000000000..6b204bb25cf --- /dev/null +++ b/queue-5.10/drm-amd-display-force-link_rate-as-link_rate_rbr2-for-2018-15-apple-retina-panels.patch @@ -0,0 +1,64 @@ +From 30fbce374745a9c6af93c775a5ac49a97f822fda Mon Sep 17 00:00:00 2001 +From: Aun-Ali Zaidi +Date: Sat, 29 Jan 2022 05:49:55 +0000 +Subject: drm/amd/display: Force link_rate as LINK_RATE_RBR2 for 2018 15" Apple Retina panels + +From: Aun-Ali Zaidi + +commit 30fbce374745a9c6af93c775a5ac49a97f822fda upstream. + +The eDP link rate reported by the DP_MAX_LINK_RATE dpcd register (0xa) is +contradictory to the highest rate supported reported by +EDID (0xc = LINK_RATE_RBR2). The effects of this compounded with commit +'4a8ca46bae8a ("drm/amd/display: Default max bpc to 16 for eDP")' results +in no display modes being found and a dark panel. + +For now, simply force the maximum supported link rate for the eDP attached +2018 15" Apple Retina panels. + +Additionally, we must also check the firmware revision since the device ID +reported by the DPCD is identical to that of the more capable 16,1, +incorrectly quirking it. We also use said firmware check to quirk the +refreshed 15,1 models with Vega graphics as they use a slightly newer +firmware version. + +Tested-by: Aun-Ali Zaidi +Reviewed-by: Harry Wentland +Signed-off-by: Aun-Ali Zaidi +Signed-off-by: Aditya Garg +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c ++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +@@ -3587,6 +3587,26 @@ static bool retrieve_link_cap(struct dc_ + dp_hw_fw_revision.ieee_fw_rev, + sizeof(dp_hw_fw_revision.ieee_fw_rev)); + ++ /* Quirk for Apple MBP 2018 15" Retina panels: wrong DP_MAX_LINK_RATE */ ++ { ++ uint8_t str_mbp_2018[] = { 101, 68, 21, 103, 98, 97 }; ++ uint8_t fwrev_mbp_2018[] = { 7, 4 }; ++ uint8_t fwrev_mbp_2018_vega[] = { 8, 4 }; ++ ++ /* We also check for the firmware revision as 16,1 models have an ++ * identical device id and are incorrectly quirked otherwise. ++ */ ++ if ((link->dpcd_caps.sink_dev_id == 0x0010fa) && ++ !memcmp(link->dpcd_caps.sink_dev_id_str, str_mbp_2018, ++ sizeof(str_mbp_2018)) && ++ (!memcmp(link->dpcd_caps.sink_fw_revision, fwrev_mbp_2018, ++ sizeof(fwrev_mbp_2018)) || ++ !memcmp(link->dpcd_caps.sink_fw_revision, fwrev_mbp_2018_vega, ++ sizeof(fwrev_mbp_2018_vega)))) { ++ link->reported_link_cap.link_rate = LINK_RATE_RBR2; ++ } ++ } ++ + memset(&link->dpcd_caps.dsc_caps, '\0', + sizeof(link->dpcd_caps.dsc_caps)); + memset(&link->dpcd_caps.fec_cap, '\0', sizeof(link->dpcd_caps.fec_cap)); diff --git a/queue-5.10/drm-nouveau-fix-off-by-one-in-bios-boundary-checking.patch b/queue-5.10/drm-nouveau-fix-off-by-one-in-bios-boundary-checking.patch new file mode 100644 index 00000000000..7c0f03776fc --- /dev/null +++ b/queue-5.10/drm-nouveau-fix-off-by-one-in-bios-boundary-checking.patch @@ -0,0 +1,42 @@ +From 1b777d4d9e383d2744fc9b3a09af6ec1893c8b1a Mon Sep 17 00:00:00 2001 +From: Nick Lopez +Date: Sat, 22 Jan 2022 01:19:06 -0700 +Subject: drm/nouveau: fix off by one in BIOS boundary checking + +From: Nick Lopez + +commit 1b777d4d9e383d2744fc9b3a09af6ec1893c8b1a upstream. + +Bounds checking when parsing init scripts embedded in the BIOS reject +access to the last byte. This causes driver initialization to fail on +Apple eMac's with GeForce 2 MX GPUs, leaving the system with no working +console. + +This is probably only seen on OpenFirmware machines like PowerPC Macs +because the BIOS image provided by OF is only the used parts of the ROM, +not a power-of-two blocks read from PCI directly so PCs always have +empty bytes at the end that are never accessed. + +Signed-off-by: Nick Lopez +Fixes: 4d4e9907ff572 ("drm/nouveau/bios: guard against out-of-bounds accesses to image") +Cc: # v4.10+ +Reviewed-by: Ilia Mirkin +Reviewed-by: Karol Herbst +Signed-off-by: Karol Herbst +Link: https://patchwork.freedesktop.org/patch/msgid/20220122081906.2633061-1-github@glowingmonkey.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c +@@ -38,7 +38,7 @@ nvbios_addr(struct nvkm_bios *bios, u32 + *addr += bios->imaged_addr; + } + +- if (unlikely(*addr + size >= bios->size)) { ++ if (unlikely(*addr + size > bios->size)) { + nvkm_error(&bios->subdev, "OOB %d %08x %08x\n", size, p, *addr); + return false; + } diff --git a/queue-5.10/ib-hfi1-fix-aip-early-init-panic.patch b/queue-5.10/ib-hfi1-fix-aip-early-init-panic.patch new file mode 100644 index 00000000000..626193c58ce --- /dev/null +++ b/queue-5.10/ib-hfi1-fix-aip-early-init-panic.patch @@ -0,0 +1,123 @@ +From 5f8f55b92edd621f056bdf09e572092849fabd83 Mon Sep 17 00:00:00 2001 +From: Mike Marciniszyn +Date: Sat, 15 Jan 2022 18:02:35 -0500 +Subject: IB/hfi1: Fix AIP early init panic + +From: Mike Marciniszyn + +commit 5f8f55b92edd621f056bdf09e572092849fabd83 upstream. + +An early failure in hfi1_ipoib_setup_rn() can lead to the following panic: + + BUG: unable to handle kernel NULL pointer dereference at 00000000000001b0 + PGD 0 P4D 0 + Oops: 0002 [#1] SMP NOPTI + Workqueue: events work_for_cpu_fn + RIP: 0010:try_to_grab_pending+0x2b/0x140 + Code: 1f 44 00 00 41 55 41 54 55 48 89 d5 53 48 89 fb 9c 58 0f 1f 44 00 00 48 89 c2 fa 66 0f 1f 44 00 00 48 89 55 00 40 84 f6 75 77 48 0f ba 2b 00 72 09 31 c0 5b 5d 41 5c 41 5d c3 48 89 df e8 6c + RSP: 0018:ffffb6b3cf7cfa48 EFLAGS: 00010046 + RAX: 0000000000000246 RBX: 00000000000001b0 RCX: 0000000000000000 + RDX: 0000000000000246 RSI: 0000000000000000 RDI: 00000000000001b0 + RBP: ffffb6b3cf7cfa70 R08: 0000000000000f09 R09: 0000000000000001 + R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000 + R13: ffffb6b3cf7cfa90 R14: ffffffff9b2fbfc0 R15: ffff8a4fdf244690 + FS: 0000000000000000(0000) GS:ffff8a527f400000(0000) knlGS:0000000000000000 + CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 + CR2: 00000000000001b0 CR3: 00000017e2410003 CR4: 00000000007706f0 + DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 + DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 + PKRU: 55555554 + Call Trace: + __cancel_work_timer+0x42/0x190 + ? dev_printk_emit+0x4e/0x70 + iowait_cancel_work+0x15/0x30 [hfi1] + hfi1_ipoib_txreq_deinit+0x5a/0x220 [hfi1] + ? dev_err+0x6c/0x90 + hfi1_ipoib_netdev_dtor+0x15/0x30 [hfi1] + hfi1_ipoib_setup_rn+0x10e/0x150 [hfi1] + rdma_init_netdev+0x5a/0x80 [ib_core] + ? hfi1_ipoib_free_rdma_netdev+0x20/0x20 [hfi1] + ipoib_intf_init+0x6c/0x350 [ib_ipoib] + ipoib_intf_alloc+0x5c/0xc0 [ib_ipoib] + ipoib_add_one+0xbe/0x300 [ib_ipoib] + add_client_context+0x12c/0x1a0 [ib_core] + enable_device_and_get+0xdc/0x1d0 [ib_core] + ib_register_device+0x572/0x6b0 [ib_core] + rvt_register_device+0x11b/0x220 [rdmavt] + hfi1_register_ib_device+0x6b4/0x770 [hfi1] + do_init_one.isra.20+0x3e3/0x680 [hfi1] + local_pci_probe+0x41/0x90 + work_for_cpu_fn+0x16/0x20 + process_one_work+0x1a7/0x360 + ? create_worker+0x1a0/0x1a0 + worker_thread+0x1cf/0x390 + ? create_worker+0x1a0/0x1a0 + kthread+0x116/0x130 + ? kthread_flush_work_fn+0x10/0x10 + ret_from_fork+0x1f/0x40 + +The panic happens in hfi1_ipoib_txreq_deinit() because there is a NULL +deref when hfi1_ipoib_netdev_dtor() is called in this error case. + +hfi1_ipoib_txreq_init() and hfi1_ipoib_rxq_init() are self unwinding so +fix by adjusting the error paths accordingly. + +Other changes: +- hfi1_ipoib_free_rdma_netdev() is deleted including the free_netdev() + since the netdev core code deletes calls free_netdev() +- The switch to the accelerated entrances is moved to the success path. + +Cc: stable@vger.kernel.org +Fixes: d99dc602e2a5 ("IB/hfi1: Add functions to transmit datagram ipoib packets") +Link: https://lore.kernel.org/r/1642287756-182313-4-git-send-email-mike.marciniszyn@cornelisnetworks.com +Reviewed-by: Dennis Dalessandro +Signed-off-by: Mike Marciniszyn +Signed-off-by: Jason Gunthorpe +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/hw/hfi1/ipoib_main.c | 13 +++---------- + 1 file changed, 3 insertions(+), 10 deletions(-) + +--- a/drivers/infiniband/hw/hfi1/ipoib_main.c ++++ b/drivers/infiniband/hw/hfi1/ipoib_main.c +@@ -185,12 +185,6 @@ static void hfi1_ipoib_netdev_dtor(struc + free_percpu(priv->netstats); + } + +-static void hfi1_ipoib_free_rdma_netdev(struct net_device *dev) +-{ +- hfi1_ipoib_netdev_dtor(dev); +- free_netdev(dev); +-} +- + static void hfi1_ipoib_set_id(struct net_device *dev, int id) + { + struct hfi1_ipoib_dev_priv *priv = hfi1_ipoib_priv(dev); +@@ -227,24 +221,23 @@ static int hfi1_ipoib_setup_rn(struct ib + priv->port_num = port_num; + priv->netdev_ops = netdev->netdev_ops; + +- netdev->netdev_ops = &hfi1_ipoib_netdev_ops; +- + ib_query_pkey(device, port_num, priv->pkey_index, &priv->pkey); + + rc = hfi1_ipoib_txreq_init(priv); + if (rc) { + dd_dev_err(dd, "IPoIB netdev TX init - failed(%d)\n", rc); +- hfi1_ipoib_free_rdma_netdev(netdev); + return rc; + } + + rc = hfi1_ipoib_rxq_init(netdev); + if (rc) { + dd_dev_err(dd, "IPoIB netdev RX init - failed(%d)\n", rc); +- hfi1_ipoib_free_rdma_netdev(netdev); ++ hfi1_ipoib_txreq_deinit(priv); + return rc; + } + ++ netdev->netdev_ops = &hfi1_ipoib_netdev_ops; ++ + netdev->priv_destructor = hfi1_ipoib_netdev_dtor; + netdev->needs_free_netdev = true; + diff --git a/queue-5.10/mm-debug_vm_pgtable-remove-pte-entry-from-the-page-table.patch b/queue-5.10/mm-debug_vm_pgtable-remove-pte-entry-from-the-page-table.patch new file mode 100644 index 00000000000..03625354b94 --- /dev/null +++ b/queue-5.10/mm-debug_vm_pgtable-remove-pte-entry-from-the-page-table.patch @@ -0,0 +1,75 @@ +From fb5222aae64fe25e5f3ebefde8214dcf3ba33ca5 Mon Sep 17 00:00:00 2001 +From: Pasha Tatashin +Date: Thu, 3 Feb 2022 20:49:10 -0800 +Subject: mm/debug_vm_pgtable: remove pte entry from the page table + +From: Pasha Tatashin + +commit fb5222aae64fe25e5f3ebefde8214dcf3ba33ca5 upstream. + +Patch series "page table check fixes and cleanups", v5. + +This patch (of 4): + +The pte entry that is used in pte_advanced_tests() is never removed from +the page table at the end of the test. + +The issue is detected by page_table_check, to repro compile kernel with +the following configs: + +CONFIG_DEBUG_VM_PGTABLE=y +CONFIG_PAGE_TABLE_CHECK=y +CONFIG_PAGE_TABLE_CHECK_ENFORCED=y + +During the boot the following BUG is printed: + + debug_vm_pgtable: [debug_vm_pgtable ]: Validating architecture page table helpers + ------------[ cut here ]------------ + kernel BUG at mm/page_table_check.c:162! + invalid opcode: 0000 [#1] PREEMPT SMP PTI + CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.16.0-11413-g2c271fe77d52 #3 + Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014 + ... + +The entry should be properly removed from the page table before the page +is released to the free list. + +Link: https://lkml.kernel.org/r/20220131203249.2832273-1-pasha.tatashin@soleen.com +Link: https://lkml.kernel.org/r/20220131203249.2832273-2-pasha.tatashin@soleen.com +Fixes: a5c3b9ffb0f4 ("mm/debug_vm_pgtable: add tests validating advanced arch page table helpers") +Signed-off-by: Pasha Tatashin +Reviewed-by: Zi Yan +Tested-by: Zi Yan +Acked-by: David Rientjes +Reviewed-by: Anshuman Khandual +Cc: Paul Turner +Cc: Wei Xu +Cc: Greg Thelen +Cc: Ingo Molnar +Cc: Will Deacon +Cc: Mike Rapoport +Cc: Dave Hansen +Cc: H. Peter Anvin +Cc: Aneesh Kumar K.V +Cc: Jiri Slaby +Cc: Muchun Song +Cc: Hugh Dickins +Cc: [5.9+] +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + mm/debug_vm_pgtable.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/mm/debug_vm_pgtable.c ++++ b/mm/debug_vm_pgtable.c +@@ -128,6 +128,8 @@ static void __init pte_advanced_tests(st + ptep_test_and_clear_young(vma, vaddr, ptep); + pte = ptep_get(ptep); + WARN_ON(pte_young(pte)); ++ ++ ptep_get_and_clear_full(args->mm, args->vaddr, args->ptep, 1); + } + + static void __init pte_savedwrite_tests(unsigned long pfn, pgprot_t prot) diff --git a/queue-5.10/mm-kmemleak-avoid-scanning-potential-huge-holes.patch b/queue-5.10/mm-kmemleak-avoid-scanning-potential-huge-holes.patch new file mode 100644 index 00000000000..bd70fc8900f --- /dev/null +++ b/queue-5.10/mm-kmemleak-avoid-scanning-potential-huge-holes.patch @@ -0,0 +1,121 @@ +From c10a0f877fe007021d70f9cada240f42adc2b5db Mon Sep 17 00:00:00 2001 +From: Lang Yu +Date: Thu, 3 Feb 2022 20:49:37 -0800 +Subject: mm/kmemleak: avoid scanning potential huge holes + +From: Lang Yu + +commit c10a0f877fe007021d70f9cada240f42adc2b5db upstream. + +When using devm_request_free_mem_region() and devm_memremap_pages() to +add ZONE_DEVICE memory, if requested free mem region's end pfn were +huge(e.g., 0x400000000), the node_end_pfn() will be also huge (see +move_pfn_range_to_zone()). Thus it creates a huge hole between +node_start_pfn() and node_end_pfn(). + +We found on some AMD APUs, amdkfd requested such a free mem region and +created a huge hole. In such a case, following code snippet was just +doing busy test_bit() looping on the huge hole. + + for (pfn = start_pfn; pfn < end_pfn; pfn++) { + struct page *page = pfn_to_online_page(pfn); + if (!page) + continue; + ... + } + +So we got a soft lockup: + + watchdog: BUG: soft lockup - CPU#6 stuck for 26s! [bash:1221] + CPU: 6 PID: 1221 Comm: bash Not tainted 5.15.0-custom #1 + RIP: 0010:pfn_to_online_page+0x5/0xd0 + Call Trace: + ? kmemleak_scan+0x16a/0x440 + kmemleak_write+0x306/0x3a0 + ? common_file_perm+0x72/0x170 + full_proxy_write+0x5c/0x90 + vfs_write+0xb9/0x260 + ksys_write+0x67/0xe0 + __x64_sys_write+0x1a/0x20 + do_syscall_64+0x3b/0xc0 + entry_SYSCALL_64_after_hwframe+0x44/0xae + +I did some tests with the patch. + +(1) amdgpu module unloaded + +before the patch: + + real 0m0.976s + user 0m0.000s + sys 0m0.968s + +after the patch: + + real 0m0.981s + user 0m0.000s + sys 0m0.973s + +(2) amdgpu module loaded + +before the patch: + + real 0m35.365s + user 0m0.000s + sys 0m35.354s + +after the patch: + + real 0m1.049s + user 0m0.000s + sys 0m1.042s + +Link: https://lkml.kernel.org/r/20211108140029.721144-1-lang.yu@amd.com +Signed-off-by: Lang Yu +Acked-by: David Hildenbrand +Acked-by: Catalin Marinas +Cc: Oscar Salvador +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + mm/kmemleak.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +--- a/mm/kmemleak.c ++++ b/mm/kmemleak.c +@@ -1401,7 +1401,8 @@ static void kmemleak_scan(void) + { + unsigned long flags; + struct kmemleak_object *object; +- int i; ++ struct zone *zone; ++ int __maybe_unused i; + int new_leaks = 0; + + jiffies_last_scan = jiffies; +@@ -1441,9 +1442,9 @@ static void kmemleak_scan(void) + * Struct page scanning for each node. + */ + get_online_mems(); +- for_each_online_node(i) { +- unsigned long start_pfn = node_start_pfn(i); +- unsigned long end_pfn = node_end_pfn(i); ++ for_each_populated_zone(zone) { ++ unsigned long start_pfn = zone->zone_start_pfn; ++ unsigned long end_pfn = zone_end_pfn(zone); + unsigned long pfn; + + for (pfn = start_pfn; pfn < end_pfn; pfn++) { +@@ -1452,8 +1453,8 @@ static void kmemleak_scan(void) + if (!page) + continue; + +- /* only scan pages belonging to this node */ +- if (page_to_nid(page) != i) ++ /* only scan pages belonging to this zone */ ++ if (page_zone(page) != zone) + continue; + /* only scan if page is in use */ + if (page_count(page) == 0) diff --git a/queue-5.10/mm-pgtable-define-pte_index-so-that-preprocessor-could-recognize-it.patch b/queue-5.10/mm-pgtable-define-pte_index-so-that-preprocessor-could-recognize-it.patch new file mode 100644 index 00000000000..a3caa5c3810 --- /dev/null +++ b/queue-5.10/mm-pgtable-define-pte_index-so-that-preprocessor-could-recognize-it.patch @@ -0,0 +1,39 @@ +From 314c459a6fe0957b5885fbc65c53d51444092880 Mon Sep 17 00:00:00 2001 +From: Mike Rapoport +Date: Thu, 3 Feb 2022 20:49:29 -0800 +Subject: mm/pgtable: define pte_index so that preprocessor could recognize it + +From: Mike Rapoport + +commit 314c459a6fe0957b5885fbc65c53d51444092880 upstream. + +Since commit 974b9b2c68f3 ("mm: consolidate pte_index() and +pte_offset_*() definitions") pte_index is a static inline and there is +no define for it that can be recognized by the preprocessor. As a +result, vm_insert_pages() uses slower loop over vm_insert_page() instead +of insert_pages() that amortizes the cost of spinlock operations when +inserting multiple pages. + +Link: https://lkml.kernel.org/r/20220111145457.20748-1-rppt@kernel.org +Fixes: 974b9b2c68f3 ("mm: consolidate pte_index() and pte_offset_*() definitions") +Signed-off-by: Mike Rapoport +Reported-by: Christian Dietrich +Reviewed-by: Khalid Aziz +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/pgtable.h | 1 + + 1 file changed, 1 insertion(+) + +--- a/include/linux/pgtable.h ++++ b/include/linux/pgtable.h +@@ -44,6 +44,7 @@ static inline unsigned long pte_index(un + { + return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + } ++#define pte_index pte_index + + #ifndef pmd_index + static inline unsigned long pmd_index(unsigned long address) diff --git a/queue-5.10/nvme-fabrics-fix-state-check-in-nvmf_ctlr_matches_baseopts.patch b/queue-5.10/nvme-fabrics-fix-state-check-in-nvmf_ctlr_matches_baseopts.patch new file mode 100644 index 00000000000..94a3822c069 --- /dev/null +++ b/queue-5.10/nvme-fabrics-fix-state-check-in-nvmf_ctlr_matches_baseopts.patch @@ -0,0 +1,46 @@ +From 6a51abdeb259a56d95f13cc67e3a0838bcda0377 Mon Sep 17 00:00:00 2001 +From: Uday Shankar +Date: Thu, 20 Jan 2022 12:17:37 -0800 +Subject: nvme-fabrics: fix state check in nvmf_ctlr_matches_baseopts() + +From: Uday Shankar + +commit 6a51abdeb259a56d95f13cc67e3a0838bcda0377 upstream. + +Controller deletion/reset, immediately followed by or concurrent with +a reconnect, is hard failing the connect attempt resulting in a +complete loss of connectivity to the controller. + +In the connect request, fabrics looks for an existing controller with +the same address components and aborts the connect if a controller +already exists and the duplicate connect option isn't set. The match +routine filters out controllers that are dead or dying, so they don't +interfere with the new connect request. + +When NVME_CTRL_DELETING_NOIO was added, it missed updating the state +filters in the nvmf_ctlr_matches_baseopts() routine. Thus, when in this +new state, it's seen as a live controller and fails the connect request. + +Correct by adding the DELETING_NIO state to the match checks. + +Fixes: ecca390e8056 ("nvme: fix deadlock in disconnect during scan_work and/or ana_work") +Cc: # v5.7+ +Signed-off-by: Uday Shankar +Reviewed-by: James Smart +Reviewed-by: Sagi Grimberg +Signed-off-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvme/host/fabrics.h | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/nvme/host/fabrics.h ++++ b/drivers/nvme/host/fabrics.h +@@ -153,6 +153,7 @@ nvmf_ctlr_matches_baseopts(struct nvme_c + struct nvmf_ctrl_options *opts) + { + if (ctrl->state == NVME_CTRL_DELETING || ++ ctrl->state == NVME_CTRL_DELETING_NOIO || + ctrl->state == NVME_CTRL_DEAD || + strcmp(opts->subsysnqn, ctrl->opts->subsysnqn) || + strcmp(opts->host->nqn, ctrl->opts->host->nqn) || diff --git a/queue-5.10/series b/queue-5.10/series index 14d144cca13..55107c3847a 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -1 +1,22 @@ selinux-fix-double-free-of-cond_list-on-error-paths.patch +audit-improve-audit-queue-handling-when-audit-1-on-cmdline.patch +asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_volsw.patch +asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_volsw_sx.patch +asoc-ops-reject-out-of-bounds-values-in-snd_soc_put_xr_sx.patch +alsa-usb-audio-correct-quirk-for-vf0770.patch +alsa-hda-fix-uaf-of-leds-class-devs-at-unbinding.patch +alsa-hda-realtek-fix-race-at-concurrent-coef-updates.patch +alsa-hda-realtek-add-quirk-for-asus-gu603.patch +alsa-hda-realtek-add-missing-fixup-model-entry-for-gigabyte-x570-alc1220-quirks.patch +alsa-hda-realtek-fix-silent-output-on-gigabyte-x570s-aorus-master-newer-chipset.patch +alsa-hda-realtek-fix-silent-output-on-gigabyte-x570-aorus-xtreme-after-reboot-from-windows.patch +btrfs-fix-deadlock-between-quota-disable-and-qgroup-rescan-worker.patch +drm-nouveau-fix-off-by-one-in-bios-boundary-checking.patch +drm-amd-display-force-link_rate-as-link_rate_rbr2-for-2018-15-apple-retina-panels.patch +nvme-fabrics-fix-state-check-in-nvmf_ctlr_matches_baseopts.patch +mm-debug_vm_pgtable-remove-pte-entry-from-the-page-table.patch +mm-pgtable-define-pte_index-so-that-preprocessor-could-recognize-it.patch +mm-kmemleak-avoid-scanning-potential-huge-holes.patch +block-bio-integrity-advance-seed-correctly-for-larger-interval-sizes.patch +dma-buf-heaps-fix-potential-spectre-v1-gadget.patch +ib-hfi1-fix-aip-early-init-panic.patch