[PATCH stable-5.4.y 2/2] ALSA: mixer: fix deadlock in snd_mixer_oss_set_volume
From: Takashi Iwai
Date: Sat Nov 13 2021 - 10:39:00 EST
From: Pavel Skripkin <paskripkin@xxxxxxxxx>
commit 3ab7992018455ac63c33e9b3eaa7264e293e40f4 upstream.
In commit 411cef6adfb3 ("ALSA: mixer: oss: Fix racy access to slots")
added mutex protection in snd_mixer_oss_set_volume(). Second
mutex_lock() in same function looks like typo, fix it.
Reported-by: syzbot+ace149a75a9a0a399ac7@xxxxxxxxxxxxxxxxxxxxxxxxx
Fixes: 411cef6adfb3 ("ALSA: mixer: oss: Fix racy access to slots")
Cc: <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Pavel Skripkin <paskripkin@xxxxxxxxx>
Link: https://lore.kernel.org/r/20211024140315.16704-1-paskripkin@xxxxxxxxx
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---
Please apply to older stable kernels, too.
sound/core/oss/mixer_oss.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index fd567611f67e..50ec8b8ff68c 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -313,7 +313,7 @@ static int snd_mixer_oss_set_volume(struct snd_mixer_oss_file *fmixer,
pslot->volume[1] = right;
result = (left & 0xff) | ((right & 0xff) << 8);
unlock:
- mutex_lock(&mixer->reg_mutex);
+ mutex_unlock(&mixer->reg_mutex);
return result;
}
--
2.26.2