]> err.no Git - linux-2.6/commitdiff
[EBTABLES]: Deal with the worst-case behaviour in loop checks.
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 1 Dec 2006 03:24:49 +0000 (19:24 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:31:55 +0000 (21:31 -0800)
No need to revisit a chain we'd already finished with during
the check for current hook.  It's either instant loop (which
we'd just detected) or a duplicate work.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/netfilter/ebtables.c

index 6ab7674ea45492c9f460453acf3910d97194de9f..46ab9b759269db745ad21bfd13acca3f759dc969 100644 (file)
@@ -717,7 +717,9 @@ static int check_chainloops(struct ebt_entries *chain, struct ebt_cl_stack *cl_s
                                BUGPRINT("loop\n");
                                return -1;
                        }
-                       /* this can't be 0, so the above test is correct */
+                       if (cl_s[i].hookmask & (1 << hooknr))
+                               goto letscontinue;
+                       /* this can't be 0, so the loop test is correct */
                        cl_s[i].cs.n = pos + 1;
                        pos = 0;
                        cl_s[i].cs.e = ((void *)e + e->next_offset);