mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
ALSA: ac97: fix possible memory leak in snd_ac97_dev_register()
[ Upstream commit 4881bda5ea05c8c240fc8afeaa928e2bc43f61fa ]
If device_register() fails in snd_ac97_dev_register(), it should
call put_device() to give up reference, or the name allocated in
dev_set_name() is leaked.
Fixes: 0ca06a00e2 ("[ALSA] AC97 bus interface for ad-hoc drivers")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221019093025.1179475-1-yangyingliang@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
ccaeef126e
commit
758dbcc6fb
1 changed files with 1 additions and 0 deletions
|
|
@ -1945,6 +1945,7 @@ static int snd_ac97_dev_register(struct snd_device *device)
|
|||
snd_ac97_get_short_name(ac97));
|
||||
if ((err = device_register(&ac97->dev)) < 0) {
|
||||
ac97_err(ac97, "Can't register ac97 bus\n");
|
||||
put_device(&ac97->dev);
|
||||
ac97->dev.bus = NULL;
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue