]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/core: Fixes infiniband sysctl bounds
authorNicolas Bouchinet <nicolas.bouchinet@ssi.gouv.fr>
Mon, 24 Feb 2025 09:58:20 +0000 (10:58 +0100)
committerLeon Romanovsky <leon@kernel.org>
Mon, 3 Mar 2025 18:49:02 +0000 (13:49 -0500)
Bound infiniband iwcm and ucma sysctl writings between SYSCTL_ZERO
and SYSCTL_INT_MAX.

The proc_handler has thus been updated to proc_dointvec_minmax.

Signed-off-by: Nicolas Bouchinet <nicolas.bouchinet@ssi.gouv.fr>
Link: https://patch.msgid.link/20250224095826.16458-6-nicolas.bouchinet@clip-os.org
Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Reviewed-by: Joel Granados <joel.granados@kernel.org>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/core/iwcm.c
drivers/infiniband/core/ucma.c

index 7e3a55349e1070ed3d705954fc2c4fe98fd84848..f4486cbd8f45a96247b6921b182e9a2996b7dca8 100644 (file)
@@ -109,7 +109,9 @@ static struct ctl_table iwcm_ctl_table[] = {
                .data           = &default_backlog,
                .maxlen         = sizeof(default_backlog),
                .mode           = 0644,
-               .proc_handler   = proc_dointvec,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = SYSCTL_ZERO,
+               .extra2         = SYSCTL_INT_MAX,
        },
 };
 
index 02f1666f3cbab4cad71674ae618d1bf2565670e2..6e700b9740331525146d9365ace00f0f85214654 100644 (file)
@@ -69,7 +69,9 @@ static struct ctl_table ucma_ctl_table[] = {
                .data           = &max_backlog,
                .maxlen         = sizeof max_backlog,
                .mode           = 0644,
-               .proc_handler   = proc_dointvec,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = SYSCTL_ZERO,
+               .extra2         = SYSCTL_INT_MAX,
        },
 };