]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Apr 2025 13:08:55 +0000 (15:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Apr 2025 13:08:55 +0000 (15:08 +0200)
added patches:
comedi-jr3_pci-fix-synchronous-deletion-of-timer.patch
crypto-atmel-sha204a-set-hwrng-quality-to-lowest-possible.patch

queue-5.4/comedi-jr3_pci-fix-synchronous-deletion-of-timer.patch [new file with mode: 0644]
queue-5.4/crypto-atmel-sha204a-set-hwrng-quality-to-lowest-possible.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/comedi-jr3_pci-fix-synchronous-deletion-of-timer.patch b/queue-5.4/comedi-jr3_pci-fix-synchronous-deletion-of-timer.patch
new file mode 100644 (file)
index 0000000..e164ec6
--- /dev/null
@@ -0,0 +1,72 @@
+From 44d9b3f584c59a606b521e7274e658d5b866c699 Mon Sep 17 00:00:00 2001
+From: Ian Abbott <abbotti@mev.co.uk>
+Date: Tue, 15 Apr 2025 13:39:01 +0100
+Subject: comedi: jr3_pci: Fix synchronous deletion of timer
+
+From: Ian Abbott <abbotti@mev.co.uk>
+
+commit 44d9b3f584c59a606b521e7274e658d5b866c699 upstream.
+
+When `jr3_pci_detach()` is called during device removal, it calls
+`timer_delete_sync()` to stop the timer, but the timer expiry function
+always reschedules the timer, so the synchronization is ineffective.
+
+Call `timer_shutdown_sync()` instead.  It does not matter that the timer
+expiry function pointer is cleared, because the device is being removed.
+
+Fixes: 07b509e6584a5 ("Staging: comedi: add jr3_pci driver")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
+Link: https://lore.kernel.org/r/20250415123901.13483-1-abbotti@mev.co.uk
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/staging/comedi/drivers/jr3_pci.c |   15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+--- a/drivers/staging/comedi/drivers/jr3_pci.c
++++ b/drivers/staging/comedi/drivers/jr3_pci.c
+@@ -88,6 +88,7 @@ struct jr3_pci_poll_delay {
+ struct jr3_pci_dev_private {
+       struct timer_list timer;
+       struct comedi_device *dev;
++      bool timer_enable;
+ };
+ union jr3_pci_single_range {
+@@ -612,10 +613,11 @@ static void jr3_pci_poll_dev(struct time
+                               delay = sub_delay.max;
+               }
+       }
++      if (devpriv->timer_enable) {
++              devpriv->timer.expires = jiffies + msecs_to_jiffies(delay);
++              add_timer(&devpriv->timer);
++      }
+       spin_unlock_irqrestore(&dev->spinlock, flags);
+-
+-      devpriv->timer.expires = jiffies + msecs_to_jiffies(delay);
+-      add_timer(&devpriv->timer);
+ }
+ static struct jr3_pci_subdev_private *
+@@ -764,6 +766,7 @@ static int jr3_pci_auto_attach(struct co
+       devpriv->dev = dev;
+       timer_setup(&devpriv->timer, jr3_pci_poll_dev, 0);
+       devpriv->timer.expires = jiffies + msecs_to_jiffies(1000);
++      devpriv->timer_enable = true;
+       add_timer(&devpriv->timer);
+       return 0;
+@@ -773,8 +776,12 @@ static void jr3_pci_detach(struct comedi
+ {
+       struct jr3_pci_dev_private *devpriv = dev->private;
+-      if (devpriv)
++      if (devpriv) {
++              spin_lock_bh(&dev->spinlock);
++              devpriv->timer_enable = false;
++              spin_unlock_bh(&dev->spinlock);
+               del_timer_sync(&devpriv->timer);
++      }
+       comedi_pci_detach(dev);
+ }
diff --git a/queue-5.4/crypto-atmel-sha204a-set-hwrng-quality-to-lowest-possible.patch b/queue-5.4/crypto-atmel-sha204a-set-hwrng-quality-to-lowest-possible.patch
new file mode 100644 (file)
index 0000000..6343fe3
--- /dev/null
@@ -0,0 +1,47 @@
+From 8006aff15516a170640239c5a8e6696c0ba18d8e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Marek=20Beh=C3=BAn?= <kabel@kernel.org>
+Date: Tue, 22 Apr 2025 11:57:18 +0200
+Subject: crypto: atmel-sha204a - Set hwrng quality to lowest possible
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Marek Behún <kabel@kernel.org>
+
+commit 8006aff15516a170640239c5a8e6696c0ba18d8e upstream.
+
+According to the review by Bill Cox [1], the Atmel SHA204A random number
+generator produces random numbers with very low entropy.
+
+Set the lowest possible entropy for this chip just to be safe.
+
+[1] https://www.metzdowd.com/pipermail/cryptography/2014-December/023858.html
+
+Fixes: da001fb651b00e1d ("crypto: atmel-i2c - add support for SHA204A random number generator")
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Marek Behún <kabel@kernel.org>
+Acked-by: Ard Biesheuvel <ardb@kernel.org>
+Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Marek Behún <kabel@kernel.org>
+---
+ drivers/crypto/atmel-sha204a.c |    7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/drivers/crypto/atmel-sha204a.c
++++ b/drivers/crypto/atmel-sha204a.c
+@@ -107,7 +107,12 @@ static int atmel_sha204a_probe(struct i2
+       i2c_priv->hwrng.name = dev_name(&client->dev);
+       i2c_priv->hwrng.read = atmel_sha204a_rng_read;
+-      i2c_priv->hwrng.quality = 1024;
++
++      /*
++       * According to review by Bill Cox [1], this HWRNG has very low entropy.
++       * [1] https://www.metzdowd.com/pipermail/cryptography/2014-December/023858.html
++       */
++      i2c_priv->hwrng.quality = 1;
+       ret = devm_hwrng_register(&client->dev, &i2c_priv->hwrng);
+       if (ret)
index 22eb8ad77735aee8b2af75285ddfbe97478328b6..fb64dbdd7165981fb73129539db7edf936d7c7dc 100644 (file)
@@ -174,3 +174,5 @@ x86-bugs-don-t-fill-rsb-on-vmexit-with-eibrs-retpoli.patch
 scsi-pm80xx-set-phy_attached-to-zero-when-device-is-.patch
 md-raid1-add-check-for-missing-source-disk-in-proces.patch
 s390-virtio_ccw-don-t-allocate-assign-airqs-for-non-existing-queues.patch
+comedi-jr3_pci-fix-synchronous-deletion-of-timer.patch
+crypto-atmel-sha204a-set-hwrng-quality-to-lowest-possible.patch