Skip to content

Commit

Permalink
macvlan: Fix memleak on device removal/crash on module removal
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Patrick McHardy authored and David S. Miller committed May 8, 2008
1 parent c67fa02 commit 7312096
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/macvlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 7312096

Please sign in to comment.