]> git.hungrycats.org Git - linux/commitdiff
[PATCH] EBTABLES: Deal with the worst-case behaviour in loop checks.
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 1 Dec 2006 03:47:58 +0000 (19:47 -0800)
committerChris Wright <chrisw@sous-sol.org>
Sun, 17 Dec 2006 00:20:46 +0000 (16:20 -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>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
net/bridge/netfilter/ebtables.c

index 0fb2852ac59ca77959d1ec2fb31674a2fa1a04da..361d20bc9e6cf1b624d5c73e7a5345d6dc4cbbfc 100644 (file)
@@ -739,7 +739,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);