ipvs: check that ip_vs_conn_tab_bits is between 8 and 20
authorAndrea Claudi <aclaudi@redhat.com>
Fri, 10 Sep 2021 16:08:39 +0000 (18:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Oct 2021 13:55:50 +0000 (15:55 +0200)
commit12cbdaeeb5d4dfde7a8c2f9eed93bcfa4f4653cd
tree8c747a8a1e1b8f5ef2c135502dd1c07903ca3329
parent9f382e1edf90ae03be43dbd4976c2a332cd7ce2d
ipvs: check that ip_vs_conn_tab_bits is between 8 and 20

[ Upstream commit 69e73dbfda14fbfe748d3812da1244cce2928dcb ]

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: 6f7edb4881bf ("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>
net/netfilter/ipvs/ip_vs_conn.c