[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1298056495.2425.26.camel@edumazet-laptop>
Date: Fri, 18 Feb 2011 20:14:55 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: Patrick McHardy <kaber@...sh.net>
Cc: Jan Engelhardt <jengelh@...ozas.de>, Avi Kivity <avi@...hat.com>,
netfilter-devel@...r.kernel.org,
Marcelo Tosatti <mtosatti@...hat.com>,
nicolas prochazka <prochazka.nicolas@...il.com>,
KVM list <kvm@...r.kernel.org>, netdev <netdev@...r.kernel.org>
Subject: Re: Possible netfilter-related memory corruption in 2.6.37
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 netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists