Skip to contentSkip to conversation

: Fix memleak on device removal/crash on module removal

MACVLAN Patrick McHardy 3 participants 6 messages May 7, 2008 – May 8, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

commit 2fe876e51d1f053b55d8d50c3733b136b6add016

Author: Patrick McHardy <[email protected]>
Date:   Wed May 7 09:43:05 2008 +0200

[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 <[email protected]>

drivers/net/macvlan.c +1 -1
index 2056cfc..c36a03a 100644
@@ -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 = {
#1 lore raw
Quoted 8 lines · Patrick McHardy

------------------------------------------------------------------------

commit 2fe876e51d1f053b55d8d50c3733b136b6add016

Author: Patrick McHardy <[email protected]>
Date:   Wed May 7 09:43:05 2008 +0200

[MACVLAN]: Fix memleak on device removal/crash on module removal

Thanks. I just tested this on 2.6.23 and it seems to fix the crash.

Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
maintainer
#2 lore raw

From: Ben Greear <[email protected]>
Date: Wed, 07 May 2008 15:03:19 -0700

Quoted 11 lines
Quoted 8 lines · Patrick McHardy

------------------------------------------------------------------------

commit 2fe876e51d1f053b55d8d50c3733b136b6add016

Author: Patrick McHardy <[email protected]>
Date:   Wed May 7 09:43:05 2008 +0200

[MACVLAN]: Fix memleak on device removal/crash on module removal

Thanks. I just tested this on 2.6.23 and it seems to fix the crash.

Thanks for testing Ben.

maintainer
#3 lore raw
In reply to Ben Greear

From: Ben Greear <[email protected]>
Date: Wed, 07 May 2008 15:03:19 -0700

Quoted 11 lines
Quoted 8 lines · Patrick McHardy

------------------------------------------------------------------------

commit 2fe876e51d1f053b55d8d50c3733b136b6add016

Author: Patrick McHardy <[email protected]>
Date:   Wed May 7 09:43:05 2008 +0200

[MACVLAN]: Fix memleak on device removal/crash on module removal

Thanks. I just tested this on 2.6.23 and it seems to fix the crash.

I've applied this to net-2.6, and will queue it up for net-2.6 as well.

Thanks again!

#4 lore raw
Quoted 14 lines · David Miller

From: Ben Greear <[email protected]>
Date: Wed, 07 May 2008 15:03:19 -0700

Quoted 10 lines
Quoted 8 lines · Patrick McHardy

------------------------------------------------------------------------

commit 2fe876e51d1f053b55d8d50c3733b136b6add016

Author: Patrick McHardy <[email protected]>
Date:   Wed May 7 09:43:05 2008 +0200

[MACVLAN]: Fix memleak on device removal/crash on module removal

Quoted 8 lines
Quoted 2 lines

Thanks. I just tested this on 2.6.23 and it seems to fix the crash.

I've applied this to net-2.6, and will queue it up for net-2.6 as well.

Thanks again!

This might be worth adding to any/all 2.6.23+ stable series since it's a reliable kernel crash on module unload.

I'm not sure if anyone else is really using mac-vlans much yet though...

Thanks,
Ben

Signature · 1 line
Ben Greear <[email protected]> Candela Technologies Inc  http://www.candelatech.com
#5 lore raw
Quoted 5 lines · Ben Greear
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

[MACVLAN]: Fix memleak on device removal/crash on module removal

Thanks. I just tested this on 2.6.23 and it seems to fix the crash.

Quoted 7 lines
Quoted 5 lines

I've applied this to net-2.6, and will queue it up for net-2.6 as well.

Thanks again!

This might be worth adding to any/all 2.6.23+ stable series since it's a reliable kernel crash on module unload.

I don't think there is anyone maintaining the stable kernels before stable-2.6.25 (for which I think Dave already queued it up, above appears to be a typo).

Quoted 1 line

I'm not sure if anyone else is really using mac-vlans much yet though...

I know of a few users, but not too many I guess. The fix is obvious though so it doesn't hurt for -stable in any case.