ALSA: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev()
stable inclusion from stable-v5.10.153 commit ce6fd1c382a38b75557db85a2fe99d285540a03d category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I64YCA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ce6fd1c382a38b75557db85a2fe99d285540a03d -------------------------------- [ Upstream commit 4a4c8482 ] dev_set_name() in soundbus_add_one() allocates memory for name, it need be freed when of_device_register() fails, call soundbus_dev_put() to give up the reference that hold in device_initialize(), so that it can be freed in kobject_cleanup() when the refcount hit to 0. And other resources are also freed in i2sbus_release_dev(), so it can return 0 directly. Fixes: f3d9478b ("[ALSA] snd-aoa: add snd-aoa") Signed-off-by: NYang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20221027013438.991920-1-yangyingliang@huawei.comSigned-off-by: NTakashi Iwai <tiwai@suse.de> Signed-off-by: NSasha Levin <sashal@kernel.org> Signed-off-by: NLipeng Sang <sanglipeng1@jd.com>
Showing
想要评论请 注册 或 登录