]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
macvlan: Fix memleak on device removal/crash on module removal
authorPatrick McHardy <kaber@trash.net>
Thu, 8 May 2008 08:13:31 +0000 (01:13 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 15 May 2008 14:50:02 +0000 (07:50 -0700)
[ Upstream commit: 7312096454b6cd71267eaa3d0efb408e449e9ff3 ]

As noticed by Ben Greear, macvlan crashes the kernel when unloading the
module. The reason is that it tries to clean up the macvlan_port pointer
on the macvlan device itself instead of the underlying device. A non-NULL
pointer is taken as indication that the macvlan_handle_frame_hook is
valid, when receiving the next packet on the underlying device it tries
to call the NULL hook and crashes.

Clean up the macvlan_port on the correct device to fix this.

Signed-off-by; Patrick McHardy <kaber@trash.net>
Tested-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/macvlan.c

index f651a816b280bfcb04d1d6fdda8d12e2819b4ce5..34c2b9845c8b9b8e3452dac51bde03fad1b6e890 100644 (file)
@@ -450,7 +450,7 @@ static void macvlan_dellink(struct net_device *dev)
        unregister_netdevice(dev);
 
        if (list_empty(&port->vlans))
-               macvlan_port_destroy(dev);
+               macvlan_port_destroy(port->dev);
 }
 
 static struct rtnl_link_ops macvlan_link_ops __read_mostly = {