In the Linux kernel, the following vulnerability has been resolved:
net: mdio: fix unbalanced fwnode reference count in mdiodevicerelease()
There is warning report about of_node refcount leak while probing mdio device:
OF: ERROR: memory leak, expected refcount 1 instead of 2, ofnodeget()/ofnodeput() unbalanced - destroy cset entry: attach overlay node /spi/soc@0/mdio@710700c0/ethernet@4
In ofmdiobusregisterdevice(), we increase fwnode refcount by fwnodehandleget() before associating the ofnode with mdio device, but it has never been decreased in normal path. Since that, in mdiodevicerelease(), it needs to call fwnodehandleput() in addition instead of calling kfree() directly.
After above, just calling mdiodevicefree() in the error handle path of ofmdiobusregister_device() is enough to keep the refcount balanced.