From 9f368dfefdc04887a69432468874bd1a5bcb369e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 29 Mar 2022 12:55:16 +0200 Subject: [PATCH] Revert "ALSA: pcm: Fix races among concurrent read/write and buffer changes" This reverts commit 47711ff10c7e126702cfa725f6d86ef529d15a5f. It will come back after the next ABI break as it is needed to resolve CVE-2022-1048. But for now, while testing, it can be reverted in order to preserve the ABI. Signed-off-by: Greg Kroah-Hartman Change-Id: I5d4a52d443cffa34c8550b83c90d11a69da09cfc --- sound/core/pcm_lib.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index d25b1b005429..a144a3f68e9e 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1905,11 +1905,9 @@ static int wait_for_avail(struct snd_pcm_substream *substream, if (avail >= runtime->twake) break; snd_pcm_stream_unlock_irq(substream); - mutex_unlock(&runtime->buffer_mutex); tout = schedule_timeout(wait_time); - mutex_lock(&runtime->buffer_mutex); snd_pcm_stream_lock_irq(substream); set_current_state(TASK_INTERRUPTIBLE); switch (runtime->status->state) { @@ -2203,7 +2201,6 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, nonblock = !!(substream->f_flags & O_NONBLOCK); - mutex_lock(&runtime->buffer_mutex); snd_pcm_stream_lock_irq(substream); err = pcm_accessible_state(runtime); if (err < 0) @@ -2291,7 +2288,6 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, if (xfer > 0 && err >= 0) snd_pcm_update_state(substream, runtime); snd_pcm_stream_unlock_irq(substream); - mutex_unlock(&runtime->buffer_mutex); return xfer > 0 ? (snd_pcm_sframes_t)xfer : err; } EXPORT_SYMBOL(__snd_pcm_lib_xfer);