ALSA: rawmidi: Change resized buffers atomically
authorTakashi Iwai <tiwai@suse.de>
Tue, 17 Jul 2018 15:26:43 +0000 (17:26 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 25 Sep 2018 22:47:30 +0000 (23:47 +0100)
commitc95e0783eab0d1f31c7f8baa6e4ff8b0b8e7eb72
treeb64452c058b08079f6a2df7da7dd01ad8eaa6164
parent189254a6aa0cc823b55e624ba77ad3bd0637bbd9
ALSA: rawmidi: Change resized buffers atomically

commit 39675f7a7c7e7702f7d5341f1e0d01db746543a0 upstream.

The SNDRV_RAWMIDI_IOCTL_PARAMS ioctl may resize the buffers and the
current code is racy.  For example, the sequencer client may write to
buffer while it being resized.

As a simple workaround, let's switch to the resized buffer inside the
stream runtime lock.

Reported-by: syzbot+52f83f0ea8df16932f7f@syzkaller.appspotmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
sound/core/rawmidi.c