]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 May 2022 10:18:14 +0000 (12:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 May 2022 10:18:14 +0000 (12:18 +0200)
added patches:
asoc-wm8958-fix-change-notifications-for-dsp-controls.patch
can-grcan-grcan_close-fix-deadlock.patch
can-grcan-use-ofdev-dev-when-allocating-dma-memory.patch

queue-4.14/asoc-wm8958-fix-change-notifications-for-dsp-controls.patch [new file with mode: 0644]
queue-4.14/can-grcan-grcan_close-fix-deadlock.patch [new file with mode: 0644]
queue-4.14/can-grcan-use-ofdev-dev-when-allocating-dma-memory.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/asoc-wm8958-fix-change-notifications-for-dsp-controls.patch b/queue-4.14/asoc-wm8958-fix-change-notifications-for-dsp-controls.patch
new file mode 100644 (file)
index 0000000..1ed9d09
--- /dev/null
@@ -0,0 +1,61 @@
+From b4f5c6b2e52b27462c0599e64e96e53b58438de1 Mon Sep 17 00:00:00 2001
+From: Mark Brown <broonie@kernel.org>
+Date: Sat, 16 Apr 2022 13:54:08 +0100
+Subject: ASoC: wm8958: Fix change notifications for DSP controls
+
+From: Mark Brown <broonie@kernel.org>
+
+commit b4f5c6b2e52b27462c0599e64e96e53b58438de1 upstream.
+
+The WM8958 DSP controls all return 0 on successful write, not a boolean
+value indicating if the write changed the value of the control. Fix this
+by returning 1 after a change, there is already a check at the start of
+each put() that skips the function in the case that there is no change.
+
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
+Link: https://lore.kernel.org/r/20220416125408.197440-1-broonie@kernel.org
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/soc/codecs/wm8958-dsp2.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/sound/soc/codecs/wm8958-dsp2.c
++++ b/sound/soc/codecs/wm8958-dsp2.c
+@@ -533,7 +533,7 @@ static int wm8958_mbc_put(struct snd_kco
+       wm8958_dsp_apply(codec, mbc, wm8994->mbc_ena[mbc]);
+-      return 0;
++      return 1;
+ }
+ #define WM8958_MBC_SWITCH(xname, xval) {\
+@@ -659,7 +659,7 @@ static int wm8958_vss_put(struct snd_kco
+       wm8958_dsp_apply(codec, vss, wm8994->vss_ena[vss]);
+-      return 0;
++      return 1;
+ }
+@@ -733,7 +733,7 @@ static int wm8958_hpf_put(struct snd_kco
+       wm8958_dsp_apply(codec, hpf % 3, ucontrol->value.integer.value[0]);
+-      return 0;
++      return 1;
+ }
+ #define WM8958_HPF_SWITCH(xname, xval) {\
+@@ -827,7 +827,7 @@ static int wm8958_enh_eq_put(struct snd_
+       wm8958_dsp_apply(codec, eq, ucontrol->value.integer.value[0]);
+-      return 0;
++      return 1;
+ }
+ #define WM8958_ENH_EQ_SWITCH(xname, xval) {\
diff --git a/queue-4.14/can-grcan-grcan_close-fix-deadlock.patch b/queue-4.14/can-grcan-grcan_close-fix-deadlock.patch
new file mode 100644 (file)
index 0000000..624fa98
--- /dev/null
@@ -0,0 +1,54 @@
+From 47f070a63e735bcc8d481de31be1b5a1aa62b31c Mon Sep 17 00:00:00 2001
+From: Duoming Zhou <duoming@zju.edu.cn>
+Date: Mon, 25 Apr 2022 12:24:00 +0800
+Subject: can: grcan: grcan_close(): fix deadlock
+
+From: Duoming Zhou <duoming@zju.edu.cn>
+
+commit 47f070a63e735bcc8d481de31be1b5a1aa62b31c upstream.
+
+There are deadlocks caused by del_timer_sync(&priv->hang_timer) and
+del_timer_sync(&priv->rr_timer) in grcan_close(), one of the deadlocks
+are shown below:
+
+   (Thread 1)              |      (Thread 2)
+                           | grcan_reset_timer()
+grcan_close()              |  mod_timer()
+ spin_lock_irqsave() //(1) |  (wait a time)
+ ...                       | grcan_initiate_running_reset()
+ del_timer_sync()          |  spin_lock_irqsave() //(2)
+ (wait timer to stop)      |  ...
+
+We hold priv->lock in position (1) of thread 1 and use
+del_timer_sync() to wait timer to stop, but timer handler also need
+priv->lock in position (2) of thread 2. As a result, grcan_close()
+will block forever.
+
+This patch extracts del_timer_sync() from the protection of
+spin_lock_irqsave(), which could let timer handler to obtain the
+needed lock.
+
+Link: https://lore.kernel.org/all/20220425042400.66517-1-duoming@zju.edu.cn
+Fixes: 6cec9b07fe6a ("can: grcan: Add device driver for GRCAN and GRHCAN cores")
+Cc: stable@vger.kernel.org
+Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
+Reviewed-by: Andreas Larsson <andreas@gaisler.com>
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/can/grcan.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/net/can/grcan.c
++++ b/drivers/net/can/grcan.c
+@@ -1117,8 +1117,10 @@ static int grcan_close(struct net_device
+       priv->closing = true;
+       if (priv->need_txbug_workaround) {
++              spin_unlock_irqrestore(&priv->lock, flags);
+               del_timer_sync(&priv->hang_timer);
+               del_timer_sync(&priv->rr_timer);
++              spin_lock_irqsave(&priv->lock, flags);
+       }
+       netif_stop_queue(dev);
+       grcan_stop_hardware(dev);
diff --git a/queue-4.14/can-grcan-use-ofdev-dev-when-allocating-dma-memory.patch b/queue-4.14/can-grcan-use-ofdev-dev-when-allocating-dma-memory.patch
new file mode 100644 (file)
index 0000000..ea74a70
--- /dev/null
@@ -0,0 +1,63 @@
+From 101da4268626b00d16356a6bf284d66e44c46ff9 Mon Sep 17 00:00:00 2001
+From: Daniel Hellstrom <daniel@gaisler.com>
+Date: Fri, 29 Apr 2022 10:46:54 +0200
+Subject: can: grcan: use ofdev->dev when allocating DMA memory
+
+From: Daniel Hellstrom <daniel@gaisler.com>
+
+commit 101da4268626b00d16356a6bf284d66e44c46ff9 upstream.
+
+Use the device of the device tree node should be rather than the
+device of the struct net_device when allocating DMA buffers.
+
+The driver got away with it on sparc32 until commit 53b7670e5735
+("sparc: factor the dma coherent mapping into helper") after which the
+driver oopses.
+
+Fixes: 6cec9b07fe6a ("can: grcan: Add device driver for GRCAN and GRHCAN cores")
+Link: https://lore.kernel.org/all/20220429084656.29788-2-andreas@gaisler.com
+Cc: stable@vger.kernel.org
+Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
+Signed-off-by: Andreas Larsson <andreas@gaisler.com>
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/can/grcan.c |    6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/can/grcan.c
++++ b/drivers/net/can/grcan.c
+@@ -252,6 +252,7 @@ struct grcan_device_config {
+ struct grcan_priv {
+       struct can_priv can;    /* must be the first member */
+       struct net_device *dev;
++      struct device *ofdev_dev;
+       struct napi_struct napi;
+       struct grcan_registers __iomem *regs;   /* ioremap'ed registers */
+@@ -928,7 +929,7 @@ static void grcan_free_dma_buffers(struc
+       struct grcan_priv *priv = netdev_priv(dev);
+       struct grcan_dma *dma = &priv->dma;
+-      dma_free_coherent(&dev->dev, dma->base_size, dma->base_buf,
++      dma_free_coherent(priv->ofdev_dev, dma->base_size, dma->base_buf,
+                         dma->base_handle);
+       memset(dma, 0, sizeof(*dma));
+ }
+@@ -953,7 +954,7 @@ static int grcan_allocate_dma_buffers(st
+       /* Extra GRCAN_BUFFER_ALIGNMENT to allow for alignment */
+       dma->base_size = lsize + ssize + GRCAN_BUFFER_ALIGNMENT;
+-      dma->base_buf = dma_alloc_coherent(&dev->dev,
++      dma->base_buf = dma_alloc_coherent(priv->ofdev_dev,
+                                          dma->base_size,
+                                          &dma->base_handle,
+                                          GFP_KERNEL);
+@@ -1606,6 +1607,7 @@ static int grcan_setup_netdev(struct pla
+       memcpy(&priv->config, &grcan_module_config,
+              sizeof(struct grcan_device_config));
+       priv->dev = dev;
++      priv->ofdev_dev = &ofdev->dev;
+       priv->regs = base;
+       priv->can.bittiming_const = &grcan_bittiming_const;
+       priv->can.do_set_bittiming = grcan_set_bittiming;
index ee79350fd220f077f279015eb182b083be2cbbc2..f39206e49840441a21b0161e8901475a5d906e5a 100644 (file)
@@ -58,3 +58,6 @@ revert-sunrpc-attempt-af_local-connect-on-setup.patch
 firewire-fix-potential-uaf-in-outbound_phy_packet_callback.patch
 firewire-remove-check-of-list-iterator-against-head-past-the-loop-body.patch
 firewire-core-extend-card-lock-in-fw_core_handle_bus_reset.patch
+asoc-wm8958-fix-change-notifications-for-dsp-controls.patch
+can-grcan-grcan_close-fix-deadlock.patch
+can-grcan-use-ofdev-dev-when-allocating-dma-memory.patch