]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv6/netfilter/ip6_tables.c
[SCSI] lpfc 8.1.2: Fixed a race condition in the PLOGI retry logic.
[linux-2.6-omap-h63xx.git] / net / ipv6 / netfilter / ip6_tables.c
index 847068fd33676cfd3b6bc510be992baf4ab8d06d..74ff56c322f47ee45b3b873e4672d0bc9c13511a 100644 (file)
@@ -978,6 +978,13 @@ do_replace(void __user *user, unsigned int len)
        if (copy_from_user(&tmp, user, sizeof(tmp)) != 0)
                return -EFAULT;
 
+       /* overflow check */
+       if (tmp.size >= (INT_MAX - sizeof(struct xt_table_info)) / NR_CPUS -
+                       SMP_CACHE_BYTES)
+               return -ENOMEM;
+       if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters))
+               return -ENOMEM;
+
        newinfo = xt_alloc_table_info(tmp.size);
        if (!newinfo)
                return -ENOMEM;