public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: torvalds@linux-foundation.org, ebiederm@xmission.com,
	mingo@elte.hu, opurdila@ixiacom.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org, mhocko@suse.cz,
	netdev <netdev@vger.kernel.org>,
	stable@kernel.org
Subject: [PATCH 2/2] net: deinit automatic LIST_HEAD
Date: Fri, 18 Feb 2011 09:59:19 +0100	[thread overview]
Message-ID: <1298019559.2595.92.camel@edumazet-laptop> (raw)
In-Reply-To: <m17hcx7wca.fsf@fess.ebiederm.org>

commit 9b5e383c11b08784 (net: Introduce
unregister_netdevice_many()) left an active LIST_HEAD() in
rollback_registered(), with possible memory corruption.

Even if device is freed without touching its unreg_list (and therefore
touching the previous memory location holding LISTE_HEAD(single), better
close the bug for good, since its really subtle.

(Same fix for default_device_exit_batch() for completeness)

Reported-by: Michal Hocko <mhocko@suse.cz>
Reported-by: Eric W. Biderman <ebiderman@xmission.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Ingo Molnar <mingo@elte.hu>
CC: Octavian Purdila <opurdila@ixiacom.com>
CC: Eric W. Biderman <ebiderman@xmission.com>
CC: stable <stable@kernel.org> [.33+]
---
 net/core/dev.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index a18c164..8ae6631 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5066,6 +5066,7 @@ static void rollback_registered(struct net_device *dev)
 
 	list_add(&dev->unreg_list, &single);
 	rollback_registered_many(&single);
+	list_del(&single);
 }
 
 unsigned long netdev_fix_features(unsigned long features, const char *name)
@@ -6219,6 +6220,7 @@ static void __net_exit default_device_exit_batch(struct list_head *net_list)
 		}
 	}
 	unregister_netdevice_many(&dev_kill_list);
+	list_del(&dev_kill_list);
 	rtnl_unlock();
 }
 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2011-02-18  8:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20110216185234.GA11636@tiehlicka.suse.cz>
     [not found] ` <20110216193700.GA6377@elte.hu>
     [not found]   ` <AANLkTinDxxbVjrUViCs=UaMD9Wg9PR7b0ShNud5zKE3w@mail.gmail.com>
     [not found]     ` <AANLkTi=xnbcs5BKj3cNE_aLtBO7W5m+2uaUacu7M8g_S@mail.gmail.com>
     [not found]       ` <20110217090910.GA3781@tiehlicka.suse.cz>
     [not found]         ` <AANLkTikPKpNHxDQAYBd3fiQsmVozLtCVDsNn=+eF_q2r@mail.gmail.com>
     [not found]           ` <20110217163531.GF14168@elte.hu>
     [not found]             ` <m1pqqqfpzh.fsf@fess.ebiederm.org>
     [not found]               ` <AANLkTinB=EgDGNv-v-qD-MvHVAmstfP_CyyLNhhotkZx@mail.gmail.com>
     [not found]                 ` <m1sjvm822m.fsf@fess.ebiederm.org>
     [not found]                   ` <AANLkTimzP0UNRXutkt1zJ+OGhmeg6ga87HFyMuZQmpMj@mail.gmail.com>
     [not found]                     ` <20110217.203647.193696765.davem@davemloft.net>
     [not found]                       ` <1298010320.2642.7.camel@edumazet-laptop>
     [not found]                         ` <1298014191.2642.11.camel@edumazet-laptop>
2011-02-18  8:54                           ` [PATCH 1/2] net: dont leave active on stack LIST_HEAD Eric Dumazet
2011-02-18 20:14                             ` David Miller
     [not found]                     ` <m17hcx7wca.fsf@fess.ebiederm.org>
2011-02-18  8:59                       ` Eric Dumazet [this message]
2011-02-18 20:14                         ` [PATCH 2/2] net: deinit automatic LIST_HEAD David Miller
     [not found]                 ` <20110218122938.GB26779@tiehlicka.suse.cz>
     [not found]                   ` <20110218162623.GD4862@tiehlicka.suse.cz>
     [not found]                     ` <AANLkTimO=M5xG_mnDBSxPKwSOTrp3JhHVBa8=wHsiVHY@mail.gmail.com>
2011-02-18 18:08                       ` BUG: Bad page map in process udevd (anon_vma: (null)) in 2.6.38-rc4 Eric W. Biederman
2011-02-18 18:48                         ` Linus Torvalds
2011-02-18 19:01                           ` Arnaldo Carvalho de Melo
2011-02-18 19:11                             ` Arnaldo Carvalho de Melo
2011-02-18 20:38                               ` Eric W. Biederman
2011-02-19  8:35                                 ` [PATCH] tcp: fix inet_twsk_deschedule() Eric Dumazet
2011-02-20  2:59                                   ` David Miller
2011-02-18 19:13                             ` BUG: Bad page map in process udevd (anon_vma: (null)) in 2.6.38-rc4 Eric Dumazet

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=1298019559.2595.92.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    --cc=opurdila@ixiacom.com \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.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