of: unittest: fix use-after-free in testdrv_probe()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
of: unittest: fix use-after-free in testdrv_probe()
The function testdrv_probe() retrieves the device_node from the PCI device, applies an overlay, and then immediately calls of_node_put(dn). This releases the reference held by the PCI core, potentially freeing the node if the reference count drops to zero. Later, the same freed pointer 'dn' is passed to of_platform_default_populate(), leading to a use-after-free.
The reference to pdev->dev.of_node is owned by the device model and should not be released by the driver. Remove the erroneous of_node_put() to prevent premature freeing.
From the CVE record · Linux
In the Linux kernel’s OF unittest, testdrv_probe() can release a device-node reference owned by the device model, then pass the potentially freed node to of_platform_default_populate(). The input does not specify how an attacker could trigger this or whether access or user interaction is required.
Engineers running the Linux kernel should check whether their builds include the affected OF unittest code; affected versions are not specified.