mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 23:24:50 +00:00
ipvs: check that ip_vs_conn_tab_bits is between 8 and 20
[ Upstream commit69e73dbfda
] 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:6f7edb4881
("IPVS: Allow boot time change of hash size") Reported-by: Yi Chen <yiche@redhat.com> Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Acked-by: Julian Anastasov <ja@ssi.bg> Acked-by: Simon Horman <horms@verge.net.au> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
9a571d83ac
commit
2c30592255
1 changed files with 4 additions and 0 deletions
|
@ -1394,6 +1394,10 @@ int __init ip_vs_conn_init(void)
|
|||
int idx;
|
||||
|
||||
/* 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_mask = ip_vs_conn_tab_size - 1;
|
||||
|
||||
|
|
Loading…
Reference in a new issue