netfilter: xtables: compute exact size needed for jumpstack
[firefly-linux-kernel-4.4.55.git] / net / netfilter / x_tables.c
index d324fe71260c9f24b02507e4f429c0ba1e328d98..4db7d60d42faeb8a4d6bbd9ce1e6f8040eb0d838 100644 (file)
@@ -749,6 +749,10 @@ static int xt_jumpstack_alloc(struct xt_table_info *i)
        if (i->jumpstack == NULL)
                return -ENOMEM;
 
+       /* ruleset without jumps -- no stack needed */
+       if (i->stacksize == 0)
+               return 0;
+
        i->stacksize *= xt_jumpstack_multiplier;
        size = sizeof(void *) * i->stacksize;
        for_each_possible_cpu(cpu) {