android_kernel_sony_sdm845/drivers/misc/cxl
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Yang Yingliang 82e6843266 cxl: fix possible null-ptr-deref in cxl_pci_init_afu|adapter()
[ Upstream commit 02cd3032b154fa02fdf90e7467abaeed889330b2 ]

If device_register() fails in cxl_pci_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: f204e0b8ce ("cxl: Driver code for powernv PCIe based cards for userspace access")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>
Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
Link: https://lore.kernel.org/r/20221111145440.2426970-2-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
..
api.c
base.c
context.c
cxl.h
debugfs.c
fault.c
file.c
flash.c
guest.c cxl: fix possible null-ptr-deref in cxl_guest_init_afu|adapter() 2023-01-07 12:07:25 +01:00
hcalls.c
hcalls.h
irq.c cxl: Fix a memory leak in an error handling path 2022-08-25 11:09:31 +02:00
Kconfig
main.c cxl: Fix wrong comparison in cxl_adapter_context_get() 2018-09-09 20:01:20 +02:00
Makefile
native.c
of.c
pci.c cxl: fix possible null-ptr-deref in cxl_pci_init_afu|adapter() 2023-01-07 12:07:25 +01:00
phb.c
sysfs.c cxl: Fix kobject memleak 2020-08-21 11:02:00 +02:00
trace.c
trace.h
vphb.c