]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ALSA: ac97: fix a double free in snd_ac97_controller_register()
authorHaoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Mon, 12 Jan 2026 17:09:40 +0000 (12:09 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Jan 2026 15:31:26 +0000 (16:31 +0100)
commitfcc04c92cbb5497ce67c58dd2f0001bb87f40396
treebc4675de5d66946a26345a327b079a8238b1b05d
parent71138011dc0141b807d4f23ec5dae1648506e32a
ALSA: ac97: fix a double free in snd_ac97_controller_register()

[ Upstream commit 830988b6cf197e6dcffdfe2008c5738e6c6c3c0f ]

If ac97_add_adapter() fails, put_device() is the correct way to drop
the device reference. kfree() is not required.
Add kfree() if idr_alloc() fails and in ac97_adapter_release() to do
the cleanup.

Found by code review.

Fixes: 74426fbff66e ("ALSA: ac97: add an ac97 bus")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Link: https://patch.msgid.link/20251219162845.657525-1-lihaoxiang@isrc.iscas.ac.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/ac97/bus.c