]> 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>
Fri, 19 Dec 2025 16:28:45 +0000 (00:28 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Jan 2026 15:35:12 +0000 (16:35 +0100)
commitcb73d37ac18bc1716690ff5255a0ef1952827e9e
tree72b78db3e2618c00b428227db12c37e27cd4e575
parentc12df0f5ca410ce09198d695206b24c4e6bfd073
ALSA: ac97: fix a double free in snd_ac97_controller_register()

commit 830988b6cf197e6dcffdfe2008c5738e6c6c3c0f upstream.

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/ac97/bus.c