ipv6: fix error handling in disable_policy sysctl
authorFernando Fernandez Mancera <fmancera@suse.de>
Mon, 22 Jun 2026 13:08:55 +0000 (15:08 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 24 Jun 2026 02:12:47 +0000 (19:12 -0700)
commit3e0e51c0ee1d08cc9d48dc17f3248d5b31cf8066
tree32b223e4ac541331f24b2c56507596b3aa941348
parent058b9b19f9639fe1e1225a17c540f61b65bee6ad
ipv6: fix error handling in disable_policy sysctl

When writing to the disable_policy sysctl, if proc_dointvec() fails to
parse the input, it returns a negative error code. The current
implementation is resetting the position argument even if an error
occurred during proc_dointvec() and not only during sysctl restart.

Fix this by checking the return value of proc_dointvec() and returning
early on failure.

Fixes: df789fe75206 ("ipv6: Provide ipv6 version of "disable_policy" sysctl")
Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20260622130857.5115-5-fmancera@suse.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv6/addrconf.c