mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 net-next] ipv6: Add sanity checks on ipv6_devconf.seg6_enabled
@ 2025-09-03 11:56 Yue Haibing
  2025-09-05  8:12 ` Nicolas Dichtel
  0 siblings, 1 reply; 2+ messages in thread
From: Yue Haibing @ 2025-09-03 11:56 UTC (permalink / raw)
  To: davem, dsahern, edumazet, kuba, pabeni, horms
  Cc: netdev, linux-kernel, yuehaibing

In ipv6_srh_rcv() we use min(net->ipv6.devconf_all->seg6_enabled,
idev->cnf.seg6_enabled) is intended to return 0 when either value is zero,
but if one of the values is negative it will in fact return non-zero.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
---
v2: use proc_dointvec_minmax()
---
 net/ipv6/addrconf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 40e9c336f6c5..69ec9cb6031e 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -7192,7 +7192,9 @@ static const struct ctl_table addrconf_sysctl[] = {
 		.data		= &ipv6_devconf.seg6_enabled,
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= SYSCTL_ZERO,
+		.extra2		= SYSCTL_ONE,
 	},
 #ifdef CONFIG_IPV6_SEG6_HMAC
 	{
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 net-next] ipv6: Add sanity checks on ipv6_devconf.seg6_enabled
  2025-09-03 11:56 [PATCH v2 net-next] ipv6: Add sanity checks on ipv6_devconf.seg6_enabled Yue Haibing
@ 2025-09-05  8:12 ` Nicolas Dichtel
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Dichtel @ 2025-09-05  8:12 UTC (permalink / raw)
  To: Yue Haibing, davem, dsahern, edumazet, kuba, pabeni, horms
  Cc: netdev, linux-kernel

Le 03/09/2025 à 13:56, Yue Haibing a écrit :
> In ipv6_srh_rcv() we use min(net->ipv6.devconf_all->seg6_enabled,
> idev->cnf.seg6_enabled) is intended to return 0 when either value is zero,
> but if one of the values is negative it will in fact return non-zero.
> 
> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
> ---
> v2: use proc_dointvec_minmax()
> ---
>  net/ipv6/addrconf.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 40e9c336f6c5..69ec9cb6031e 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -7192,7 +7192,9 @@ static const struct ctl_table addrconf_sysctl[] = {
>  		.data		= &ipv6_devconf.seg6_enabled,
>  		.maxlen		= sizeof(int),
>  		.mode		= 0644,
> -		.proc_handler	= proc_dointvec,
> +		.proc_handler	= proc_dointvec_minmax,
> +		.extra1		= SYSCTL_ZERO,
> +		.extra2		= SYSCTL_ONE,
This sysctl has existed for almost a decade; you cannot change it, as it may
break a user setup that was using another value.

Regards,
Nicolas

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-05  8:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-03 11:56 [PATCH v2 net-next] ipv6: Add sanity checks on ipv6_devconf.seg6_enabled Yue Haibing
2025-09-05  8:12 ` Nicolas Dichtel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®