]> www.infradead.org Git - users/hch/misc.git/commitdiff
ipv6: Add sanity checks on ipv6_devconf.rpl_seg_enabled
authorYue Haibing <yuehaibing@huawei.com>
Mon, 1 Sep 2025 12:37:26 +0000 (20:37 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 3 Sep 2025 00:01:14 +0000 (17:01 -0700)
In ipv6_rpl_srh_rcv() we use min(net->ipv6.devconf_all->rpl_seg_enabled,
idev->cnf.rpl_seg_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>
Link: https://patch.msgid.link/20250901123726.1972881-3-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv6/addrconf.c

index f17a5dd4789fb3dc99b4be2ef86479ee1e553c84..40e9c336f6c55eedea03e0ea14aa4bd1ef785370 100644 (file)
@@ -7238,7 +7238,9 @@ static const struct ctl_table addrconf_sysctl[] = {
                .data           = &ipv6_devconf.rpl_seg_enabled,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = proc_dointvec,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = SYSCTL_ZERO,
+               .extra2         = SYSCTL_ONE,
        },
        {
                .procname       = "ioam6_enabled",