aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrinivasa Rao Kuppala <srkupp@codeaurora.org>2018-05-30 12:22:02 +0530
committerShirle Yuen <shirleyshukyee@google.com>2018-08-05 16:36:00 -0700
commit7099a9736ab73a32b00c71ec8ef7d339cf12c000 (patch)
tree4cea9858670ca657f51b4e3d098e8d2d4ab8d786
parent9ed6ca0be82dddceb515a7e206004ef02872fcde (diff)
downloadqcom-msm8x09-v3.10-7099a9736ab73a32b00c71ec8ef7d339cf12c000.tar.gz
sound: rawmidi: Move spinlock under realloc_mutex
A merge conflict resolution of commit e57f781805f0 ("ANDROID: sound: rawmidi: Hold lock around realloc") placed a realloc_mutex lock inside of a runtime->lock irq spinlock. The mutex lock has to encompass the spinlock to avoid attempts to sleep in an invalid context. Bug: 111289931 Change-Id: I29723c5623db3b7145644f941ccc5226e3764f08 Signed-off-by: Srinivasa Rao Kuppala <srkupp@codeaurora.org> Signed-off-by: Chetan C R <cravin@codeaurora.org> (cherry picked from commit 7227cf29a0780350a18d4dceef4c49dd97221367)
-rw-r--r--sound/core/rawmidi.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index a5c5fc3f019..e2fc8be874c 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -958,14 +958,13 @@ static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream,
long result = 0, count1;
struct snd_rawmidi_runtime *runtime = substream->runtime;
- spin_lock_irqsave(&runtime->lock, flags);
if (userbuf)
mutex_lock(&runtime->realloc_mutex);
+ spin_lock_irqsave(&runtime->lock, flags);
while (count > 0 && runtime->avail) {
count1 = runtime->buffer_size - runtime->appl_ptr;
if (count1 > count)
count1 = count;
- spin_lock_irqsave(&runtime->lock, flags);
if (count1 > (int)runtime->avail)
count1 = runtime->avail;
if (kernelbuf)