netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: David Miller <davem@davemloft.net>
Cc: Linux Containers <containers@lists.osdl.org>,
	<netdev@vger.kernel.org>, Alexey Dobriyan <adobriyan@gmail.com>,
	"Denis V. Lunev" <den@openvz.org>
Subject: Re: [PATCH 1/3] netns: Fix icmp shutdown.
Date: Fri, 20 Feb 2009 07:52:36 -0800	[thread overview]
Message-ID: <m1bpsxhzqz.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <m1ocwxi00a.fsf@fess.ebiederm.org> (Eric W. Biederman's message of "Fri\, 20 Feb 2009 07\:47\:01 -0800")


Recently I had a kernel panic in icmp_send during a network namespace
cleanup.  There were packets in the arp queue that failed to be sent
and we attempted to generate an ICMP host unreachable message, but
failed because icmp_sk_exit had already been called.

The network devices are removed from a network namespace and their
arp queues are flushed before we do attempt to shutdown subsystems
so this error should have been impossible.

It turns out icmp_init is using register_pernet_device instead
of register_pernet_subsys.  Which resulted in icmp being shut down
while we still had the possibility of packets in flight, making
a nasty NULL pointer deference in interrupt context possible.

Changing this to register_pernet_subsys fixes the problem in
my testing.

Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
---
 net/ipv4/icmp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 382800a..3f50807 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -1207,7 +1207,7 @@ static struct pernet_operations __net_initdata icmp_sk_ops = {
 
 int __init icmp_init(void)
 {
-	return register_pernet_device(&icmp_sk_ops);
+	return register_pernet_subsys(&icmp_sk_ops);
 }
 
 EXPORT_SYMBOL(icmp_err_convert);
-- 
1.6.1.2.350.g88cc


  reply	other threads:[~2009-02-20 15:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20 15:47 [PATCH 0/3] Fix Network namespace shutdown take 2 Eric W. Biederman
2009-02-20 15:52 ` Eric W. Biederman [this message]
2009-02-20 15:53   ` [PATCH 2/3] tcp: Like icmp use register_pernet_subsys Eric W. Biederman
     [not found]     ` <m163j5hzow.fsf_-_-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
2009-02-20 15:57       ` Denis V. Lunev
2009-02-22  8:10         ` David Miller
2009-02-20 16:02     ` [PATCH 3/3] netns: Remove net_alive Eric W. Biederman
2009-02-22  8:11       ` David Miller
     [not found]   ` <m1bpsxhzqz.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
2009-02-20 15:57     ` [PATCH 1/3] netns: Fix icmp shutdown Denis V. Lunev
2009-02-22  8:09       ` David Miller
2009-02-25 12:43 ` [PATCH 0/3] Fix Network namespace shutdown take 2 Daniel Lezcano
2009-03-03  9:07   ` David Miller
2009-03-05 12:35     ` Daniel Lezcano

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=m1bpsxhzqz.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=adobriyan@gmail.com \
    --cc=containers@lists.osdl.org \
    --cc=davem@davemloft.net \
    --cc=den@openvz.org \
    --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).