lkml.org 
[lkml]   [2022]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH 0/4] ALSA: pcm: Fix ioctl races
Date
Hi,

this is a patch set to address the recently reported bug for the racy
PCM ioctls. In short, the current ALSA PCM core doesn't take enough
care of concurrent ioctl calls, and the concurrent calls may result in
a use-after-free. The reported problem was the concurrent hw_free
calls, but there can be similar cases with other code paths like
hw_params, prepare, etc, too.

The patch set introduces the new runtime->buffer_mutex for protecting
those. The first patch is the fix for the reported issue (the races
with hw_free), while the rest three are more hardening for the other
similar executions.

[ Note that the patch 3 was slightly modified from the version I sent
to distros list, as I noticed possible lockdep (false-positive)
warnings. The behavior is almost same, just written differently. ]


thanks,

Takashi

===

Takashi Iwai (4):
ALSA: pcm: Fix races among concurrent hw_params and hw_free calls
ALSA: pcm: Fix races among concurrent read/write and buffer changes
ALSA: pcm: Fix races among concurrent prepare and hw_params/hw_free
calls
ALSA: pcm: Fix races among concurrent prealloc proc writes

include/sound/pcm.h | 1 +
sound/core/pcm.c | 2 +
sound/core/pcm_lib.c | 4 ++
sound/core/pcm_memory.c | 11 +++--
sound/core/pcm_native.c | 93 +++++++++++++++++++++++++----------------
5 files changed, 71 insertions(+), 40 deletions(-)

--
2.31.1

\
 
 \ /
  Last update: 2022-03-22 18:09    [W:2.214 / U:1.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site