]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Aug 2018 17:20:30 +0000 (19:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Aug 2018 17:20:30 +0000 (19:20 +0200)
added patches:
usb-gadget-u_audio-protect-stream-runtime-fields.patch

queue-4.14/series
queue-4.14/usb-gadget-u_audio-protect-stream-runtime-fields.patch [moved from queue-4.14/usb-gadget-u_audio-protect-stream-runtime-fields-with-stream-spinlock.patch with 82% similarity]

index b40372f705d14bdeee1d0743213f9ccbf30b9be7..b8866ed9d1c2cfb630d3bd7e59111e4d1fac5a0d 100644 (file)
@@ -21,7 +21,7 @@ usb-gadget-u_audio-fix-pcm-card-naming-in-g_audio_setup.patch
 usb-gadget-u_audio-update-hw_ptr-in-iso_complete-after-data-copied.patch
 usb-gadget-u_audio-remove-caching-of-stream-buffer-parameters.patch
 usb-gadget-u_audio-remove-cached-period-bytes-value.patch
-usb-gadget-u_audio-protect-stream-runtime-fields-with-stream-spinlock.patch
+usb-gadget-u_audio-protect-stream-runtime-fields.patch
 usb-phy-fix-ppc64-build-errors-in-phy-fsl-usb.c.patch
 tools-usb-ffs-test-fix-build-on-big-endian-systems.patch
 usb-gadget-f_uac2-fix-endianness-of-struct-cntrl_-_lay3.patch
similarity index 82%
rename from queue-4.14/usb-gadget-u_audio-protect-stream-runtime-fields-with-stream-spinlock.patch
rename to queue-4.14/usb-gadget-u_audio-protect-stream-runtime-fields.patch
index 51cf71698413915ab157921cd9d5ceb660ad0e47..33f2290e0c5656a6aa81791ef91dce2ddd0c8999 100644 (file)
@@ -1,9 +1,8 @@
-From foo@baz Sun Aug 26 09:13:00 CEST 2018
+From 39e729351eec2fe292396096cd8bb152824c37a1 Mon Sep 17 00:00:00 2001
 From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
 Date: Thu, 21 Jun 2018 17:22:52 +0200
-Subject: usb: gadget: u_audio: protect stream runtime fields with stream spinlock
-
-From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
+Subject: [PATCH 23/82] usb: gadget: u_audio: protect stream runtime fields
+ with stream spinlock
 
 [ Upstream commit 56bc61587daadef67712068f251c4ef2e3932d94 ]
 
@@ -67,26 +66,26 @@ Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
          consistently reproduce BUG: KASAN: use-after-free [2]]
 
 [1] Instrumentation to reproduce issue [2]:
- diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
- index a72295c953bb..bd0b308024fe 100644
- --- a/drivers/usb/gadget/function/u_audio.c
- +++ b/drivers/usb/gadget/function/u_audio.c
- @@ -16,6 +16,7 @@
-  #include <sound/core.h>
-  #include <sound/pcm.h>
-  #include <sound/pcm_params.h>
- +#include <linux/delay.h>
-
-  #include "u_audio.h"
-
- @@ -147,6 +148,8 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
-
-       spin_unlock_irqrestore(&prm->lock, flags);
-
- +     udelay(500); //delay here to increase probability of parallel activities
- +
-       /* Pack USB load in ALSA ring buffer */
-       pending = prm->dma_bytes - hw_ptr;
+ diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
+ index a72295c953bb..bd0b308024fe 100644
+ --- a/drivers/usb/gadget/function/u_audio.c
+ +++ b/drivers/usb/gadget/function/u_audio.c
+ @@ -16,6 +16,7 @@
+  #include <sound/core.h>
+  #include <sound/pcm.h>
+  #include <sound/pcm_params.h>
+ +#include <linux/delay.h>
+# 
+  #include "u_audio.h"
+# 
+ @@ -147,6 +148,8 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
+# 
+#      spin_unlock_irqrestore(&prm->lock, flags);
+# 
+#  +   udelay(500); //delay here to increase probability of parallel activities
+ +
+#      /* Pack USB load in ALSA ring buffer */
+#      pending = prm->dma_bytes - hw_ptr;
 
 [2] After applying [1], below BUG occurs on Rcar-H3-Salvator-X board:
 ==================================================================
@@ -138,26 +137,18 @@ Exception stack(0xffff200009e97c80 to 0xffff200009e97dc0)
 
 Fixes: 132fcb460839 ("usb: gadget: Add Audio Class 2.0 Driver")
 Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
-
 Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
-
 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 ---
- drivers/usb/gadget/function/u_audio.c |   13 ++++++++++++-
- 1 file changed, 12 insertions(+), 1 deletion(-)
+ drivers/usb/gadget/function/u_audio.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
 
+diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
+index e9644137f720..d3a639297e06 100644
 --- a/drivers/usb/gadget/function/u_audio.c
 +++ b/drivers/usb/gadget/function/u_audio.c
-@@ -25,6 +25,7 @@
- #include <sound/core.h>
- #include <sound/pcm.h>
- #include <sound/pcm_params.h>
-+#include <linux/delay.h>
- #include "u_audio.h"
-@@ -88,7 +89,7 @@ static const struct snd_pcm_hardware uac
+@@ -88,7 +88,7 @@ static const struct snd_pcm_hardware uac_pcm_hardware = {
  static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
  {
        unsigned pending;
@@ -166,7 +157,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        unsigned int hw_ptr;
        int status = req->status;
        struct uac_req *ur = req->context;
-@@ -115,7 +116,14 @@ static void u_audio_iso_complete(struct
+@@ -115,7 +115,14 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
        if (!substream)
                goto exit;
  
@@ -181,16 +172,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        spin_lock_irqsave(&prm->lock, flags);
  
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-@@ -146,6 +154,8 @@ static void u_audio_iso_complete(struct
-       spin_unlock_irqrestore(&prm->lock, flags);
-+      udelay(500); //delay here to increase probability of parallel activities
-+
-       /* Pack USB load in ALSA ring buffer */
-       pending = runtime->dma_bytes - hw_ptr;
-@@ -174,6 +184,7 @@ static void u_audio_iso_complete(struct
+@@ -174,6 +181,7 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
        prm->hw_ptr = (hw_ptr + req->actual) % runtime->dma_bytes;
        hw_ptr = prm->hw_ptr;
        spin_unlock_irqrestore(&prm->lock, flags);
@@ -198,3 +180,6 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  
        if ((hw_ptr % snd_pcm_lib_period_bytes(substream)) < req->actual)
                snd_pcm_period_elapsed(substream);
+-- 
+2.18.0
+