In the Linux kernel, the following vulnerability has been resolved:
net: phy: leds: fix memory leak
A network restart test on a router led to an out-of-memory condition, which was traced to a memory leak in the PHY LED trigger code.
The root cause is misuse of the devm API. The registration function (phyledtriggersregister) is called from phyattachdirect, not phyprobe, and the unregister function (phyledtriggersunregister) is called from phydetach, not phy_remove. This means the register and unregister functions can be called multiple times for the same PHY device, but devm-allocated memory is not freed until the driver is unbound.
This also prevents kmemleak from detecting the leak, as the devm API internally stores the allocated pointer.
Fix this by replacing devmkzalloc/devmkcalloc with standard kzalloc/kcalloc, and add the corresponding kfree calls in the unregister path.