提交 69e73dbf 编写于 作者: A Andrea Claudi 提交者: Pablo Neira Ayuso

ipvs: check that ip_vs_conn_tab_bits is between 8 and 20

ip_vs_conn_tab_bits may be provided by the user through the
conn_tab_bits module parameter. If this value is greater than 31, or
less than 0, the shift operator used to derive tab_size causes undefined
behaviour.

Fix this checking ip_vs_conn_tab_bits value to be in the range specified
in ipvs Kconfig. If not, simply use default value.

Fixes: 6f7edb48 ("IPVS: Allow boot time change of hash size")
Reported-by: NYi Chen <yiche@redhat.com>
Signed-off-by: NAndrea Claudi <aclaudi@redhat.com>
Acked-by: NJulian Anastasov <ja@ssi.bg>
Acked-by: NSimon Horman <horms@verge.net.au>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
上级 7bbc3d38
...@@ -1468,6 +1468,10 @@ int __init ip_vs_conn_init(void) ...@@ -1468,6 +1468,10 @@ int __init ip_vs_conn_init(void)
int idx; int idx;
/* Compute size and mask */ /* Compute size and mask */
if (ip_vs_conn_tab_bits < 8 || ip_vs_conn_tab_bits > 20) {
pr_info("conn_tab_bits not in [8, 20]. Using default value\n");
ip_vs_conn_tab_bits = CONFIG_IP_VS_TAB_BITS;
}
ip_vs_conn_tab_size = 1 << ip_vs_conn_tab_bits; ip_vs_conn_tab_size = 1 << ip_vs_conn_tab_bits;
ip_vs_conn_tab_mask = ip_vs_conn_tab_size - 1; ip_vs_conn_tab_mask = ip_vs_conn_tab_size - 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册