In the Linux kernel, the following vulnerability has been resolved:
net: macb: fix unregisternetdev call order in macbremove()
When removing a macb device, the driver calls phyexit() before unregisternetdev(). This leads to a WARN from kernfs:
------------[ cut here ]------------ kernfs: can not remove 'attacheddev', no directory WARNING: CPU: 1 PID: 27146 at fs/kernfs/dir.c:1683 Call trace: kernfsremovebynamens+0xd8/0xf0 sysfsremovelink+0x24/0x58 phydetach+0x5c/0x168 phydisconnect+0x4c/0x70 phylinkdisconnectphy+0x6c/0xc0 [phylink] macbclose+0x6c/0x170 [macb] ... macbremove+0x60/0x168 [macb] platformremove+0x5c/0x80 ...
The warning happens because the PHY is being exited while the netdev is still registered. The correct order is to unregister the netdev before shutting down the PHY and cleaning up the MDIO bus.
Fix this by moving unregisternetdev() ahead of phyexit() in macb_remove().