In the Linux kernel, the following vulnerability has been resolved:
net: mediatek: Fix potential NULL pointer dereference in dummy net_device handling
Move the freeing of the dummy netdevice from mtkfreedev() to mtkremove().
Previously, if allocnetdevdummy() failed in mtkprobe(), eth->dummydev would be NULL. The error path would then call mtkfreedev(), which in turn called freenetdev() assuming dummydev was allocated (but it was not), potentially causing a NULL pointer dereference.
By moving freenetdev() to mtkremove(), we ensure it's only called when mtkprobe() has succeeded and dummydev is fully allocated. This addresses a potential NULL pointer dereference detected by Smatch[1].