ALSA: aloop: Release cable upon open error path
authorTakashi Iwai <tiwai@suse.de>
Fri, 5 Jan 2018 15:09:47 +0000 (16:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Jan 2018 08:45:20 +0000 (09:45 +0100)
commitcd32d7c4d2349ec5c0ffb0898c29bd3f28daf552
tree994192f2d97a5853cccbcb0b8bca74560e0bfe37
parent0b9c7ed68db295f82e91654ba3ff3ee1346c358d
ALSA: aloop: Release cable upon open error path

commit 9685347aa0a5c2869058ca6ab79fd8e93084a67f upstream.

The aloop runtime object and its assignment in the cable are left even
when opening a substream fails.  This doesn't mean any memory leak,
but it still keeps the invalid pointer that may be referred by the
another side of the cable spontaneously, which is a potential Oops
cause.

Clean up the cable assignment and the empty cable upon the error path
properly.

Fixes: 597603d615d2 ("ALSA: introduce the snd-aloop module for the PCM loopback")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/drivers/aloop.c