[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220720183632.376138-1-jhpark1013@gmail.com>
Date: Wed, 20 Jul 2022 14:36:32 -0400
From: Jaehee Park <jhpark1013@...il.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, yoshfuji@...ux-ipv6.org, dsahern@...nel.org,
dsahern@...il.com, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, shuah@...nel.org, linux-kernel@...r.kernel.org,
aajith@...sta.com, roopa@...dia.com, roopa.prabhu@...il.com,
aroulin@...dia.com, sbrivio@...hat.com, jhpark1013@...il.com,
nicolas.dichtel@...nd.com
Subject: [PATCH v2 net-next] net: ipv6: avoid accepting values greater than 2 for accept_untracked_na
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@...il.com>
Suggested-by: Nicolas Dichtel <nicolas.dichtel@...nd.com>
Suggested-by: Roopa Prabhu <roopa@...dia.com>
---
v2
- got rid of unnecessary void cast in extra1 and extra2
net/ipv6/addrconf.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 6ed807b6c647..b624e3d8c5f0 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,
- .extra1 = (void *)SYSCTL_ZERO,
- .extra2 = (void *)SYSCTL_ONE,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_TWO,
},
{
/* sentinel */
--
2.30.2
Powered by blists - more mailing lists