cxl: fix possible null-ptr-deref in cxl_guest_init_afu|adapter()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 14baf4d9c739e6e69150512d2eb23c71fffcc192 · < e5021bbf11b024cc65ea1e84c377df484183be4b| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
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.
From the CVE record · Linux
The Linux kernel’s CXL AFU and adapter initialization can dereference a null pointer if device registration fails and the error path tries to unregister a device that was never added. The input does not specify how an attacker could trigger this failure or whether access or user interaction is required.
Teams running Linux kernels with the affected CXL initialization code should check their versions; affected versions are not specified.