linux/drivers
Dan Williams 74be98774d cxl/port: Hold port reference until decoder release
KASAN + DEBUG_KOBJECT_RELEASE reports a potential use-after-free in
cxl_decoder_release() where it goes to reference its parent, a cxl_port,
to free its id back to port->decoder_ida.

 BUG: KASAN: use-after-free in to_cxl_port+0x18/0x90 [cxl_core]
 Read of size 8 at addr ffff888119270908 by task kworker/35:2/379

 CPU: 35 PID: 379 Comm: kworker/35:2 Tainted: G           OE     5.17.0-rc2+ #198
 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
 Workqueue: events kobject_delayed_cleanup
 Call Trace:
  <TASK>
  dump_stack_lvl+0x59/0x73
  print_address_description.constprop.0+0x1f/0x150
  ? to_cxl_port+0x18/0x90 [cxl_core]
  kasan_report.cold+0x83/0xdf
  ? to_cxl_port+0x18/0x90 [cxl_core]
  to_cxl_port+0x18/0x90 [cxl_core]
  cxl_decoder_release+0x2a/0x60 [cxl_core]
  device_release+0x5f/0x100
  kobject_cleanup+0x80/0x1c0

The device core only guarantees parent lifetime until all children are
unregistered. If a child needs a parent to complete its ->release()
callback that child needs to hold a reference to extend the lifetime of
the parent.

Fixes: 40ba17afdf ("cxl/acpi: Introduce cxl_decoder objects")
Reported-by: Ben Widawsky <ben.widawsky@intel.com>
Tested-by: Ben Widawsky <ben.widawsky@intel.com>
Reviewed-by: Ben Widawsky <ben.widawsky@intel.com>
Link: https://lore.kernel.org/r/164505751190.4175768.13324905271463416712.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
History 2022-02-17 16:51:13 -08:00
..
accessibility Char/Misc and other driver changes for 5.17-rc1 2022-01-14 16:02:28 +01:00
acpi Merge branch 'akpm' (patches from Andrew) 2022-01-22 11:28:23 +02:00
amba ARM: 9163/1: amba: Move of_amba_device_decode_irq() into amba_probe() 2021-12-17 11:34:35 +00:00
android Merge 5.16-rc8 into char-misc-next 2022-01-03 13:44:38 +01:00
ata ata: pata_platform: Fix a NULL pointer dereference in __pata_platform_probe() 2022-01-27 11:22:43 +09:00
atm atm: iphase: remove redundant pointer skb 2022-01-13 12:50:48 +00:00
auxdisplay auxdisplay: charlcd: checking for pointer reference before dereferencing 2021-11-24 11:46:52 +01:00
base firmware_loader: move firmware sysctl to its own files 2022-01-22 08:33:35 +02:00
bcma pci-v5.16-changes 2021-11-06 14:36:12 -07:00
block bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
bluetooth virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes 2022-01-18 10:05:48 +02:00
bus pci-v5.17-changes 2022-01-16 08:08:11 +02:00
cdrom cdrom: simplify subdirectory registration with register_sysctl() 2022-01-22 08:33:35 +02:00
char random: move the random sysctl declarations to its own file 2022-01-22 08:33:35 +02:00
clk Some hot fixes for clk driver patches merged last week 2022-01-21 09:16:11 +02:00
clocksource - Refactor resource allocation on the Exynos_mct driver without 2022-01-10 13:53:16 +01:00
comedi comedi: Move "comedi_isadma.h" to <linux/comedi/comedi_isadma.h> 2021-11-26 16:48:59 +01:00
connector connector/cn_proc: Use task_is_in_init_pid_ns() 2022-01-26 18:57:09 -08:00
counter counter: fix an IS_ERR() vs NULL bug 2022-01-26 19:40:33 +01:00
cpufreq cpufreq: amd-pstate: Fix Kconfig dependencies for AMD P-State 2022-01-06 18:31:33 +01:00
cpuidle cpuidle: use default_groups in kobj_type 2022-01-05 18:31:17 +01:00
crypto virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes 2022-01-18 10:05:48 +02:00
cxl cxl/port: Hold port reference until decoder release 2022-02-17 16:51:13 -08:00
dax Merge branch 'akpm' (patches from Andrew) 2022-01-15 20:37:06 +02:00
dca dca: Use PTR_ERR_OR_ZERO() to simplify code 2020-05-15 16:25:20 +02:00
devfreq PM / devfreq: Reduce log severity for informative message 2021-12-16 11:29:54 +09:00
dio dio: return -ENOMEM when kzalloc() fails 2021-07-21 15:53:24 +02:00
dma dmaengine updates for v5.17-rc1 2022-01-18 14:03:34 +02:00
dma-buf drm fixes for 5.17-rc1: 2022-01-16 06:52:38 +02:00
edac - Add support for version 3 of the Synopsys DDR controller to synopsys_edac 2022-01-10 11:45:23 -08:00
eisa EISA: use DEVICE_ATTR_RO() helper macro 2021-06-04 15:28:34 +02:00
extcon extcon: Deduplicate code in extcon_set_state_sync() 2021-12-24 15:27:52 +09:00
firewire SCSI misc on 20211105 2021-11-05 08:42:02 -07:00
firmware efi: runtime: avoid EFIv2 runtime services on Apple x86 machines 2022-01-23 10:31:27 +01:00
fpga fpga: region: fix kernel-doc 2021-12-09 20:06:54 -08:00
fsi fsi: sbefifo: Use interruptible mutex locking 2021-10-22 09:54:33 +10:30
gnss gnss: usb: add support for Sierra Wireless XM1210 2021-12-22 15:38:12 +01:00
gpio gpio: sim: check the label length when setting up device properties 2022-01-24 09:20:02 +01:00
gpu drm fixes for 5.17-rc2 2022-01-28 09:43:00 +02:00
greybus greybus: es2: fix typo in a comment 2021-12-21 10:13:26 +01:00
hid HID: wacom: Avoid using stale array indicies to read contact count 2022-01-21 15:10:02 +01:00
hsi HSI: core: Fix return freed object in hsi_new_client 2021-11-26 00:27:06 +01:00
hv Drivers: hv: balloon: account for vmbus packet header in max_pkt_size 2022-01-23 22:31:23 +00:00
hwmon hwmon: (nct6775) Fix crash in clear_caseopen 2022-01-24 14:32:47 -08:00
hwspinlock hwspinlock: stm32: enable clock at probe 2021-11-17 16:12:44 -06:00
hwtracing coresight: core: Fix typo in a comment 2021-12-13 11:54:07 -07:00
i2c virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes 2022-01-18 10:05:48 +02:00
i3c i3c: master: dw: check return of dw_i3c_master_get_free_pos() 2022-01-13 02:05:50 +01:00
idle intel_idle: enable interrupts before C1 on Xeons 2021-09-24 18:44:18 +02:00
iio bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
infiniband bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2022-01-17 08:27:55 +02:00
interconnect Merge branch 'icc-qcm2290' into icc-next 2021-12-15 07:14:27 +02:00
iommu virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes 2022-01-18 10:05:48 +02:00
ipack ipack: ipoctal: rename tty-driver pointer 2021-10-04 11:21:24 +02:00
irqchip irqchip fixes for 5.17, take #1 2022-01-29 21:03:20 +01:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-12-30 12:12:12 -08:00
leds LED updates for 5.17. Nothing major is happening here. 2022-01-12 16:59:22 -08:00
macintosh macintosh/mac_hid.c: simplify subdirectory registration with register_sysctl() 2022-01-22 08:33:35 +02:00
mailbox - qcom: misc updates to qcom-ipcc driver 2022-01-13 11:19:07 -08:00
mcb mcb: fix error handling in mcb_alloc_bus() 2021-09-14 11:22:26 +02:00
md dm: properly fix redundant bio-based IO accounting 2022-01-28 12:28:15 -07:00
media bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
memory MTD core changes: 2022-01-11 11:35:28 -08:00
memstick memstick: r592: Fix a UAF bug when removing the driver 2021-10-19 13:04:42 +02:00
message scsi: message: fusion: mptctl: Use dma_alloc_coherent() 2022-01-10 10:33:52 -05:00
mfd driver core changes for 5.17-rc1 2022-01-12 11:11:34 -08:00
misc eeprom: at25: Restore missing allocation 2022-01-22 13:32:48 +01:00
mmc bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
most most: usb: replace snprintf in show functions with sysfs_emit 2021-11-26 17:03:47 +01:00
mtd - added support for more BCM47XX based devices 2022-01-14 15:08:36 +01:00
mux mux: add support for delay after muxing 2021-10-21 20:02:42 +01:00
net Networking fixes for 5.17-rc2, including fixes from netfilter and can. 2022-01-27 20:58:39 +02:00
nfc nfc: st21nfca: Fix potential buffer overflows in EVT_TRANSACTION 2022-01-12 14:17:45 +00:00
ntb New AMD PCI ID for NTB, and a number of bug fixes for ntb_hw_switchtec 2022-01-17 08:14:18 +02:00
nubus proc: remove PDE_DATA() completely 2022-01-22 08:33:37 +02:00
nvdimm cxl: Prove CXL locking 2022-02-08 22:57:29 -08:00
nvme nvme-fabrics: remove the unneeded ret variable in nvmf_dev_show 2022-01-27 08:17:17 +01:00
nvmem nvmem: mtk-efuse: support minimum one byte access stride and granularity 2021-12-21 10:26:50 +01:00
of Devicetree fixes for v5.17, take 1: 2022-01-22 09:52:17 +02:00
opp opp: Fix return in _opp_add_static_v2() 2021-10-08 13:24:46 +05:30
parisc Merge branch 'akpm' (patches from Andrew) 2022-01-22 11:28:23 +02:00
parport parisc architecture updates for kernel 5.15: 2021-09-02 13:16:00 -07:00
pci pci-v5.17-fixes-2 2022-01-29 19:05:47 +02:00
pcmcia pci-v5.17-changes 2022-01-16 08:08:11 +02:00
perf Rework of the MSI interrupt infrastructure: 2022-01-13 09:05:29 -08:00
phy Char/Misc and other driver changes for 5.17-rc1 2022-01-14 16:02:28 +01:00
pinctrl Pin control bulk changes for the v5.17 kernel cycle 2022-01-12 10:56:08 -08:00
platform proc: remove PDE_DATA() completely 2022-01-22 08:33:37 +02:00
pnp proc: remove PDE_DATA() completely 2022-01-22 08:33:37 +02:00
power platform-drivers-x86 for v5.17-1 2022-01-11 11:26:57 -08:00
powercap Merge back earlier power capping changes for v5.17 2021-12-27 16:51:12 +01:00
pps pps: clients: parport: Switch to use module_parport_driver() 2021-07-29 17:29:14 +02:00
ps3 powerpc/ps3: Warn on PS3 device errors 2021-06-10 21:44:58 +10:00
ptp net: fix SOF_TIMESTAMPING_BIND_PHC to work with multiple sockets 2022-01-06 12:18:08 +00:00
pwm pwm: Changes for v5.17-rc1 2022-01-20 13:25:01 +02:00
rapidio rapidio: remove not used code about RIO_VID_TUNDRA 2021-12-21 10:22:19 +01:00
ras RAS/CEC: Remove a repeated 'an' in a comment 2021-12-11 11:55:27 +01:00
regulator regulator: Add MAX20086-MAX20089 driver 2022-01-07 13:36:35 +00:00
remoteproc remoteproc: qcom: q6v5: fix service routines build errors 2022-01-17 16:44:26 -06:00
reset SoC: Add support for StarFive JH7100 RISC-V SoC 2022-01-10 08:32:37 -08:00
rpmsg rpmsg fixes for v5.17-rc1 2022-01-27 11:23:26 +02:00
rtc rtc: sunplus: fix return value in sp_rtc_probe() 2022-01-16 23:50:34 +01:00
s390 scsi: zfcp: Fix failed recovery on gone remote port with non-NPIV FCP devices 2022-01-24 23:30:27 -05:00
sbus module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
scsi scsi: myrs: Fix crash in error case 2022-01-25 00:09:41 -05:00
sh maple: fix wrong return value of maple_bus_init(). 2021-09-17 14:00:09 -04:00
siox bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
slimbus Driver core update for 5.15-rc1 2021-09-01 08:44:42 -07:00
soc bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
soundwire Char/Misc and other driver changes for 5.17-rc1 2022-01-14 16:02:28 +01:00
spi sound updates for 5.17-rc1 2022-01-14 14:55:38 +01:00
spmi spmi: spmi-pmic-arb: fix irq_set_type race condition 2021-12-17 17:18:18 +01:00
ssb ssb: Use dev_driver_string() instead of pci_dev->driver->name 2021-10-12 17:50:12 -05:00
staging Merge branch 'signal-for-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2022-01-17 05:49:30 +02:00
target scsi: target: iscsi: Make sure the np under each tpg is unique 2022-01-24 23:30:24 -05:00
tc The main MIPS changes for 5.6: 2020-01-31 11:28:31 -08:00
tee ARM: SoC driver updates for v5.17 2022-01-10 08:13:52 -08:00
thermal thermal: int340x: Add Raptor Lake PCI device id 2022-01-17 19:48:07 +01:00
thunderbolt thunderbolt: Add module parameter for CLx disabling 2021-12-28 10:43:56 +03:00
tty serial: core: Initialize rs485 RTS polarity already on probe 2022-01-26 14:53:12 +01:00
uio UIO: use default_groups in kobj_type 2021-12-29 10:54:50 +01:00
usb usb: cdnsp: Fix segmentation fault in cdns_lost_power function 2022-01-26 14:11:16 +01:00
vdpa virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes 2022-01-18 10:05:48 +02:00
vfio VFIO updates for v5.17-rc1 2022-01-20 13:31:46 +02:00
vhost vdpa: Protect vdpa reset with cf_mutex 2022-01-14 18:50:54 -05:00
video video: hyperv_fb: Fix validation of screen resolution 2022-01-24 14:01:12 +00:00
virt bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
virtio vdpa: Allow to configure max data virtqueues 2022-01-14 18:50:53 -05:00
visorbus visorbus: fix error return code in visorchipset_init() 2021-06-04 15:27:26 +02:00
vlynq bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
vme bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
w1 w1: w1_therm: use swap() to make code cleaner 2021-12-21 10:38:13 +01:00
watchdog linux-watchdog 5.17-rc1 tag 2022-01-17 08:07:57 +02:00
xen arm/xen: Read extended regions from DT and init Xen resource 2022-01-06 09:53:41 +01:00
zorro proc: remove PDE_DATA() completely 2022-01-22 08:33:37 +02:00
Kconfig firmware: include drivers/firmware/Kconfig unconditionally 2021-10-07 16:51:26 +02:00
Makefile virtio: always enter drivers/virtio/ 2021-12-08 14:53:15 -05:00