linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ipv6: avoid accepting values greater than 2 for accept_untracked_na
@ 2022-07-20  6:52 Jaehee Park
  2022-07-20  8:26 ` Nicolas Dichtel
  0 siblings, 1 reply; 3+ messages in thread
From: Jaehee Park @ 2022-07-20  6:52 UTC (permalink / raw)
  To: netdev
  Cc: davem, yoshfuji, dsahern, dsahern, edumazet, kuba, pabeni, shuah,
	linux-kernel, aajith, roopa, roopa.prabhu, aroulin, sbrivio,
	jhpark1013, nicolas.dichtel

The accept_untracked_na sysctl changed from a boolean to an integer
when a new knob '2' was added. This patch provides a safeguard to avoid
accepting values that are not defined in the sysctl. When setting a
value greater than 2, the user will get an 'invalid argument' warning.

Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
Suggested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Suggested-by: Roopa Prabhu <roopa@nvidia.com>
---
 net/ipv6/addrconf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 6ed807b6c647..d3e77ea24f05 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -7042,9 +7042,9 @@ static const struct ctl_table addrconf_sysctl[] = {
 		.data		= &ipv6_devconf.accept_untracked_na,
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_dointvec_minmax,
 		.extra1		= (void *)SYSCTL_ZERO,
-		.extra2		= (void *)SYSCTL_ONE,
+		.extra2		= (void *)SYSCTL_TWO,
 	},
 	{
 		/* sentinel */
-- 
2.30.2


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

* Re: [PATCH net-next] net: ipv6: avoid accepting values greater than 2 for accept_untracked_na
  2022-07-20  6:52 [PATCH net-next] net: ipv6: avoid accepting values greater than 2 for accept_untracked_na Jaehee Park
@ 2022-07-20  8:26 ` Nicolas Dichtel
  2022-07-20 18:37   ` Jaehee
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Dichtel @ 2022-07-20  8:26 UTC (permalink / raw)
  To: Jaehee Park, netdev
  Cc: davem, yoshfuji, dsahern, dsahern, edumazet, kuba, pabeni, shuah,
	linux-kernel, aajith, roopa, roopa.prabhu, aroulin, sbrivio


Le 20/07/2022 à 08:52, Jaehee Park a écrit :
> The accept_untracked_na sysctl changed from a boolean to an integer
> when a new knob '2' was added. This patch provides a safeguard to avoid
> accepting values that are not defined in the sysctl. When setting a
> value greater than 2, the user will get an 'invalid argument' warning.
> 
> Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
> Suggested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Suggested-by: Roopa Prabhu <roopa@nvidia.com>
> ---
>  net/ipv6/addrconf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 6ed807b6c647..d3e77ea24f05 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -7042,9 +7042,9 @@ static const struct ctl_table addrconf_sysctl[] = {
>  		.data		= &ipv6_devconf.accept_untracked_na,
>  		.maxlen		= sizeof(int),
>  		.mode		= 0644,
> -		.proc_handler	= proc_dointvec,
> +		.proc_handler	= proc_dointvec_minmax,
>  		.extra1		= (void *)SYSCTL_ZERO,
> -		.extra2		= (void *)SYSCTL_ONE,
> +		.extra2		= (void *)SYSCTL_TWO,
Nit: the cast is useless:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/sysctl.h#n40


Regards,
Nicolas

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

* Re: [PATCH net-next] net: ipv6: avoid accepting values greater than 2 for accept_untracked_na
  2022-07-20  8:26 ` Nicolas Dichtel
@ 2022-07-20 18:37   ` Jaehee
  0 siblings, 0 replies; 3+ messages in thread
From: Jaehee @ 2022-07-20 18:37 UTC (permalink / raw)
  To: nicolas.dichtel
  Cc: netdev, David S. Miller, yoshfuji, dsahern, David Ahern,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, shuah, linux-kernel,
	Arun Ajith S, Roopa Prabhu, Roopa Prabhu, Andy Roulin,
	Stefano Brivio

On Wed, Jul 20, 2022 at 4:26 AM Nicolas Dichtel
<nicolas.dichtel@6wind.com> wrote:
>
>
> Le 20/07/2022 à 08:52, Jaehee Park a écrit :
> > The accept_untracked_na sysctl changed from a boolean to an integer
> > when a new knob '2' was added. This patch provides a safeguard to avoid
> > accepting values that are not defined in the sysctl. When setting a
> > value greater than 2, the user will get an 'invalid argument' warning.
> >
> > Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
> > Suggested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> > Suggested-by: Roopa Prabhu <roopa@nvidia.com>
> > ---
> >  net/ipv6/addrconf.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> > index 6ed807b6c647..d3e77ea24f05 100644
> > --- a/net/ipv6/addrconf.c
> > +++ b/net/ipv6/addrconf.c
> > @@ -7042,9 +7042,9 @@ static const struct ctl_table addrconf_sysctl[] = {
> >               .data           = &ipv6_devconf.accept_untracked_na,
> >               .maxlen         = sizeof(int),
> >               .mode           = 0644,
> > -             .proc_handler   = proc_dointvec,
> > +             .proc_handler   = proc_dointvec_minmax,
> >               .extra1         = (void *)SYSCTL_ZERO,
> > -             .extra2         = (void *)SYSCTL_ONE,
> > +             .extra2         = (void *)SYSCTL_TWO,
> Nit: the cast is useless:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/sysctl.h#n40
>

O yes thank you for pointing that out! I just sent a v2 for your review.

>
> Regards,
> Nicolas

Thanks,
Jaehee

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

end of thread, other threads:[~2022-07-20 18:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20  6:52 [PATCH net-next] net: ipv6: avoid accepting values greater than 2 for accept_untracked_na Jaehee Park
2022-07-20  8:26 ` Nicolas Dichtel
2022-07-20 18:37   ` Jaehee

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).