Skip to content
Commit ede34f39 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: seq: Break too long mutex context in the write loop

The fix for the racy writes and ioctls to sequencer widened the
application of client->ioctl_mutex to the whole write loop.  Although
it does unlock/relock for the lengthy operation like the event dup,
the loop keeps the ioctl_mutex for the whole time in other
situations.  This may take quite long time if the user-space would
give a huge buffer, and this is a likely cause of some weird behavior
spotted by syzcaller fuzzer.

This patch puts a simple workaround, just adding a mutex break in the
loop when a large number of events have been processed.  This
shouldn't hit any performance drop because the threshold is set high
enough for usual operations.

Fixes: 7bd80091

 ("ALSA: seq: More protection for concurrent write and ioctl races")
Reported-by: default avatar <syzbot+97aae04ce27e39cbfca9@syzkaller.appspotmail.com>
Reported-by: default avatar <syzbot+4c595632b98bb8ffcc66@syzkaller.appspotmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 4b4e0e32
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment