]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.17-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Jun 2022 16:13:45 +0000 (18:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Jun 2022 16:13:45 +0000 (18:13 +0200)
added patches:
alsa-usb-audio-add-missing-ep_idx-in-fixed-ep-quirks.patch
alsa-usb-audio-configure-sync-endpoints-before-data.patch
alsa-usb-audio-workaround-for-clock-setup-on-teac-devices.patch
arm-dts-s5pv210-correct-interrupt-name-for-bluetooth-in-aries.patch
bluetooth-hci_qca-use-del_timer_sync-before-freeing.patch
crypto-caam-fix-i.mx6sx-entropy-delay-value.patch
crypto-ecrdsa-fix-incorrect-use-of-vli_cmp.patch
dm-crypt-make-printing-of-the-key-constant-time.patch
dm-integrity-fix-error-code-in-dm_integrity_ctr.patch
dm-stats-add-cond_resched-when-looping-over-entries.patch
dm-verity-set-dm_target_immutable-feature-flag.patch
fs-ntfs3-validate-boot-sectors_per_clusters.patch
hid-multitouch-add-quirks-to-enable-lenovo-x12-trackpoint.patch
hid-multitouch-add-support-for-google-whiskers-touchpad.patch
raid5-introduce-md_broken.patch
tools-memory-model-readme-update-klitmus7-compat-table.patch
zsmalloc-fix-races-between-asynchronous-zspage-free-and-page-migration.patch

18 files changed:
queue-5.17/alsa-usb-audio-add-missing-ep_idx-in-fixed-ep-quirks.patch [new file with mode: 0644]
queue-5.17/alsa-usb-audio-configure-sync-endpoints-before-data.patch [new file with mode: 0644]
queue-5.17/alsa-usb-audio-workaround-for-clock-setup-on-teac-devices.patch [new file with mode: 0644]
queue-5.17/arm-dts-s5pv210-correct-interrupt-name-for-bluetooth-in-aries.patch [new file with mode: 0644]
queue-5.17/bluetooth-hci_qca-use-del_timer_sync-before-freeing.patch [new file with mode: 0644]
queue-5.17/crypto-caam-fix-i.mx6sx-entropy-delay-value.patch [new file with mode: 0644]
queue-5.17/crypto-ecrdsa-fix-incorrect-use-of-vli_cmp.patch [new file with mode: 0644]
queue-5.17/dm-crypt-make-printing-of-the-key-constant-time.patch [new file with mode: 0644]
queue-5.17/dm-integrity-fix-error-code-in-dm_integrity_ctr.patch [new file with mode: 0644]
queue-5.17/dm-stats-add-cond_resched-when-looping-over-entries.patch [new file with mode: 0644]
queue-5.17/dm-verity-set-dm_target_immutable-feature-flag.patch [new file with mode: 0644]
queue-5.17/fs-ntfs3-validate-boot-sectors_per_clusters.patch [new file with mode: 0644]
queue-5.17/hid-multitouch-add-quirks-to-enable-lenovo-x12-trackpoint.patch [new file with mode: 0644]
queue-5.17/hid-multitouch-add-support-for-google-whiskers-touchpad.patch [new file with mode: 0644]
queue-5.17/raid5-introduce-md_broken.patch [new file with mode: 0644]
queue-5.17/series
queue-5.17/tools-memory-model-readme-update-klitmus7-compat-table.patch [new file with mode: 0644]
queue-5.17/zsmalloc-fix-races-between-asynchronous-zspage-free-and-page-migration.patch [new file with mode: 0644]

diff --git a/queue-5.17/alsa-usb-audio-add-missing-ep_idx-in-fixed-ep-quirks.patch b/queue-5.17/alsa-usb-audio-add-missing-ep_idx-in-fixed-ep-quirks.patch
new file mode 100644 (file)
index 0000000..8c0df69
--- /dev/null
@@ -0,0 +1,56 @@
+From 7b0efea4baf02f5e2f89e5f9b75ef891571b45f1 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Sat, 21 May 2022 08:53:25 +0200
+Subject: ALSA: usb-audio: Add missing ep_idx in fixed EP quirks
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 7b0efea4baf02f5e2f89e5f9b75ef891571b45f1 upstream.
+
+The quirk entry for Focusrite Saffire 6 had no proper ep_idx for the
+capture endpoint, and this confused the driver, resulting in the
+broken sound.  This patch adds the missing ep_idx in the entry.
+
+While we are at it, a couple of other entries (for Digidesign MBox and
+MOTU MicroBook II) seem to have the same problem, and those are
+covered as well.
+
+Fixes: bf6313a0ff76 ("ALSA: usb-audio: Refactor endpoint management")
+Reported-by: André Kapelrud <a.kapelrud@gmail.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20220521065325.426-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/usb/quirks-table.h |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/sound/usb/quirks-table.h
++++ b/sound/usb/quirks-table.h
+@@ -2672,6 +2672,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
+                                       .altset_idx = 1,
+                                       .attributes = 0,
+                                       .endpoint = 0x82,
++                                      .ep_idx = 1,
+                                       .ep_attr = USB_ENDPOINT_XFER_ISOC,
+                                       .datainterval = 1,
+                                       .maxpacksize = 0x0126,
+@@ -2875,6 +2876,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
+                                       .altset_idx = 1,
+                                       .attributes = 0x4,
+                                       .endpoint = 0x81,
++                                      .ep_idx = 1,
+                                       .ep_attr = USB_ENDPOINT_XFER_ISOC |
+                                               USB_ENDPOINT_SYNC_ASYNC,
+                                       .maxpacksize = 0x130,
+@@ -3391,6 +3393,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
+                                       .altset_idx = 1,
+                                       .attributes = 0,
+                                       .endpoint = 0x03,
++                                      .ep_idx = 1,
+                                       .rates = SNDRV_PCM_RATE_96000,
+                                       .ep_attr = USB_ENDPOINT_XFER_ISOC |
+                                                  USB_ENDPOINT_SYNC_ASYNC,
diff --git a/queue-5.17/alsa-usb-audio-configure-sync-endpoints-before-data.patch b/queue-5.17/alsa-usb-audio-configure-sync-endpoints-before-data.patch
new file mode 100644 (file)
index 0000000..071558d
--- /dev/null
@@ -0,0 +1,58 @@
+From 0e85a22d01dfe9ad9a9d9e87cd4a88acce1aad65 Mon Sep 17 00:00:00 2001
+From: Craig McLure <craig@mclure.net>
+Date: Tue, 24 May 2022 08:21:15 +0200
+Subject: ALSA: usb-audio: Configure sync endpoints before data
+
+From: Craig McLure <craig@mclure.net>
+
+commit 0e85a22d01dfe9ad9a9d9e87cd4a88acce1aad65 upstream.
+
+Devices such as the TC-Helicon GoXLR require the sync endpoint to be
+configured in advance of the data endpoint in order for sound output
+to work.
+
+This patch simply changes the ordering of EP configuration to resolve
+this.
+
+Fixes: bf6313a0ff76 ("ALSA: usb-audio: Refactor endpoint management")
+BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215079
+Signed-off-by: Craig McLure <craig@mclure.net>
+Reviewed-by: Jaroslav Kysela <perex@perex.cz>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20220524062115.25968-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/usb/pcm.c |   17 +++++++++++------
+ 1 file changed, 11 insertions(+), 6 deletions(-)
+
+--- a/sound/usb/pcm.c
++++ b/sound/usb/pcm.c
+@@ -439,16 +439,21 @@ static int configure_endpoints(struct sn
+               /* stop any running stream beforehand */
+               if (stop_endpoints(subs, false))
+                       sync_pending_stops(subs);
++              if (subs->sync_endpoint) {
++                      err = snd_usb_endpoint_configure(chip, subs->sync_endpoint);
++                      if (err < 0)
++                              return err;
++              }
+               err = snd_usb_endpoint_configure(chip, subs->data_endpoint);
+               if (err < 0)
+                       return err;
+               snd_usb_set_format_quirk(subs, subs->cur_audiofmt);
+-      }
+-
+-      if (subs->sync_endpoint) {
+-              err = snd_usb_endpoint_configure(chip, subs->sync_endpoint);
+-              if (err < 0)
+-                      return err;
++      } else {
++              if (subs->sync_endpoint) {
++                      err = snd_usb_endpoint_configure(chip, subs->sync_endpoint);
++                      if (err < 0)
++                              return err;
++              }
+       }
+       return 0;
diff --git a/queue-5.17/alsa-usb-audio-workaround-for-clock-setup-on-teac-devices.patch b/queue-5.17/alsa-usb-audio-workaround-for-clock-setup-on-teac-devices.patch
new file mode 100644 (file)
index 0000000..7c8e667
--- /dev/null
@@ -0,0 +1,55 @@
+From 5ce0b06ae5e69e23142e73c5c3c0260e9f2ccb4b Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Sat, 21 May 2022 08:46:27 +0200
+Subject: ALSA: usb-audio: Workaround for clock setup on TEAC devices
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 5ce0b06ae5e69e23142e73c5c3c0260e9f2ccb4b upstream.
+
+Maris reported that TEAC UD-501 (0644:8043) doesn't work with the
+typical "clock source 41 is not valid, cannot use" errors on the
+recent kernels.  The currently known workaround so far is to restore
+(partially) what we've done unconditionally at the clock setup;
+namely, re-setup the USB interface immediately after the clock is
+changed.  This patch re-introduces the behavior conditionally for TEAC
+devices.
+
+Further notes:
+- The USB interface shall be set later in
+  snd_usb_endpoint_configure(), but this seems to be too late.
+- Even calling  usb_set_interface() right after
+  sne_usb_init_sample_rate() doesn't help; so this must be related
+  with the clock validation, too.
+- The device may still spew the "clock source 41 is not valid" error
+  at the first clock setup.  This seems happening at the very first
+  try of clock setup, but it disappears at later attempts.
+  The error is likely harmless because the driver retries the clock
+  setup (such an error is more or less expected on some devices).
+
+Fixes: bf6313a0ff76 ("ALSA: usb-audio: Refactor endpoint management")
+Reported-and-tested-by: Maris Abele <maris7abele@gmail.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20220521064627.29292-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/usb/clock.c |    7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/sound/usb/clock.c
++++ b/sound/usb/clock.c
+@@ -572,6 +572,13 @@ static int set_sample_rate_v2v3(struct s
+               /* continue processing */
+       }
++      /* FIXME - TEAC devices require the immediate interface setup */
++      if (rate != prev_rate && USB_ID_VENDOR(chip->usb_id) == 0x0644) {
++              usb_set_interface(chip->dev, fmt->iface, fmt->altsetting);
++              if (chip->quirk_flags & QUIRK_FLAG_IFACE_DELAY)
++                      msleep(50);
++      }
++
+ validation:
+       /* validate clock after rate change */
+       if (!uac_clock_source_is_valid(chip, fmt, clock))
diff --git a/queue-5.17/arm-dts-s5pv210-correct-interrupt-name-for-bluetooth-in-aries.patch b/queue-5.17/arm-dts-s5pv210-correct-interrupt-name-for-bluetooth-in-aries.patch
new file mode 100644 (file)
index 0000000..5207e75
--- /dev/null
@@ -0,0 +1,33 @@
+From 3f5e3d3a8b895c8a11da8b0063ba2022dd9e2045 Mon Sep 17 00:00:00 2001
+From: Jonathan Bakker <xc-racer2@live.ca>
+Date: Sun, 27 Mar 2022 11:08:51 -0700
+Subject: ARM: dts: s5pv210: Correct interrupt name for bluetooth in Aries
+
+From: Jonathan Bakker <xc-racer2@live.ca>
+
+commit 3f5e3d3a8b895c8a11da8b0063ba2022dd9e2045 upstream.
+
+Correct the name of the bluetooth interrupt from host-wake to
+host-wakeup.
+
+Fixes: 1c65b6184441b ("ARM: dts: s5pv210: Correct BCM4329 bluetooth node")
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
+Link: https://lore.kernel.org/r/CY4PR04MB0567495CFCBDC8D408D44199CB1C9@CY4PR04MB0567.namprd04.prod.outlook.com
+Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/arm/boot/dts/s5pv210-aries.dtsi |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm/boot/dts/s5pv210-aries.dtsi
++++ b/arch/arm/boot/dts/s5pv210-aries.dtsi
+@@ -895,7 +895,7 @@
+               device-wakeup-gpios = <&gpg3 4 GPIO_ACTIVE_HIGH>;
+               interrupt-parent = <&gph2>;
+               interrupts = <5 IRQ_TYPE_LEVEL_HIGH>;
+-              interrupt-names = "host-wake";
++              interrupt-names = "host-wakeup";
+       };
+ };
diff --git a/queue-5.17/bluetooth-hci_qca-use-del_timer_sync-before-freeing.patch b/queue-5.17/bluetooth-hci_qca-use-del_timer_sync-before-freeing.patch
new file mode 100644 (file)
index 0000000..6a54779
--- /dev/null
@@ -0,0 +1,44 @@
+From 72ef98445aca568a81c2da050532500a8345ad3a Mon Sep 17 00:00:00 2001
+From: Steven Rostedt <rostedt@goodmis.org>
+Date: Tue, 5 Apr 2022 10:02:00 -0400
+Subject: Bluetooth: hci_qca: Use del_timer_sync() before freeing
+
+From: Steven Rostedt <rostedt@goodmis.org>
+
+commit 72ef98445aca568a81c2da050532500a8345ad3a upstream.
+
+While looking at a crash report on a timer list being corrupted, which
+usually happens when a timer is freed while still active. This is
+commonly triggered by code calling del_timer() instead of
+del_timer_sync() just before freeing.
+
+One possible culprit is the hci_qca driver, which does exactly that.
+
+Eric mentioned that wake_retrans_timer could be rearmed via the work
+queue, so also move the destruction of the work queue before
+del_timer_sync().
+
+Cc: Eric Dumazet <eric.dumazet@gmail.com>
+Cc: stable@vger.kernel.org
+Fixes: 0ff252c1976da ("Bluetooth: hciuart: Add support QCA chipset for UART")
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/bluetooth/hci_qca.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/bluetooth/hci_qca.c
++++ b/drivers/bluetooth/hci_qca.c
+@@ -696,9 +696,9 @@ static int qca_close(struct hci_uart *hu
+       skb_queue_purge(&qca->tx_wait_q);
+       skb_queue_purge(&qca->txq);
+       skb_queue_purge(&qca->rx_memdump_q);
+-      del_timer(&qca->tx_idle_timer);
+-      del_timer(&qca->wake_retrans_timer);
+       destroy_workqueue(qca->workqueue);
++      del_timer_sync(&qca->tx_idle_timer);
++      del_timer_sync(&qca->wake_retrans_timer);
+       qca->hu = NULL;
+       kfree_skb(qca->rx_skb);
diff --git a/queue-5.17/crypto-caam-fix-i.mx6sx-entropy-delay-value.patch b/queue-5.17/crypto-caam-fix-i.mx6sx-entropy-delay-value.patch
new file mode 100644 (file)
index 0000000..b98b61e
--- /dev/null
@@ -0,0 +1,85 @@
+From 4ee4cdad368a26de3967f2975806a9ee2fa245df Mon Sep 17 00:00:00 2001
+From: Fabio Estevam <festevam@denx.de>
+Date: Wed, 20 Apr 2022 09:06:01 -0300
+Subject: crypto: caam - fix i.MX6SX entropy delay value
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Fabio Estevam <festevam@denx.de>
+
+commit 4ee4cdad368a26de3967f2975806a9ee2fa245df upstream.
+
+Since commit 358ba762d9f1 ("crypto: caam - enable prediction resistance
+in HRWNG") the following CAAM errors can be seen on i.MX6SX:
+
+caam_jr 2101000.jr: 20003c5b: CCB: desc idx 60: RNG: Hardware error
+hwrng: no data available
+
+This error is due to an incorrect entropy delay for i.MX6SX.
+
+Fix it by increasing the minimum entropy delay for i.MX6SX
+as done in U-Boot:
+https://patchwork.ozlabs.org/project/uboot/patch/20220415111049.2565744-1-gaurav.jain@nxp.com/
+
+As explained in the U-Boot patch:
+
+"RNG self tests are run to determine the correct entropy delay.
+Such tests are executed with different voltages and temperatures to identify
+the worst case value for the entropy delay. For i.MX6SX, it was determined
+that after adding a margin value of 1000 the minimum entropy delay should be
+at least 12000."
+
+Cc: <stable@vger.kernel.org>
+Fixes: 358ba762d9f1 ("crypto: caam - enable prediction resistance in HRWNG")
+Signed-off-by: Fabio Estevam <festevam@denx.de>
+Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
+Reviewed-by: Vabhav Sharma <vabhav.sharma@nxp.com>
+Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/crypto/caam/ctrl.c |   18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+--- a/drivers/crypto/caam/ctrl.c
++++ b/drivers/crypto/caam/ctrl.c
+@@ -609,6 +609,13 @@ static bool check_version(struct fsl_mc_
+ }
+ #endif
++static bool needs_entropy_delay_adjustment(void)
++{
++      if (of_machine_is_compatible("fsl,imx6sx"))
++              return true;
++      return false;
++}
++
+ /* Probe routine for CAAM top (controller) level */
+ static int caam_probe(struct platform_device *pdev)
+ {
+@@ -855,6 +862,8 @@ static int caam_probe(struct platform_de
+                        * Also, if a handle was instantiated, do not change
+                        * the TRNG parameters.
+                        */
++                      if (needs_entropy_delay_adjustment())
++                              ent_delay = 12000;
+                       if (!(ctrlpriv->rng4_sh_init || inst_handles)) {
+                               dev_info(dev,
+                                        "Entropy delay = %u\n",
+@@ -871,6 +880,15 @@ static int caam_probe(struct platform_de
+                        */
+                       ret = instantiate_rng(dev, inst_handles,
+                                             gen_sk);
++                      /*
++                       * Entropy delay is determined via TRNG characterization.
++                       * TRNG characterization is run across different voltages
++                       * and temperatures.
++                       * If worst case value for ent_dly is identified,
++                       * the loop can be skipped for that platform.
++                       */
++                      if (needs_entropy_delay_adjustment())
++                              break;
+                       if (ret == -EAGAIN)
+                               /*
+                                * if here, the loop will rerun,
diff --git a/queue-5.17/crypto-ecrdsa-fix-incorrect-use-of-vli_cmp.patch b/queue-5.17/crypto-ecrdsa-fix-incorrect-use-of-vli_cmp.patch
new file mode 100644 (file)
index 0000000..8b8ec0a
--- /dev/null
@@ -0,0 +1,51 @@
+From 7cc7ab73f83ee6d50dc9536bc3355495d8600fad Mon Sep 17 00:00:00 2001
+From: Vitaly Chikunov <vt@altlinux.org>
+Date: Thu, 21 Apr 2022 20:25:10 +0300
+Subject: crypto: ecrdsa - Fix incorrect use of vli_cmp
+
+From: Vitaly Chikunov <vt@altlinux.org>
+
+commit 7cc7ab73f83ee6d50dc9536bc3355495d8600fad upstream.
+
+Correctly compare values that shall be greater-or-equal and not just
+greater.
+
+Fixes: 0d7a78643f69 ("crypto: ecrdsa - add EC-RDSA (GOST 34.10) algorithm")
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ crypto/ecrdsa.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/crypto/ecrdsa.c
++++ b/crypto/ecrdsa.c
+@@ -113,15 +113,15 @@ static int ecrdsa_verify(struct akcipher
+       /* Step 1: verify that 0 < r < q, 0 < s < q */
+       if (vli_is_zero(r, ndigits) ||
+-          vli_cmp(r, ctx->curve->n, ndigits) == 1 ||
++          vli_cmp(r, ctx->curve->n, ndigits) >= 0 ||
+           vli_is_zero(s, ndigits) ||
+-          vli_cmp(s, ctx->curve->n, ndigits) == 1)
++          vli_cmp(s, ctx->curve->n, ndigits) >= 0)
+               return -EKEYREJECTED;
+       /* Step 2: calculate hash (h) of the message (passed as input) */
+       /* Step 3: calculate e = h \mod q */
+       vli_from_le64(e, digest, ndigits);
+-      if (vli_cmp(e, ctx->curve->n, ndigits) == 1)
++      if (vli_cmp(e, ctx->curve->n, ndigits) >= 0)
+               vli_sub(e, e, ctx->curve->n, ndigits);
+       if (vli_is_zero(e, ndigits))
+               e[0] = 1;
+@@ -137,7 +137,7 @@ static int ecrdsa_verify(struct akcipher
+       /* Step 6: calculate point C = z_1P + z_2Q, and R = x_c \mod q */
+       ecc_point_mult_shamir(&cc, z1, &ctx->curve->g, z2, &ctx->pub_key,
+                             ctx->curve);
+-      if (vli_cmp(cc.x, ctx->curve->n, ndigits) == 1)
++      if (vli_cmp(cc.x, ctx->curve->n, ndigits) >= 0)
+               vli_sub(cc.x, cc.x, ctx->curve->n, ndigits);
+       /* Step 7: if R == r signature is valid */
diff --git a/queue-5.17/dm-crypt-make-printing-of-the-key-constant-time.patch b/queue-5.17/dm-crypt-make-printing-of-the-key-constant-time.patch
new file mode 100644 (file)
index 0000000..ce82327
--- /dev/null
@@ -0,0 +1,58 @@
+From 567dd8f34560fa221a6343729474536aa7ede4fd Mon Sep 17 00:00:00 2001
+From: Mikulas Patocka <mpatocka@redhat.com>
+Date: Mon, 25 Apr 2022 08:53:29 -0400
+Subject: dm crypt: make printing of the key constant-time
+
+From: Mikulas Patocka <mpatocka@redhat.com>
+
+commit 567dd8f34560fa221a6343729474536aa7ede4fd upstream.
+
+The device mapper dm-crypt target is using scnprintf("%02x", cc->key[i]) to
+report the current key to userspace. However, this is not a constant-time
+operation and it may leak information about the key via timing, via cache
+access patterns or via the branch predictor.
+
+Change dm-crypt's key printing to use "%c" instead of "%02x". Also
+introduce hex2asc() that carefully avoids any branching or memory
+accesses when converting a number in the range 0 ... 15 to an ascii
+character.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
+Tested-by: Milan Broz <gmazyland@gmail.com>
+Signed-off-by: Mike Snitzer <snitzer@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/dm-crypt.c |   14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+--- a/drivers/md/dm-crypt.c
++++ b/drivers/md/dm-crypt.c
+@@ -3449,6 +3449,11 @@ static int crypt_map(struct dm_target *t
+       return DM_MAPIO_SUBMITTED;
+ }
++static char hex2asc(unsigned char c)
++{
++      return c + '0' + ((unsigned)(9 - c) >> 4 & 0x27);
++}
++
+ static void crypt_status(struct dm_target *ti, status_type_t type,
+                        unsigned status_flags, char *result, unsigned maxlen)
+ {
+@@ -3467,9 +3472,12 @@ static void crypt_status(struct dm_targe
+               if (cc->key_size > 0) {
+                       if (cc->key_string)
+                               DMEMIT(":%u:%s", cc->key_size, cc->key_string);
+-                      else
+-                              for (i = 0; i < cc->key_size; i++)
+-                                      DMEMIT("%02x", cc->key[i]);
++                      else {
++                              for (i = 0; i < cc->key_size; i++) {
++                                      DMEMIT("%c%c", hex2asc(cc->key[i] >> 4),
++                                             hex2asc(cc->key[i] & 0xf));
++                              }
++                      }
+               } else
+                       DMEMIT("-");
diff --git a/queue-5.17/dm-integrity-fix-error-code-in-dm_integrity_ctr.patch b/queue-5.17/dm-integrity-fix-error-code-in-dm_integrity_ctr.patch
new file mode 100644 (file)
index 0000000..1da6319
--- /dev/null
@@ -0,0 +1,37 @@
+From d3f2a14b8906df913cb04a706367b012db94a6e8 Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Mon, 25 Apr 2022 14:56:48 +0300
+Subject: dm integrity: fix error code in dm_integrity_ctr()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+commit d3f2a14b8906df913cb04a706367b012db94a6e8 upstream.
+
+The "r" variable shadows an earlier "r" that has function scope.  It
+means that we accidentally return success instead of an error code.
+Smatch has a warning for this:
+
+       drivers/md/dm-integrity.c:4503 dm_integrity_ctr()
+       warn: missing error code 'r'
+
+Fixes: 7eada909bfd7 ("dm: add integrity target")
+Cc: stable@vger.kernel.org
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
+Signed-off-by: Mike Snitzer <snitzer@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/dm-integrity.c |    2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/drivers/md/dm-integrity.c
++++ b/drivers/md/dm-integrity.c
+@@ -4495,8 +4495,6 @@ try_smaller_buffer:
+       }
+       if (should_write_sb) {
+-              int r;
+-
+               init_journal(ic, 0, ic->journal_sections, 0);
+               r = dm_integrity_failed(ic);
+               if (unlikely(r)) {
diff --git a/queue-5.17/dm-stats-add-cond_resched-when-looping-over-entries.patch b/queue-5.17/dm-stats-add-cond_resched-when-looping-over-entries.patch
new file mode 100644 (file)
index 0000000..d0144d5
--- /dev/null
@@ -0,0 +1,80 @@
+From bfe2b0146c4d0230b68f5c71a64380ff8d361f8b Mon Sep 17 00:00:00 2001
+From: Mikulas Patocka <mpatocka@redhat.com>
+Date: Sun, 24 Apr 2022 16:43:00 -0400
+Subject: dm stats: add cond_resched when looping over entries
+
+From: Mikulas Patocka <mpatocka@redhat.com>
+
+commit bfe2b0146c4d0230b68f5c71a64380ff8d361f8b upstream.
+
+dm-stats can be used with a very large number of entries (it is only
+limited by 1/4 of total system memory), so add rescheduling points to
+the loops that iterate over the entries.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
+Signed-off-by: Mike Snitzer <snitzer@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/dm-stats.c |    8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/md/dm-stats.c
++++ b/drivers/md/dm-stats.c
+@@ -225,6 +225,7 @@ void dm_stats_cleanup(struct dm_stats *s
+                                      atomic_read(&shared->in_flight[READ]),
+                                      atomic_read(&shared->in_flight[WRITE]));
+                       }
++                      cond_resched();
+               }
+               dm_stat_free(&s->rcu_head);
+       }
+@@ -330,6 +331,7 @@ static int dm_stats_create(struct dm_sta
+       for (ni = 0; ni < n_entries; ni++) {
+               atomic_set(&s->stat_shared[ni].in_flight[READ], 0);
+               atomic_set(&s->stat_shared[ni].in_flight[WRITE], 0);
++              cond_resched();
+       }
+       if (s->n_histogram_entries) {
+@@ -342,6 +344,7 @@ static int dm_stats_create(struct dm_sta
+               for (ni = 0; ni < n_entries; ni++) {
+                       s->stat_shared[ni].tmp.histogram = hi;
+                       hi += s->n_histogram_entries + 1;
++                      cond_resched();
+               }
+       }
+@@ -362,6 +365,7 @@ static int dm_stats_create(struct dm_sta
+                       for (ni = 0; ni < n_entries; ni++) {
+                               p[ni].histogram = hi;
+                               hi += s->n_histogram_entries + 1;
++                              cond_resched();
+                       }
+               }
+       }
+@@ -497,6 +501,7 @@ static int dm_stats_list(struct dm_stats
+                       }
+                       DMEMIT("\n");
+               }
++              cond_resched();
+       }
+       mutex_unlock(&stats->mutex);
+@@ -774,6 +779,7 @@ static void __dm_stat_clear(struct dm_st
+                               local_irq_enable();
+                       }
+               }
++              cond_resched();
+       }
+ }
+@@ -889,6 +895,8 @@ static int dm_stats_print(struct dm_stat
+               if (unlikely(sz + 1 >= maxlen))
+                       goto buffer_overflow;
++
++              cond_resched();
+       }
+       if (clear)
diff --git a/queue-5.17/dm-verity-set-dm_target_immutable-feature-flag.patch b/queue-5.17/dm-verity-set-dm_target_immutable-feature-flag.patch
new file mode 100644 (file)
index 0000000..d75985b
--- /dev/null
@@ -0,0 +1,35 @@
+From 4caae58406f8ceb741603eee460d79bacca9b1b5 Mon Sep 17 00:00:00 2001
+From: Sarthak Kukreti <sarthakkukreti@google.com>
+Date: Tue, 31 May 2022 15:56:40 -0400
+Subject: dm verity: set DM_TARGET_IMMUTABLE feature flag
+
+From: Sarthak Kukreti <sarthakkukreti@google.com>
+
+commit 4caae58406f8ceb741603eee460d79bacca9b1b5 upstream.
+
+The device-mapper framework provides a mechanism to mark targets as
+immutable (and hence fail table reloads that try to change the target
+type). Add the DM_TARGET_IMMUTABLE flag to the dm-verity target's
+feature flags to prevent switching the verity target with a different
+target type.
+
+Fixes: a4ffc152198e ("dm: add verity target")
+Cc: stable@vger.kernel.org
+Signed-off-by: Sarthak Kukreti <sarthakkukreti@google.com>
+Reviewed-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Mike Snitzer <snitzer@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/dm-verity-target.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/md/dm-verity-target.c
++++ b/drivers/md/dm-verity-target.c
+@@ -1312,6 +1312,7 @@ bad:
+ static struct target_type verity_target = {
+       .name           = "verity",
++      .features       = DM_TARGET_IMMUTABLE,
+       .version        = {1, 8, 0},
+       .module         = THIS_MODULE,
+       .ctr            = verity_ctr,
diff --git a/queue-5.17/fs-ntfs3-validate-boot-sectors_per_clusters.patch b/queue-5.17/fs-ntfs3-validate-boot-sectors_per_clusters.patch
new file mode 100644 (file)
index 0000000..fa3728c
--- /dev/null
@@ -0,0 +1,63 @@
+From a3b774342fa752a5290c0de36375289dfcf4a260 Mon Sep 17 00:00:00 2001
+From: Randy Dunlap <rdunlap@infradead.org>
+Date: Thu, 12 May 2022 20:38:37 -0700
+Subject: fs/ntfs3: validate BOOT sectors_per_clusters
+
+From: Randy Dunlap <rdunlap@infradead.org>
+
+commit a3b774342fa752a5290c0de36375289dfcf4a260 upstream.
+
+When the NTFS BOOT sectors_per_clusters field is > 0x80, it represents a
+shift value.  Make sure that the shift value is not too large before using
+it (NTFS max cluster size is 2MB).  Return -EVINVAL if it too large.
+
+This prevents negative shift values and shift values that are larger than
+the field size.
+
+Prevents this UBSAN error:
+
+ UBSAN: shift-out-of-bounds in ../fs/ntfs3/super.c:673:16
+ shift exponent -192 is negative
+
+Link: https://lkml.kernel.org/r/20220502175342.20296-1-rdunlap@infradead.org
+Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
+Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
+Reported-by: syzbot+1631f09646bc214d2e76@syzkaller.appspotmail.com
+Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
+Cc: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Cc: Alexander Viro <viro@zeniv.linux.org.uk>
+Cc: Kari Argillander <kari.argillander@stargateuniverse.net>
+Cc: Namjae Jeon <linkinjeon@kernel.org>
+Cc: Matthew Wilcox <willy@infradead.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ntfs3/super.c |   10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+--- a/fs/ntfs3/super.c
++++ b/fs/ntfs3/super.c
+@@ -668,9 +668,11 @@ static u32 format_size_gb(const u64 byte
+ static u32 true_sectors_per_clst(const struct NTFS_BOOT *boot)
+ {
+-      return boot->sectors_per_clusters <= 0x80
+-                     ? boot->sectors_per_clusters
+-                     : (1u << (0 - boot->sectors_per_clusters));
++      if (boot->sectors_per_clusters <= 0x80)
++              return boot->sectors_per_clusters;
++      if (boot->sectors_per_clusters >= 0xf4) /* limit shift to 2MB max */
++              return 1U << (0 - boot->sectors_per_clusters);
++      return -EINVAL;
+ }
+ /*
+@@ -713,6 +715,8 @@ static int ntfs_init_from_boot(struct su
+       /* cluster size: 512, 1K, 2K, 4K, ... 2M */
+       sct_per_clst = true_sectors_per_clst(boot);
++      if ((int)sct_per_clst < 0)
++              goto out;
+       if (!is_power_of_2(sct_per_clst))
+               goto out;
diff --git a/queue-5.17/hid-multitouch-add-quirks-to-enable-lenovo-x12-trackpoint.patch b/queue-5.17/hid-multitouch-add-quirks-to-enable-lenovo-x12-trackpoint.patch
new file mode 100644 (file)
index 0000000..d90aeed
--- /dev/null
@@ -0,0 +1,50 @@
+From 95cd2cdc88c755dcd0a58b951faeb77742c733a4 Mon Sep 17 00:00:00 2001
+From: Tao Jin <tao-j@outlook.com>
+Date: Sun, 3 Apr 2022 12:57:44 -0400
+Subject: HID: multitouch: add quirks to enable Lenovo X12 trackpoint
+
+From: Tao Jin <tao-j@outlook.com>
+
+commit 95cd2cdc88c755dcd0a58b951faeb77742c733a4 upstream.
+
+This applies the similar quirks used by previous generation devices
+such as X1 tablet for X12 tablet, so that the trackpoint and buttons
+can work.
+
+This patch was applied and tested working on 5.17.1 .
+
+Cc: stable@vger.kernel.org # 5.8+ given that it relies on 40d5bb87377a
+Signed-off-by: Tao Jin <tao-j@outlook.com>
+Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+Link: https://lore.kernel.org/r/CO6PR03MB6241CB276FCDC7F4CEDC34F6E1E29@CO6PR03MB6241.namprd03.prod.outlook.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/hid/hid-ids.h        |    1 +
+ drivers/hid/hid-multitouch.c |    6 ++++++
+ 2 files changed, 7 insertions(+)
+
+--- a/drivers/hid/hid-ids.h
++++ b/drivers/hid/hid-ids.h
+@@ -760,6 +760,7 @@
+ #define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085
+ #define USB_DEVICE_ID_LENOVO_X1_TAB   0x60a3
+ #define USB_DEVICE_ID_LENOVO_X1_TAB3  0x60b5
++#define USB_DEVICE_ID_LENOVO_X12_TAB  0x60fe
+ #define USB_DEVICE_ID_LENOVO_OPTICAL_USB_MOUSE_600E   0x600e
+ #define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D    0x608d
+ #define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019    0x6019
+--- a/drivers/hid/hid-multitouch.c
++++ b/drivers/hid/hid-multitouch.c
+@@ -2034,6 +2034,12 @@ static const struct hid_device_id mt_dev
+                          USB_VENDOR_ID_LENOVO,
+                          USB_DEVICE_ID_LENOVO_X1_TAB3) },
++      /* Lenovo X12 TAB Gen 1 */
++      { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
++              HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8,
++                         USB_VENDOR_ID_LENOVO,
++                         USB_DEVICE_ID_LENOVO_X12_TAB) },
++
+       /* MosArt panels */
+       { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
+               MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
diff --git a/queue-5.17/hid-multitouch-add-support-for-google-whiskers-touchpad.patch b/queue-5.17/hid-multitouch-add-support-for-google-whiskers-touchpad.patch
new file mode 100644 (file)
index 0000000..f57fcbb
--- /dev/null
@@ -0,0 +1,33 @@
+From 1d07cef7fd7599450b3d03e1915efc2a96e1f03f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Marek=20Ma=C5=9Blanka?= <mm@semihalf.com>
+Date: Tue, 5 Apr 2022 17:04:07 +0200
+Subject: HID: multitouch: Add support for Google Whiskers Touchpad
+
+From: Marek Maślanka <mm@semihalf.com>
+
+commit 1d07cef7fd7599450b3d03e1915efc2a96e1f03f upstream.
+
+The Google Whiskers touchpad does not work properly with the default
+multitouch configuration. Instead, use the same configuration as Google
+Rose.
+
+Signed-off-by: Marek Maslanka <mm@semihalf.com>
+Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/hid/hid-multitouch.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/hid/hid-multitouch.c
++++ b/drivers/hid/hid-multitouch.c
+@@ -2178,6 +2178,9 @@ static const struct hid_device_id mt_dev
+       { .driver_data = MT_CLS_GOOGLE,
+               HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_GOOGLE,
+                       USB_DEVICE_ID_GOOGLE_TOUCH_ROSE) },
++      { .driver_data = MT_CLS_GOOGLE,
++              HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8, USB_VENDOR_ID_GOOGLE,
++                      USB_DEVICE_ID_GOOGLE_WHISKERS) },
+       /* Generic MT device */
+       { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) },
diff --git a/queue-5.17/raid5-introduce-md_broken.patch b/queue-5.17/raid5-introduce-md_broken.patch
new file mode 100644 (file)
index 0000000..3037e1e
--- /dev/null
@@ -0,0 +1,159 @@
+From 57668f0a4cc4083a120cc8c517ca0055c4543b59 Mon Sep 17 00:00:00 2001
+From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
+Date: Tue, 22 Mar 2022 16:23:39 +0100
+Subject: raid5: introduce MD_BROKEN
+
+From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
+
+commit 57668f0a4cc4083a120cc8c517ca0055c4543b59 upstream.
+
+Raid456 module had allowed to achieve failed state. It was fixed by
+fb73b357fb9 ("raid5: block failing device if raid will be failed").
+This fix introduces a bug, now if raid5 fails during IO, it may result
+with a hung task without completion. Faulty flag on the device is
+necessary to process all requests and is checked many times, mainly in
+analyze_stripe().
+Allow to set faulty on drive again and set MD_BROKEN if raid is failed.
+
+As a result, this level is allowed to achieve failed state again, but
+communication with userspace (via -EBUSY status) will be preserved.
+
+This restores possibility to fail array via #mdadm --set-faulty command
+and will be fixed by additional verification on mdadm side.
+
+Reproduction steps:
+ mdadm -CR imsm -e imsm -n 3 /dev/nvme[0-2]n1
+ mdadm -CR r5 -e imsm -l5 -n3 /dev/nvme[0-2]n1 --assume-clean
+ mkfs.xfs /dev/md126 -f
+ mount /dev/md126 /mnt/root/
+
+ fio --filename=/mnt/root/file --size=5GB --direct=1 --rw=randrw
+--bs=64k --ioengine=libaio --iodepth=64 --runtime=240 --numjobs=4
+--time_based --group_reporting --name=throughput-test-job
+--eta-newline=1 &
+
+ echo 1 > /sys/block/nvme2n1/device/device/remove
+ echo 1 > /sys/block/nvme1n1/device/device/remove
+
+ [ 1475.787779] Call Trace:
+ [ 1475.793111] __schedule+0x2a6/0x700
+ [ 1475.799460] schedule+0x38/0xa0
+ [ 1475.805454] raid5_get_active_stripe+0x469/0x5f0 [raid456]
+ [ 1475.813856] ? finish_wait+0x80/0x80
+ [ 1475.820332] raid5_make_request+0x180/0xb40 [raid456]
+ [ 1475.828281] ? finish_wait+0x80/0x80
+ [ 1475.834727] ? finish_wait+0x80/0x80
+ [ 1475.841127] ? finish_wait+0x80/0x80
+ [ 1475.847480] md_handle_request+0x119/0x190
+ [ 1475.854390] md_make_request+0x8a/0x190
+ [ 1475.861041] generic_make_request+0xcf/0x310
+ [ 1475.868145] submit_bio+0x3c/0x160
+ [ 1475.874355] iomap_dio_submit_bio.isra.20+0x51/0x60
+ [ 1475.882070] iomap_dio_bio_actor+0x175/0x390
+ [ 1475.889149] iomap_apply+0xff/0x310
+ [ 1475.895447] ? iomap_dio_bio_actor+0x390/0x390
+ [ 1475.902736] ? iomap_dio_bio_actor+0x390/0x390
+ [ 1475.909974] iomap_dio_rw+0x2f2/0x490
+ [ 1475.916415] ? iomap_dio_bio_actor+0x390/0x390
+ [ 1475.923680] ? atime_needs_update+0x77/0xe0
+ [ 1475.930674] ? xfs_file_dio_aio_read+0x6b/0xe0 [xfs]
+ [ 1475.938455] xfs_file_dio_aio_read+0x6b/0xe0 [xfs]
+ [ 1475.946084] xfs_file_read_iter+0xba/0xd0 [xfs]
+ [ 1475.953403] aio_read+0xd5/0x180
+ [ 1475.959395] ? _cond_resched+0x15/0x30
+ [ 1475.965907] io_submit_one+0x20b/0x3c0
+ [ 1475.972398] __x64_sys_io_submit+0xa2/0x180
+ [ 1475.979335] ? do_io_getevents+0x7c/0xc0
+ [ 1475.986009] do_syscall_64+0x5b/0x1a0
+ [ 1475.992419] entry_SYSCALL_64_after_hwframe+0x65/0xca
+ [ 1476.000255] RIP: 0033:0x7f11fc27978d
+ [ 1476.006631] Code: Bad RIP value.
+ [ 1476.073251] INFO: task fio:3877 blocked for more than 120 seconds.
+
+Cc: stable@vger.kernel.org
+Fixes: fb73b357fb9 ("raid5: block failing device if raid will be failed")
+Reviewd-by: Xiao Ni <xni@redhat.com>
+Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
+Signed-off-by: Song Liu <song@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/raid5.c |   47 ++++++++++++++++++++++-------------------------
+ 1 file changed, 22 insertions(+), 25 deletions(-)
+
+--- a/drivers/md/raid5.c
++++ b/drivers/md/raid5.c
+@@ -686,17 +686,17 @@ int raid5_calc_degraded(struct r5conf *c
+       return degraded;
+ }
+-static int has_failed(struct r5conf *conf)
++static bool has_failed(struct r5conf *conf)
+ {
+-      int degraded;
++      int degraded = conf->mddev->degraded;
+-      if (conf->mddev->reshape_position == MaxSector)
+-              return conf->mddev->degraded > conf->max_degraded;
++      if (test_bit(MD_BROKEN, &conf->mddev->flags))
++              return true;
+-      degraded = raid5_calc_degraded(conf);
+-      if (degraded > conf->max_degraded)
+-              return 1;
+-      return 0;
++      if (conf->mddev->reshape_position != MaxSector)
++              degraded = raid5_calc_degraded(conf);
++
++      return degraded > conf->max_degraded;
+ }
+ struct stripe_head *
+@@ -2877,34 +2877,31 @@ static void raid5_error(struct mddev *md
+       unsigned long flags;
+       pr_debug("raid456: error called\n");
++      pr_crit("md/raid:%s: Disk failure on %s, disabling device.\n",
++              mdname(mddev), bdevname(rdev->bdev, b));
++
+       spin_lock_irqsave(&conf->device_lock, flags);
++      set_bit(Faulty, &rdev->flags);
++      clear_bit(In_sync, &rdev->flags);
++      mddev->degraded = raid5_calc_degraded(conf);
+-      if (test_bit(In_sync, &rdev->flags) &&
+-          mddev->degraded == conf->max_degraded) {
+-              /*
+-               * Don't allow to achieve failed state
+-               * Don't try to recover this device
+-               */
++      if (has_failed(conf)) {
++              set_bit(MD_BROKEN, &conf->mddev->flags);
+               conf->recovery_disabled = mddev->recovery_disabled;
+-              spin_unlock_irqrestore(&conf->device_lock, flags);
+-              return;
++
++              pr_crit("md/raid:%s: Cannot continue operation (%d/%d failed).\n",
++                      mdname(mddev), mddev->degraded, conf->raid_disks);
++      } else {
++              pr_crit("md/raid:%s: Operation continuing on %d devices.\n",
++                      mdname(mddev), conf->raid_disks - mddev->degraded);
+       }
+-      set_bit(Faulty, &rdev->flags);
+-      clear_bit(In_sync, &rdev->flags);
+-      mddev->degraded = raid5_calc_degraded(conf);
+       spin_unlock_irqrestore(&conf->device_lock, flags);
+       set_bit(MD_RECOVERY_INTR, &mddev->recovery);
+       set_bit(Blocked, &rdev->flags);
+       set_mask_bits(&mddev->sb_flags, 0,
+                     BIT(MD_SB_CHANGE_DEVS) | BIT(MD_SB_CHANGE_PENDING));
+-      pr_crit("md/raid:%s: Disk failure on %s, disabling device.\n"
+-              "md/raid:%s: Operation continuing on %d devices.\n",
+-              mdname(mddev),
+-              bdevname(rdev->bdev, b),
+-              mdname(mddev),
+-              conf->raid_disks - mddev->degraded);
+       r5c_update_on_rdev_error(mddev, rdev);
+ }
index 149793ac5d73df81d98678981087013a715e1a7e..316209b0fa993a13b8b8c98151e2e09fd8a73b6e 100644 (file)
@@ -37,3 +37,20 @@ kvm-x86-fix-the-intel_pt-pmi-handling-wrongly-considered-from-guest.patch
 kvm-x86-drop-warns-that-assert-a-triple-fault-never-escapes-from-l2.patch
 kvm-x86-mmu-don-t-rebuild-page-when-the-page-is-synced-and-no-tlb-flushing-is-required.patch
 kvm-svm-use-kzalloc-for-sev-ioctl-interfaces-to-prevent-kernel-data-leak.patch
+crypto-caam-fix-i.mx6sx-entropy-delay-value.patch
+crypto-ecrdsa-fix-incorrect-use-of-vli_cmp.patch
+zsmalloc-fix-races-between-asynchronous-zspage-free-and-page-migration.patch
+tools-memory-model-readme-update-klitmus7-compat-table.patch
+alsa-usb-audio-workaround-for-clock-setup-on-teac-devices.patch
+alsa-usb-audio-add-missing-ep_idx-in-fixed-ep-quirks.patch
+alsa-usb-audio-configure-sync-endpoints-before-data.patch
+bluetooth-hci_qca-use-del_timer_sync-before-freeing.patch
+arm-dts-s5pv210-correct-interrupt-name-for-bluetooth-in-aries.patch
+dm-integrity-fix-error-code-in-dm_integrity_ctr.patch
+dm-crypt-make-printing-of-the-key-constant-time.patch
+dm-stats-add-cond_resched-when-looping-over-entries.patch
+dm-verity-set-dm_target_immutable-feature-flag.patch
+raid5-introduce-md_broken.patch
+fs-ntfs3-validate-boot-sectors_per_clusters.patch
+hid-multitouch-add-support-for-google-whiskers-touchpad.patch
+hid-multitouch-add-quirks-to-enable-lenovo-x12-trackpoint.patch
diff --git a/queue-5.17/tools-memory-model-readme-update-klitmus7-compat-table.patch b/queue-5.17/tools-memory-model-readme-update-klitmus7-compat-table.patch
new file mode 100644 (file)
index 0000000..774f756
--- /dev/null
@@ -0,0 +1,44 @@
+From 5b759db44195bb779828a188bad6b745c18dcd55 Mon Sep 17 00:00:00 2001
+From: Akira Yokosawa <akiyks@gmail.com>
+Date: Mon, 2 May 2022 21:05:09 +0900
+Subject: tools/memory-model/README: Update klitmus7 compat table
+
+From: Akira Yokosawa <akiyks@gmail.com>
+
+commit 5b759db44195bb779828a188bad6b745c18dcd55 upstream.
+
+EXPORT_SYMBOL of do_exec() was removed in v5.17.  Unfortunately,
+kernel modules from klitmus7 7.56 have do_exec() at the end of
+each kthread.
+
+herdtools7 7.56.1 has addressed the issue.
+
+Update the compatibility table accordingly.
+
+Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
+Cc: Luc Maranget <luc.maranget@inria.fr>
+Cc: Jade Alglave <j.alglave@ucl.ac.uk>
+Cc: stable@vger.kernel.org # v5.17+
+Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/memory-model/README | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tools/memory-model/README b/tools/memory-model/README
+index 9edd402704c4..dab38904206a 100644
+--- a/tools/memory-model/README
++++ b/tools/memory-model/README
+@@ -54,7 +54,8 @@ klitmus7 Compatibility Table
+            -- 4.14  7.48 --
+       4.15 -- 4.19  7.49 --
+       4.20 -- 5.5   7.54 --
+-      5.6  --       7.56 --
++      5.6  -- 5.16  7.56 --
++      5.17 --       7.56.1 --
+       ============  ==========
+-- 
+2.36.1
+
diff --git a/queue-5.17/zsmalloc-fix-races-between-asynchronous-zspage-free-and-page-migration.patch b/queue-5.17/zsmalloc-fix-races-between-asynchronous-zspage-free-and-page-migration.patch
new file mode 100644 (file)
index 0000000..af8354b
--- /dev/null
@@ -0,0 +1,86 @@
+From 2505a981114dcb715f8977b8433f7540854851d8 Mon Sep 17 00:00:00 2001
+From: Sultan Alsawaf <sultan@kerneltoast.com>
+Date: Fri, 13 May 2022 15:11:26 -0700
+Subject: zsmalloc: fix races between asynchronous zspage free and page migration
+
+From: Sultan Alsawaf <sultan@kerneltoast.com>
+
+commit 2505a981114dcb715f8977b8433f7540854851d8 upstream.
+
+The asynchronous zspage free worker tries to lock a zspage's entire page
+list without defending against page migration.  Since pages which haven't
+yet been locked can concurrently migrate off the zspage page list while
+lock_zspage() churns away, lock_zspage() can suffer from a few different
+lethal races.
+
+It can lock a page which no longer belongs to the zspage and unsafely
+dereference page_private(), it can unsafely dereference a torn pointer to
+the next page (since there's a data race), and it can observe a spurious
+NULL pointer to the next page and thus not lock all of the zspage's pages
+(since a single page migration will reconstruct the entire page list, and
+create_page_chain() unconditionally zeroes out each list pointer in the
+process).
+
+Fix the races by using migrate_read_lock() in lock_zspage() to synchronize
+with page migration.
+
+Link: https://lkml.kernel.org/r/20220509024703.243847-1-sultan@kerneltoast.com
+Fixes: 77ff465799c602 ("zsmalloc: zs_page_migrate: skip unnecessary loops but not return -EBUSY if zspage is not inuse")
+Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
+Acked-by: Minchan Kim <minchan@kernel.org>
+Cc: Nitin Gupta <ngupta@vflare.org>
+Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ mm/zsmalloc.c |   37 +++++++++++++++++++++++++++++++++----
+ 1 file changed, 33 insertions(+), 4 deletions(-)
+
+--- a/mm/zsmalloc.c
++++ b/mm/zsmalloc.c
+@@ -1718,11 +1718,40 @@ static enum fullness_group putback_zspag
+  */
+ static void lock_zspage(struct zspage *zspage)
+ {
+-      struct page *page = get_first_page(zspage);
++      struct page *curr_page, *page;
+-      do {
+-              lock_page(page);
+-      } while ((page = get_next_page(page)) != NULL);
++      /*
++       * Pages we haven't locked yet can be migrated off the list while we're
++       * trying to lock them, so we need to be careful and only attempt to
++       * lock each page under migrate_read_lock(). Otherwise, the page we lock
++       * may no longer belong to the zspage. This means that we may wait for
++       * the wrong page to unlock, so we must take a reference to the page
++       * prior to waiting for it to unlock outside migrate_read_lock().
++       */
++      while (1) {
++              migrate_read_lock(zspage);
++              page = get_first_page(zspage);
++              if (trylock_page(page))
++                      break;
++              get_page(page);
++              migrate_read_unlock(zspage);
++              wait_on_page_locked(page);
++              put_page(page);
++      }
++
++      curr_page = page;
++      while ((page = get_next_page(curr_page))) {
++              if (trylock_page(page)) {
++                      curr_page = page;
++              } else {
++                      get_page(page);
++                      migrate_read_unlock(zspage);
++                      wait_on_page_locked(page);
++                      put_page(page);
++                      migrate_read_lock(zspage);
++              }
++      }
++      migrate_read_unlock(zspage);
+ }
+ static int zs_init_fs_context(struct fs_context *fc)