In the Linux kernel, the following vulnerability has been resolved:
cxl/port: Hold port reference until decoder release
KASAN + DEBUGKOBJECTRELEASE reports a potential use-after-free in cxldecoderrelease() where it goes to reference its parent, a cxlport, to free its id back to port->decoderida.
BUG: KASAN: use-after-free in tocxlport+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 kobjectdelayedcleanup Call Trace: <TASK> dumpstacklvl+0x59/0x73 printaddressdescription.constprop.0+0x1f/0x150 ? tocxlport+0x18/0x90 [cxlcore] kasanreport.cold+0x83/0xdf ? tocxlport+0x18/0x90 [cxlcore] tocxlport+0x18/0x90 [cxlcore] cxldecoderrelease+0x2a/0x60 [cxlcore] devicerelease+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.