]> git.ipfire.org Git - thirdparty/kernel/linux.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)
committerTakashi Iwai <tiwai@suse.de>
Tue, 23 Dec 2025 09:43:43 +0000 (10:43 +0100)
commit830988b6cf197e6dcffdfe2008c5738e6c6c3c0f
tree9f7fabaf3d02cd76c1f2ca350738308b25c97c62
parent17753d1755a589659433ff4ead595f2bb7f695a8
ALSA: ac97: fix a double free in snd_ac97_controller_register()

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>
sound/ac97/bus.c