linux-stable/drivers/misc
Yang Yingliang 61c80d1c38 cxl: fix possible null-ptr-deref in cxl_guest_init_afu|adapter()
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>
2022-11-23 20:03:31 +01:00
..
altera-stapl misc: move from strlcpy with unused retval to strscpy 2022-09-01 16:29:42 +02:00
bcm-vk misc: bcm_vk: Remove usage of deprecated functions 2022-09-01 16:29:32 +02:00
c2port
cardreader Merge 5.19-rc6 into char-misc-next 2022-07-11 08:32:58 +02:00
cb710
cxl cxl: fix possible null-ptr-deref in cxl_guest_init_afu|adapter() 2022-11-23 20:03:31 +01:00
echo
eeprom misc: eeprom/idt_89hpesx: Convert to i2c's .probe_new() 2022-11-23 19:56:39 +01:00
genwqe misc: genwqe: card_base: Fix some kernel-doc warnings 2022-11-10 18:38:40 +01:00
habanalabs treewide: use get_random_u32() when possible 2022-10-11 17:42:58 -06:00
ibmasm
lis3lv02d misc: lis3lv02d/lis3lv02d_i2c: Convert to i2c's .probe_new() 2022-11-23 19:56:01 +01:00
lkdtm hardening updates for v6.1-rc1 2022-10-03 17:24:22 -07:00
mchp_pci1xxxx misc: microchip: pci1xxxx: Fix a memory leak in the error handling of gp_aux_bus_probe() 2022-09-22 16:54:35 +02:00
mei mei: bus-fixup: change pxp mode only if message was sent 2022-11-23 19:43:33 +01:00
ocxl ocxl: fix pci device refcount leak when calling get_function_0() 2022-11-23 19:49:22 +01:00
pvpanic
sgi-gru misc: sgi-gru: fix use-after-free error in gru_set_context_option, gru_fault and gru_handle_user_call_os 2022-11-23 19:55:48 +01:00
sgi-xp drivers/misc/sgi-xp: Remove orphan declarations from drivers/misc/sgi-xp/xp.h 2022-09-24 14:57:19 +02:00
ti-st
uacce uacce: Handle parent device removal or parent driver module rmmod 2022-07-01 10:35:08 +02:00
vmw_vmci misc/vmw_vmci: fix an infoleak in vmci_host_do_receive_datagram() 2022-11-09 15:40:03 +01:00
ad525x_dpot-i2c.c i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
ad525x_dpot-spi.c
ad525x_dpot.c
ad525x_dpot.h
apds990x.c misc: apds990x: Convert to i2c's .probe_new() 2022-11-23 19:56:39 +01:00
apds9802als.c misc: apds9802als: Convert to i2c's .probe_new() 2022-11-23 19:56:39 +01:00
atmel-ssc.c misc: update maintainer email address and description for atmel-ssc 2022-08-03 11:03:03 +02:00
bh1770glc.c misc: bh1770glc: Convert to i2c's .probe_new() 2022-11-23 19:56:39 +01:00
cs5535-mfgpt.c
ds1682.c misc: ds1682: Convert to i2c's .probe_new() 2022-11-23 19:56:39 +01:00
dummy-irq.c
dw-xdata-pcie.c
enclosure.c
fastrpc.c Merge 6.0-rc4 into char-misc-next 2022-09-05 07:53:56 +02:00
gehc-achc.c
hi6421v600-irq.c
hisi_hikey_usb.c
hmc6352.c misc: hmc6352: Convert to i2c's .probe_new() 2022-11-23 19:56:38 +01:00
hpilo.c
hpilo.h
ibmvmc.c ibmvmc: don't open-code file_inode() 2022-09-01 17:42:27 -04:00
ibmvmc.h
ics932s401.c misc: ics932s401: Convert to i2c's .probe_new() 2022-11-23 19:56:39 +01:00
isl29003.c misc: isl29003: Convert to i2c's .probe_new() 2022-11-23 19:56:39 +01:00
isl29020.c misc: isl29020: Convert to i2c's .probe_new() 2022-11-23 19:56:07 +01:00
Kconfig misc: smpro-misc: Add Ampere's Altra SMpro misc driver 2022-11-10 19:03:03 +01:00
kgdbts.c
lattice-ecp3-config.c
Makefile misc: smpro-misc: Add Ampere's Altra SMpro misc driver 2022-11-10 19:03:03 +01:00
open-dice.c
pch_phub.c
pci_endpoint_test.c misc: pci_endpoint_test: Fix pci_endpoint_test_{copy,write,read}() panic 2022-09-09 10:24:12 +02:00
phantom.c
qcom-coincell.c
smpro-errmon.c misc: smpro-errmon: Add Ampere's SMpro error monitor driver 2022-11-10 19:02:43 +01:00
smpro-misc.c misc: smpro-misc: Add Ampere's Altra SMpro misc driver 2022-11-10 19:03:03 +01:00
sram-exec.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_320.RULE 2022-06-10 14:51:36 +02:00
sram.c
sram.h
tifm_7xx1.c misc: tifm: fix possible memory leak in tifm_7xx1_switch_media() 2022-11-23 19:55:26 +01:00
tifm_core.c
tsl2550.c misc: tsl2550: Convert to i2c's .probe_new() 2022-11-23 19:56:05 +01:00
vcpu_stall_detector.c misc: Add a mechanism to detect stalls on guest vCPUs 2022-07-14 16:54:17 +02:00
vmw_balloon.c - The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe 2022-08-05 16:32:45 -07:00
xilinx_sdfec.c misc/xilinx_sdfec: Replace kmap() with kmap_local_page() 2022-09-09 10:22:36 +02:00