]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ALSA: aloop: Fix access to not-yet-ready substream via cable
authorTakashi Iwai <tiwai@suse.de>
Thu, 22 Mar 2018 09:40:27 +0000 (10:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Mar 2018 16:22:53 +0000 (18:22 +0200)
commit33cc51d03b60bb64c17b0bf5e9b0556a61f1889e
tree3a487ccdb2f382cd3b12a84dbebab7e397c7600c
parent66ef51a5c40236c12c22c736369b05e5882cfd26
ALSA: aloop: Fix access to not-yet-ready substream via cable

commit 8e6b1a72a75bb5067ccb6b56d8ca4aa3a300a64e upstream.

In loopback_open() and loopback_close(), we assign and release the
substream object to the corresponding cable in a racy way.  It's
neither locked nor done in the right position.  The open callback
assigns the substream before its preparation finishes, hence the other
side of the cable may pick it up, which may lead to the invalid memory
access.

This patch addresses these: move the assignment to the end of the open
callback, and wrap with cable->lock for avoiding concurrent accesses.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/drivers/aloop.c