From nobody Sun Dec 14 14:15:28 2025 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D183C23958A; Mon, 1 Sep 2025 12:19:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756729181; cv=none; b=oq4puQooY0BUKgcLWxTndReB1s0n7o4J76bxUXcwmwgRhepSNzj4vOCeQfjA5pMWK8o3OfwmB7067urN/aqOSuSexDch05jQDoBQpHplHN6fdCs9Mq033fTYnTS/AYfsxo8e44/NXNA8BOYJLR0cnNDpCoSmXzMzXqKkRZleVp0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756729181; c=relaxed/simple; bh=t8TDCsiEgYq2fRydjDqGDYB86BCVpSeLkkUVNnDxhzs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PdBk6aEn+ZSIMjn3UXvotMe5Y339ySsB0BQuPddCi1Gfr8xRMLJHHOhM/lhDapb5nmt/WdvAktg48cDVdI7h+e7fCpy83w3jOck+NeI4/EGtveOzzzXz8IfhUy8F+iJIgRGiW4ASlWqxZXTWyYDGFk90Iep1hi7imGfq1o3Wplk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4cFnrF2SpVz2CgL3; Mon, 1 Sep 2025 20:15:09 +0800 (CST) Received: from dggpemf500002.china.huawei.com (unknown [7.185.36.57]) by mail.maildlp.com (Postfix) with ESMTPS id 8AB641400D2; Mon, 1 Sep 2025 20:19:37 +0800 (CST) Received: from huawei.com (10.50.159.234) by dggpemf500002.china.huawei.com (7.185.36.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 1 Sep 2025 20:19:36 +0800 From: Yue Haibing To: , , , , , , CC: , , Subject: [PATCH v3 net-next 2/2] ipv6: Add sanity checks on ipv6_devconf.rpl_seg_enabled Date: Mon, 1 Sep 2025 20:37:26 +0800 Message-ID: <20250901123726.1972881-3-yuehaibing@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250901123726.1972881-1-yuehaibing@huawei.com> References: <20250901123726.1972881-1-yuehaibing@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To dggpemf500002.china.huawei.com (7.185.36.57) Content-Type: text/plain; charset="utf-8" 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 --- net/ipv6/addrconf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index f17a5dd4789f..40e9c336f6c5 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -7238,7 +7238,9 @@ static const struct ctl_table addrconf_sysctl[] =3D { .data =3D &ipv6_devconf.rpl_seg_enabled, .maxlen =3D sizeof(int), .mode =3D 0644, - .proc_handler =3D proc_dointvec, + .proc_handler =3D proc_dointvec_minmax, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE, }, { .procname =3D "ioam6_enabled", --=20 2.34.1