mISDN: fix possible memory leak in mISDN_dsp_element_register()
authorYang Yingliang <yangyingliang@huawei.com>
Wed, 9 Nov 2022 13:28:32 +0000 (21:28 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Nov 2022 16:35:39 +0000 (17:35 +0100)
commitbbd53d05c4c892080ef3b617eff4f57903acecb9
tree4fcaf0fd1e64741c6881f0d57d12f0bc745b8878
parentaaf552c5d53abe4659176e099575fe870d2e4768
mISDN: fix possible memory leak in mISDN_dsp_element_register()

[ Upstream commit 98a2ac1ca8fd6eca6867726fe238d06e75eb1acd ]

Afer commit 1fa5ae857bb1 ("driver core: get rid of struct device's
bus_id string array"), the name of device is allocated dynamically,
use put_device() to give up the reference, so that the name can be
freed in kobject_cleanup() when the refcount is 0.

The 'entry' is going to be freed in mISDN_dsp_dev_release(), so the
kfree() is removed. list_del() is called in mISDN_dsp_dev_release(),
so it need be initialized.

Fixes: 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221109132832.3270119-1-yangyingliang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/isdn/mISDN/dsp_pipeline.c