ALSA: sb: Fix potential double-free of CSP mixer elements
authorTakashi Iwai <tiwai@suse.de>
Tue, 8 Jun 2021 14:04:37 +0000 (16:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:17:50 +0000 (16:17 +0200)
commitfd3ec5aec809669dff981a3b1cc875b87ae0a047
tree5bd95a44bd7b7734c1db8170fed7dc8abc99f361
parentb359cb3d33ae0080937d1b6f5e5cd1e8ab27dc06
ALSA: sb: Fix potential double-free of CSP mixer elements

[ Upstream commit c305366a37441c2ac90b08711cb6f032b43672f2 ]

snd_sb_qsound_destroy() contains the calls of removing the previously
created mixer controls, but it doesn't clear the pointers.  As
snd_sb_qsound_destroy() itself may be repeatedly called via ioctl,
this could lead to double-free potentially.

Fix it by clearing the struct fields properly afterwards.

Link: https://lore.kernel.org/r/20210608140540.17885-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/isa/sb/sb16_csp.c