Re: [PATCH 1/3] netns: Fix icmp shutdown.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric W. Biederman
Date: Friday, February 20, 2009 - 8:52 am

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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/3] Fix Network namespace shutdown take 2, Eric W. Biederman, (Fri Feb 20, 8:47 am)
Re: [PATCH 1/3] netns: Fix icmp shutdown., Eric W. Biederman, (Fri Feb 20, 8:52 am)
[PATCH 2/3] tcp: Like icmp use register_pernet_subsys, Eric W. Biederman, (Fri Feb 20, 8:53 am)
Re: [PATCH 1/3] netns: Fix icmp shutdown., Denis V. Lunev, (Fri Feb 20, 8:57 am)
Re: [PATCH 2/3] tcp: Like icmp use register_pernet_subsys, Denis V. Lunev, (Fri Feb 20, 8:57 am)
[PATCH 3/3] netns: Remove net_alive, Eric W. Biederman, (Fri Feb 20, 9:02 am)
Re: [PATCH 1/3] netns: Fix icmp shutdown., David Miller, (Sun Feb 22, 1:09 am)
Re: [PATCH 3/3] netns: Remove net_alive, David Miller, (Sun Feb 22, 1:11 am)
Re: [PATCH 0/3] Fix Network namespace shutdown take 2, Daniel Lezcano, (Wed Feb 25, 5:43 am)
Re: [PATCH 0/3] Fix Network namespace shutdown take 2, David Miller, (Tue Mar 3, 2:07 am)
Re: [PATCH 0/3] Fix Network namespace shutdown take 2, Daniel Lezcano, (Thu Mar 5, 5:35 am)