Files
linux/drivers
Yang Yingliang 96fba6fb95 cxl: fix possible null-ptr-deref in cxl_guest_init_afu|adapter()
[ Upstream commit 61c80d1c38 ]

If device_register() fails in cxl_register_afu|adapter(), the device
is not added, device_unregister() can not be called in the error path,
otherwise it will cause a null-ptr-deref because of removing not added
device.

As comment of device_register() says, it should use put_device() to give
up the reference in the error path. So split device_unregister() into
device_del() and put_device(), then goes to put dev when register fails.

Fixes: 14baf4d9c7 ("cxl: Add guest-specific code")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>
Link: https://lore.kernel.org/r/20221111145440.2426970-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-01-07 12:07:25 +01:00
..
2021-12-14 10:04:48 +01:00
2022-11-10 15:46:07 +01:00
2022-05-12 12:14:53 +02:00
2023-01-07 12:07:20 +01:00
2023-01-07 12:07:23 +01:00
2022-07-02 16:17:16 +02:00
2020-12-29 13:45:00 +01:00
2022-04-20 09:06:42 +02:00