From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: torvalds@linux-foundation.org, ebiederm@xmission.com,
opurdila@ixiacom.com, mingo@elte.hu, mhocko@suse.cz,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
netdev <netdev@vger.kernel.org>
Subject: [PATCH 1/2] net: dont leave active on stack LIST_HEAD
Date: Fri, 18 Feb 2011 09:54:38 +0100 [thread overview]
Message-ID: <1298019278.2595.83.camel@edumazet-laptop> (raw)
In-Reply-To: <1298014191.2642.11.camel@edumazet-laptop>
From: Linus Torvalds <torvalds@linux-foundation.org>
Eric W. Biderman and Michal Hocko reported various memory corruptions
that we suspected to be related to a LIST head located on stack, that
was manipulated after thread left function frame (and eventually exited,
so its stack was freed and reused).
Eric Dumazet suggested the problem was probably coming from commit
443457242beb (net: factorize
sync-rcu call in unregister_netdevice_many)
This patch fixes __dev_close() and dev_close() to properly deinit their
respective LIST_HEAD(single) before exiting.
References: https://lkml.org/lkml/2011/2/16/304
References: https://lkml.org/lkml/2011/2/14/223
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>
---
net/core/dev.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 8e726cb..a18c164 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1280,10 +1280,13 @@ static int __dev_close_many(struct list_head *head)
static int __dev_close(struct net_device *dev)
{
+ int retval;
LIST_HEAD(single);
list_add(&dev->unreg_list, &single);
- return __dev_close_many(&single);
+ retval = __dev_close_many(&single);
+ list_del(&single);
+ return retval;
}
int dev_close_many(struct list_head *head)
@@ -1325,7 +1328,7 @@ int dev_close(struct net_device *dev)
list_add(&dev->unreg_list, &single);
dev_close_many(&single);
-
+ list_del(&single);
return 0;
}
EXPORT_SYMBOL(dev_close);
--
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>
next prev parent reply other threads:[~2011-02-18 8:54 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-16 18:52 BUG: Bad page map in process udevd (anon_vma: (null)) in 2.6.38-rc4 Michal Hocko
2011-02-16 19:37 ` Ingo Molnar
2011-02-16 19:50 ` Linus Torvalds
2011-02-16 20:09 ` Linus Torvalds
2011-02-16 20:51 ` Linus Torvalds
2011-02-17 9:09 ` Michal Hocko
2011-02-17 16:13 ` Linus Torvalds
2011-02-17 16:26 ` Michal Hocko
2011-02-17 16:35 ` Ingo Molnar
2011-02-17 18:57 ` Eric W. Biederman
2011-02-17 19:11 ` Linus Torvalds
2011-02-17 19:31 ` Eric W. Biederman
2011-02-18 3:16 ` Eric W. Biederman
2011-02-18 4:30 ` Linus Torvalds
2011-02-18 4:36 ` David Miller
2011-02-18 6:25 ` Eric Dumazet
2011-02-18 7:29 ` Eric Dumazet
2011-02-18 8:54 ` Eric Dumazet [this message]
2011-02-18 20:14 ` [PATCH 1/2] net: dont leave active on stack LIST_HEAD David Miller
2011-02-18 4:38 ` BUG: Bad page map in process udevd (anon_vma: (null)) in 2.6.38-rc4 Linus Torvalds
2011-02-18 4:40 ` David Miller
2011-02-18 4:57 ` Linus Torvalds
2011-02-18 8:29 ` Eric W. Biederman
2011-02-18 5:20 ` Eric W. Biederman
2011-02-18 8:41 ` Eric Dumazet
2011-02-18 8:59 ` [PATCH 2/2] net: deinit automatic LIST_HEAD Eric Dumazet
2011-02-18 20:14 ` David Miller
2011-02-18 12:29 ` BUG: Bad page map in process udevd (anon_vma: (null)) in 2.6.38-rc4 Michal Hocko
2011-02-18 16:26 ` Michal Hocko
2011-02-18 16:39 ` Linus Torvalds
2011-02-18 18:08 ` 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
2011-02-18 19:56 ` David Miller
2011-02-19 6:22 ` Eric W. Biederman
2011-02-19 15:33 ` Linus Torvalds
2011-02-20 2:01 ` Eric W. Biederman
2011-02-20 6:15 ` Linus Torvalds
2011-02-20 8:27 ` Eric Dumazet
2011-02-20 19:53 ` David Miller
2011-02-20 21:34 ` Eric W. Biederman
2011-02-18 8:54 ` Michal Hocko
2011-02-20 12:43 ` Ingo Molnar
2011-02-17 16:36 ` Eric Dumazet
2011-02-17 17:07 ` Linus Torvalds
2011-02-17 19:36 ` Eric Dumazet
2011-02-17 20:18 ` Linus Torvalds
2011-02-16 20:13 ` Ingo Molnar
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=1298019278.2595.83.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=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