linux-stable/drivers/rapidio
Yang Yingliang 9abba4aa60 rapidio: rio: fix possible name leak in rio_register_mport()
[ Upstream commit e92a216d16 ]

If device_register() returns error, the name allocated by dev_set_name()
need be freed.  It should use put_device() to give up the reference in the
error path, so that the name can be freed in kobject_cleanup(), and
list_del() is called to delete the port from rio_mports.

Link: https://lkml.kernel.org/r/20221114152636.2939035-3-yangyingliang@huawei.com
Fixes: 2aaf308b95 ("rapidio: rework device hierarchy and introduce mport class of devices")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Cc: Alexandre Bounine <alex.bou9@gmail.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-31 13:31:58 +01:00
..
devices rapidio: fix possible name leaks when rio_add_device() fails 2022-12-31 13:31:58 +01:00
switches rapidio: remove not used code about RIO_VID_TUNDRA 2021-12-21 10:22:19 +01:00
Kconfig rapidio: Replace 'select' DMAENGINES 'with depends on' 2020-09-05 19:52:54 +03:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rio-access.c drivers/rapidio/rio-access.c: fix missing include of <linux/rio_drv.h> 2019-12-04 19:44:13 -08:00
rio-driver.c bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
rio-scan.c rapidio: fix possible name leaks when rio_add_device() fails 2022-12-31 13:31:58 +01:00
rio-sysfs.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
rio.c rapidio: rio: fix possible name leak in rio_register_mport() 2022-12-31 13:31:58 +01:00
rio.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
rio_cm.c rapidio: handle create_workqueue() failure 2021-05-13 18:32:19 +02:00