netfilter: xt_cluster: fix use of cluster match with 32 nodes
[safe/jmp/linux-2.6] / net / netfilter / xt_cluster.c
index 6c48476..69a639f 100644 (file)
@@ -135,7 +135,13 @@ static bool xt_cluster_mt_checkentry(const struct xt_mtchk_param *par)
 {
        struct xt_cluster_match_info *info = par->matchinfo;
 
-       if (info->node_mask >= (1 << info->total_nodes)) {
+       if (info->total_nodes > XT_CLUSTER_NODES_MAX) {
+               printk(KERN_ERR "xt_cluster: you have exceeded the maximum "
+                               "number of cluster nodes (%u > %u)\n",
+                               info->total_nodes, XT_CLUSTER_NODES_MAX);
+               return false;
+       }
+       if (info->node_mask >= (1ULL << info->total_nodes)) {
                printk(KERN_ERR "xt_cluster: this node mask cannot be "
                                "higher than the total number of nodes\n");
                return false;