* [PATCH nf] ipvs: check that ip_vs_conn_tab_bits is between 8 and 20
@ 2021-09-10 16:08 Andrea Claudi
2021-09-10 17:32 ` Julian Anastasov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andrea Claudi @ 2021-09-10 16:08 UTC (permalink / raw)
To: netfilter-devel; +Cc: horms, ja
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>
---
net/netfilter/ipvs/ip_vs_conn.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index c100c6b112c8..2c467c422dc6 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -1468,6 +1468,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;
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH nf] ipvs: check that ip_vs_conn_tab_bits is between 8 and 20
2021-09-10 16:08 [PATCH nf] ipvs: check that ip_vs_conn_tab_bits is between 8 and 20 Andrea Claudi
@ 2021-09-10 17:32 ` Julian Anastasov
2021-09-10 18:39 ` Simon Horman
2021-09-13 22:57 ` Pablo Neira Ayuso
2 siblings, 0 replies; 4+ messages in thread
From: Julian Anastasov @ 2021-09-10 17:32 UTC (permalink / raw)
To: Andrea Claudi; +Cc: netfilter-devel, Simon Horman, Pablo Neira Ayuso
Hello,
On Fri, 10 Sep 2021, Andrea Claudi wrote:
> 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>
Looks good to me, thanks!
Acked-by: Julian Anastasov <ja@ssi.bg>
> ---
> net/netfilter/ipvs/ip_vs_conn.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
> index c100c6b112c8..2c467c422dc6 100644
> --- a/net/netfilter/ipvs/ip_vs_conn.c
> +++ b/net/netfilter/ipvs/ip_vs_conn.c
> @@ -1468,6 +1468,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;
>
> --
> 2.31.1
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH nf] ipvs: check that ip_vs_conn_tab_bits is between 8 and 20
2021-09-10 16:08 [PATCH nf] ipvs: check that ip_vs_conn_tab_bits is between 8 and 20 Andrea Claudi
2021-09-10 17:32 ` Julian Anastasov
@ 2021-09-10 18:39 ` Simon Horman
2021-09-13 22:57 ` Pablo Neira Ayuso
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2021-09-10 18:39 UTC (permalink / raw)
To: Andrea Claudi; +Cc: netfilter-devel, ja
On Fri, Sep 10, 2021 at 06:08:39PM +0200, Andrea Claudi wrote:
> 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: Simon Horman <horms@verge.net.au>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH nf] ipvs: check that ip_vs_conn_tab_bits is between 8 and 20
2021-09-10 16:08 [PATCH nf] ipvs: check that ip_vs_conn_tab_bits is between 8 and 20 Andrea Claudi
2021-09-10 17:32 ` Julian Anastasov
2021-09-10 18:39 ` Simon Horman
@ 2021-09-13 22:57 ` Pablo Neira Ayuso
2 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2021-09-13 22:57 UTC (permalink / raw)
To: Andrea Claudi; +Cc: netfilter-devel, horms, ja
On Fri, Sep 10, 2021 at 06:08:39PM +0200, Andrea Claudi wrote:
> 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.
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-13 22:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10 16:08 [PATCH nf] ipvs: check that ip_vs_conn_tab_bits is between 8 and 20 Andrea Claudi
2021-09-10 17:32 ` Julian Anastasov
2021-09-10 18:39 ` Simon Horman
2021-09-13 22:57 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).