]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
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)
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

index d23a89b07eedadd1c130f3e3ff30f183c7295bc7..5d96cbf76134a8aae20378f3450ef865aa6fc951 100644 (file)
@@ -6769,6 +6769,8 @@ static int addrconf_sysctl_disable_policy(const struct ctl_table *ctl, int write
        lctl = *ctl;
        lctl.data = &val;
        ret = proc_dointvec(&lctl, write, buffer, lenp, ppos);
+       if (ret)
+               return ret;
 
        if (write && (*valp != val))
                ret = addrconf_disable_policy(ctl, valp, val);