netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Linux Netdev List <netdev@vger.kernel.org>,
	Ben Greear <greearb@candelatech.com>
Subject: [MACVLAN]: Fix memleak on device removal/crash on module removal
Date: Wed, 07 May 2008 09:43:40 +0200	[thread overview]
Message-ID: <48215DAC.1070704@trash.net> (raw)

[-- 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 = {

             reply	other threads:[~2008-05-07  7:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-07  7:43 Patrick McHardy [this message]
2008-05-07 22:03 ` [MACVLAN]: Fix memleak on device removal/crash on module removal 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48215DAC.1070704@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=greearb@candelatech.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).