sysctl: Fixes nsm_local_state bounds
authorNicolas Bouchinet <nicolas.bouchinet@ssi.gouv.fr>
Mon, 24 Feb 2025 09:58:17 +0000 (10:58 +0100)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 10 Mar 2025 13:11:13 +0000 (09:11 -0400)
Bound nsm_local_state 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>
[ cel: updated to handle zero - UINT_MAX instead ]
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/lockd/svc.c

index 256284669aaabf5b2153a52050575b2bff9d39f1..e80262a51884b5a5fd12f9897b31206ef6690627 100644 (file)
@@ -467,9 +467,10 @@ static const struct ctl_table nlm_sysctls[] = {
        {
                .procname       = "nsm_local_state",
                .data           = &nsm_local_state,
-               .maxlen         = sizeof(int),
+               .maxlen         = sizeof(nsm_local_state),
                .mode           = 0644,
-               .proc_handler   = proc_dointvec,
+               .proc_handler   = proc_douintvec,
+               .extra1         = SYSCTL_ZERO,
        },
 };