]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[EBTABLES]: Deal with the worst-case behaviour in loop checks.
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 4 Dec 2006 12:12:43 +0000 (13:12 +0100)
committerAdrian Bunk <bunk@stusta.de>
Mon, 4 Dec 2006 12:12:43 +0000 (13:12 +0100)
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>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
net/bridge/netfilter/ebtables.c

index 609d52065f48ad82a95c4d417755d999214f8659..12a57ae1cead865acc0ad069574dfc22426b746a 100644 (file)
@@ -738,7 +738,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);