diff options
-rw-r--r-- | include/linux/netfilter/xt_cluster.h | 2 | ||||
-rw-r--r-- | net/netfilter/xt_cluster.c | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/netfilter/xt_cluster.h b/include/linux/netfilter/xt_cluster.h index 5e0a0d07b526..886682656f09 100644 --- a/include/linux/netfilter/xt_cluster.h +++ b/include/linux/netfilter/xt_cluster.h | |||
@@ -12,4 +12,6 @@ struct xt_cluster_match_info { | |||
12 | u_int32_t flags; | 12 | u_int32_t flags; |
13 | }; | 13 | }; |
14 | 14 | ||
15 | #define XT_CLUSTER_NODES_MAX 32 | ||
16 | |||
15 | #endif /* _XT_CLUSTER_MATCH_H */ | 17 | #endif /* _XT_CLUSTER_MATCH_H */ |
diff --git a/net/netfilter/xt_cluster.c b/net/netfilter/xt_cluster.c index 6c4847662b85..69a639f35403 100644 --- a/net/netfilter/xt_cluster.c +++ b/net/netfilter/xt_cluster.c | |||
@@ -135,7 +135,13 @@ static bool xt_cluster_mt_checkentry(const struct xt_mtchk_param *par) | |||
135 | { | 135 | { |
136 | struct xt_cluster_match_info *info = par->matchinfo; | 136 | struct xt_cluster_match_info *info = par->matchinfo; |
137 | 137 | ||
138 | if (info->node_mask >= (1 << info->total_nodes)) { | 138 | if (info->total_nodes > XT_CLUSTER_NODES_MAX) { |
139 | printk(KERN_ERR "xt_cluster: you have exceeded the maximum " | ||
140 | "number of cluster nodes (%u > %u)\n", | ||
141 | info->total_nodes, XT_CLUSTER_NODES_MAX); | ||
142 | return false; | ||
143 | } | ||
144 | if (info->node_mask >= (1ULL << info->total_nodes)) { | ||
139 | printk(KERN_ERR "xt_cluster: this node mask cannot be " | 145 | printk(KERN_ERR "xt_cluster: this node mask cannot be " |
140 | "higher than the total number of nodes\n"); | 146 | "higher than the total number of nodes\n"); |
141 | return false; | 147 | return false; |