public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Patrick McHardy <kaber@trash.net>
Cc: Jan Engelhardt <jengelh@medozas.de>, Avi Kivity <avi@redhat.com>,
	netfilter-devel@vger.kernel.org,
	Marcelo Tosatti <mtosatti@redhat.com>,
	nicolas prochazka <prochazka.nicolas@gmail.com>,
	KVM list <kvm@vger.kernel.org>, netdev <netdev@vger.kernel.org>
Subject: Re: Possible netfilter-related memory corruption in 2.6.37
Date: Fri, 18 Feb 2011 20:14:55 +0100	[thread overview]
Message-ID: <1298056495.2425.26.camel@edumazet-laptop> (raw)
In-Reply-To: <4D5EBC6D.6070200@trash.net>

Le vendredi 18 février 2011 à 19:37 +0100, Patrick McHardy a écrit :
> Am 14.02.2011 17:52, schrieb Patrick McHardy:
> > Am 14.02.2011 17:48, schrieb Eric Dumazet:
> >> I am not sure, but I guess nf_reinject() needs a fix too ;)
> > 
> > I agree. That one looks uglier though, I guess we'll have to
> > iterate through all hooks to note the previous one.
> 
> How about this? Unfortunately I don't think we can avoid
> iterating through all hooks without violating RCU rules.
> 
> 

       /* Continue traversal iff userspace said ok... */
        if (verdict == NF_REPEAT) {
-               elem = elem->prev;
-               verdict = NF_ACCEPT;
+               prev = NULL;
+               list_for_each_entry_rcu(i,
&nf_hooks[entry->pf][entry->hook],
+                                       list) {
+                       if (&i->list == elem)
+                               break;
+                       prev = i;

	
Hmm... what happens if "elem" was the first elem in list ?

We exit with prev = NULL  --> NF_DROP ?

I must miss something...

+               }
+
+               if (prev == NULL ||
+                   &i->list == &nf_hooks[entry->pf][entry->hook])
+                       verdict = NF_DROP;
+               else {
+                       elem = &prev->list;
+                       verdict = NF_ACCEPT;
+               }
        }



--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2011-02-18 19:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14 14:58 Possible netfilter-related memory corruption in 2.6.37 Avi Kivity
2011-02-14 15:11 ` Eric Dumazet
2011-02-14 15:18   ` Jan Engelhardt
2011-02-14 15:50     ` Eric Dumazet
2011-02-14 16:24       ` Patrick McHardy
2011-02-14 16:29         ` Eric Dumazet
2011-02-14 16:37           ` Patrick McHardy
2011-02-14 16:48             ` Eric Dumazet
2011-02-14 16:52               ` Patrick McHardy
2011-02-18 18:37                 ` Patrick McHardy
2011-02-18 19:14                   ` Eric Dumazet [this message]

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=1298056495.2425.26.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=avi@redhat.com \
    --cc=jengelh@medozas.de \
    --cc=kaber@trash.net \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=prochazka.nicolas@gmail.com \
    /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