netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [MACVLAN]: Fix memleak on device removal/crash on module removal
@ 2008-05-07  7:43 Patrick McHardy
  2008-05-07 22:03 ` Ben Greear
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2008-05-07  7:43 UTC (permalink / raw)
  To: David S. Miller; +Cc: Linux Netdev List, Ben Greear

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1166 bytes --]

commit 2fe876e51d1f053b55d8d50c3733b136b6add016
Author: Patrick McHardy <kaber@trash.net>
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 <kaber@trash.net>

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 2056cfc..c36a03a 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 = {

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [MACVLAN]: Fix memleak on device removal/crash on module removal
  2008-05-07  7:43 [MACVLAN]: Fix memleak on device removal/crash on module removal Patrick McHardy
@ 2008-05-07 22:03 ` Ben Greear
  2008-05-07 22:45   ` David Miller
  2008-05-08  8:14   ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Ben Greear @ 2008-05-07 22:03 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: David S. Miller, Linux Netdev List

Patrick McHardy wrote:
> 
> ------------------------------------------------------------------------
> 
> commit 2fe876e51d1f053b55d8d50c3733b136b6add016
> Author: Patrick McHardy <kaber@trash.net>
> 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

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [MACVLAN]: Fix memleak on device removal/crash on module removal
  2008-05-07 22:03 ` Ben Greear
@ 2008-05-07 22:45   ` David Miller
  2008-05-08  8:14   ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2008-05-07 22:45 UTC (permalink / raw)
  To: greearb; +Cc: kaber, netdev

From: Ben Greear <greearb@candelatech.com>
Date: Wed, 07 May 2008 15:03:19 -0700

> Patrick McHardy wrote:
> > 
> > ------------------------------------------------------------------------
> > 
> > commit 2fe876e51d1f053b55d8d50c3733b136b6add016
> > Author: Patrick McHardy <kaber@trash.net>
> > 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [MACVLAN]: Fix memleak on device removal/crash on module removal
  2008-05-07 22:03 ` Ben Greear
  2008-05-07 22:45   ` David Miller
@ 2008-05-08  8:14   ` David Miller
  2008-05-08 15:27     ` Ben Greear
  1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2008-05-08  8:14 UTC (permalink / raw)
  To: greearb; +Cc: kaber, netdev

From: Ben Greear <greearb@candelatech.com>
Date: Wed, 07 May 2008 15:03:19 -0700

> Patrick McHardy wrote:
> > 
> > ------------------------------------------------------------------------
> > 
> > commit 2fe876e51d1f053b55d8d50c3733b136b6add016
> > Author: Patrick McHardy <kaber@trash.net>
> > 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!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [MACVLAN]: Fix memleak on device removal/crash on module removal
  2008-05-08  8:14   ` David Miller
@ 2008-05-08 15:27     ` Ben Greear
  2008-05-08 15:34       ` Patrick McHardy
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Greear @ 2008-05-08 15:27 UTC (permalink / raw)
  To: David Miller; +Cc: kaber, netdev

David Miller wrote:
> From: Ben Greear <greearb@candelatech.com>
> Date: Wed, 07 May 2008 15:03:19 -0700
>
>   
>> Patrick McHardy wrote:
>>     
>>> ------------------------------------------------------------------------
>>>
>>> commit 2fe876e51d1f053b55d8d50c3733b136b6add016
>>> Author: Patrick McHardy <kaber@trash.net>
>>> 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!
>   

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

-- 
Ben Greear <greearb@candelatech.com> 
Candela Technologies Inc  http://www.candelatech.com



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [MACVLAN]: Fix memleak on device removal/crash on module removal
  2008-05-08 15:27     ` Ben Greear
@ 2008-05-08 15:34       ` Patrick McHardy
  0 siblings, 0 replies; 6+ messages in thread
From: Patrick McHardy @ 2008-05-08 15:34 UTC (permalink / raw)
  To: Ben Greear; +Cc: David Miller, netdev

Ben Greear wrote:
>>>>     [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!
>>   
> 
> 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).

> 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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-05-08 15:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-07  7:43 [MACVLAN]: Fix memleak on device removal/crash on module removal Patrick McHardy
2008-05-07 22:03 ` Ben Greear
2008-05-07 22:45   ` David Miller
2008-05-08  8:14   ` David Miller
2008-05-08 15:27     ` Ben Greear
2008-05-08 15:34       ` Patrick McHardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).