aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/macvlan.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-05-08 04:13:31 -0400
committerDavid S. Miller <davem@davemloft.net>2008-05-08 04:13:31 -0400
commit7312096454b6cd71267eaa3d0efb408e449e9ff3 (patch)
tree360362755ece7d7ad589bfb968ff69681a4aefa3 /drivers/net/macvlan.c
parentc67fa02799bccca3d2e16582493da6d57812ec01 (diff)
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 <kaber@trash.net> Tested-by: Ben Greear <greearb@candelatech.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/macvlan.c')
-rw-r--r--drivers/net/macvlan.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 2056cfc624dc..c36a03ae9bfb 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -450,7 +450,7 @@ static void macvlan_dellink(struct net_device *dev)
450 unregister_netdevice(dev); 450 unregister_netdevice(dev);
451 451
452 if (list_empty(&port->vlans)) 452 if (list_empty(&port->vlans))
453 macvlan_port_destroy(dev); 453 macvlan_port_destroy(port->dev);
454} 454}
455 455
456static struct rtnl_link_ops macvlan_link_ops __read_mostly = { 456static struct rtnl_link_ops macvlan_link_ops __read_mostly = {