netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <dlezcano@fr.ibm.com>
To: David Miller <davem@davemloft.net>
Cc: Alexey Dobriyan <adobriyan@sw.ru>, "Denis V. Lunev" <den@sw.ru>,
	Linux Netdev List <netdev@vger.kernel.org>,
	Pavel Emelianov <xemul@openvz.org>,
	devel@openvz.org
Subject: [PATCH net-2.6.25][NET_NS][IPV6] fix ip6_frags.ctl oops
Date: Fri, 18 Jan 2008 15:19:36 +0100	[thread overview]
Message-ID: <4790B578.10303@fr.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: fix-ip6frag-sysctl-oops.patch --]
[-- Type: text/x-patch, Size: 1402 bytes --]

Subject: fix ip6_frag ctl
From: Daniel Lezcano <dlezcano@fr.ibm.com>

Alexey Dobriyan reported an oops when unsharing the network
indefinitely inside a loop. This is because the ip6_frag is not per
namespace while the ctls are.

That happens at the fragment timer expiration: inet_frag_secret_rebuild 
function is called and this one restarts the timer using the value stored
inside the sysctl field.

        "mod_timer(&f->secret_timer, now + f->ctl->secret_interval);"

When the network is unshared, ip6_frag.ctl is initialized with the new
sysctl instances, but ip6_frag has only one instance. A race in this case
will appear because f->ctl can be modified during the read access in the 
timer callback.

Until the ip6_frag is not per namespace, I discard the assignation to the 
ctl field of ip6_frags in ip6_frag_sysctl_init when the network namespace
is not the init net.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
 net/ipv6/reassembly.c |    3 +++
 1 file changed, 3 insertions(+)

Index: net-2.6.25-misc/net/ipv6/reassembly.c
===================================================================
--- net-2.6.25-misc.orig/net/ipv6/reassembly.c
+++ net-2.6.25-misc/net/ipv6/reassembly.c
@@ -627,6 +627,9 @@ static struct inet6_protocol frag_protoc
 
 void ipv6_frag_sysctl_init(struct net *net)
 {
+	if (net != &init_net)
+		return;
+
 	ip6_frags.ctl = &net->ipv6.sysctl.frags;
 }
 

             reply	other threads:[~2008-01-18 14:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-18 14:19 Daniel Lezcano [this message]
2008-01-19  7:52 ` [PATCH net-2.6.25][NET_NS][IPV6] fix ip6_frags.ctl oops David Miller

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=4790B578.10303@fr.ibm.com \
    --to=dlezcano@fr.ibm.com \
    --cc=adobriyan@sw.ru \
    --cc=davem@davemloft.net \
    --cc=den@sw.ru \
    --cc=devel@openvz.org \
    --cc=netdev@vger.kernel.org \
    --cc=xemul@openvz.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).