cxl: fix possible null-ptr-deref in cxl_pci_init_afu|adapter()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ f204e0b8cedd7da1dfcfd05ed6b7692737e24029 · < 22511eefa61db26e12c97dd7ada3071dbdfcb004| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
cxl: fix possible null-ptr-deref in cxl_pci_init_afu|adapter()
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.
From the CVE record · Linux
The Linux kernel CXL PCI initialization code can dereference a null pointer if device registration fails and the error path attempts to unregister a device that was never added. The input does not specify an attacker action, access requirements, or whether user interaction is needed.
Engineers running the Linux kernel should check whether their kernel is affected; the input does not identify affected versions.