From: Patrick McHardy Date: Thu, 8 May 2008 08:13:31 +0000 (-0700) Subject: macvlan: Fix memleak on device removal/crash on module removal X-Git-Tag: v2.6.26-rc2~23^2~6 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7312096454b6cd71267eaa3d0efb408e449e9ff3;p=linux-2.6 macvlan: Fix memleak on device removal/crash on module removal 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 Tested-by: Ben Greear Signed-off-by: David S. Miller --- diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 2056cfc624..c36a03ae9b 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -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 = {