From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Denis V. Lunev" Subject: Re: [PATCH 1/3] netns: Fix icmp shutdown. Date: Fri, 20 Feb 2009 18:57:02 +0300 Message-ID: <1235145422.9761.150.camel@iris.sw.ru> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: "Eric W. Biederman" Cc: Linux Containers , netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, David Miller , Alexey Dobriyan List-Id: containers.vger.kernel.org Acked-by: Denis V. Lunev On Fri, 2009-02-20 at 07:52 -0800, Eric W. Biederman wrote: > 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 > --- > 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);