sysctl: add unsigned int range support
Subsystems (2)
PATCH 13/96 sysctl: add unsigned int range support
From: "Luis R. Rodriguez" <[email protected]>
Subject: sysctl: add unsigned int range support
To keep parity with regular int interfaces provide the an unsigned int proc_douintvec_minmax() which allows you to specify a range of allowed valid numbers.
Adding proc_douintvec_minmax_sysadmin() is easy but we can wait for an actual user for that.
Signed-off-by Luis R. Rodriguez <[email protected]>
Acked-by Kees Cook <[email protected]>
Cc Subash Abhinov Kasiviswanathan <[email protected]>
Cc Heinrich Schuchardt <[email protected]>
Cc Kees Cook <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Al Viro <[email protected]>
Cc "Eric W. Biederman" <[email protected]>
Cc Alexey Dobriyan <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
fs/proc/proc_sysctl.c | 4 +- include/linux/sysctl.h | 3 + kernel/sysctl.c | 66 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 1 deletion(-)
fs/proc/proc_sysctl.c renamed from fs/proc/proc_sysctl.c~sysctl-add-unsigned-int-range-support +3 -1
@@ -1065,7 +1065,8 @@ static int sysctl_check_table_array(cons {int err =0 ; -if (table->proc_handler == proc_douintvec) { +if ((table->proc_handler == proc_douintvec) || + (table->proc_handler == proc_douintvec_minmax)) {if (table->maxlen !=sizeof (unsigned int )) err |=sysctl_err (path, table,"array now allowed" ); }
@@ -1083,6 +1084,7 @@ static int sysctl_check_table(const char if ((table->proc_handler == proc_dostring) || (table->proc_handler == proc_dointvec) || (table->proc_handler == proc_douintvec) || + (table->proc_handler == proc_douintvec_minmax) || (table->proc_handler == proc_dointvec_minmax) || (table->proc_handler == proc_dointvec_jiffies) || (table->proc_handler == proc_dointvec_userhz_jiffies) ||
include/linux/sysctl.h renamed from include/linux/sysctl.h~sysctl-add-unsigned-int-range-support +3 -0
@@ -47,6 +47,9 @@ extern int proc_douintvec(struct ctl_tab void __user *, size_t *, loff_t *);extern int proc_dointvec_minmax (struct ctl_table *,int ,void __user *,size_t *,loff_t *); +extern int proc_douintvec_minmax (struct ctl_table *table,int write, +void __user *buffer,size_t *lenp, +loff_t *ppos);extern int proc_dointvec_jiffies (struct ctl_table *,int ,void __user *,size_t *,loff_t *); extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int,
kernel/sysctl.c renamed from kernel/sysctl.c~sysctl-add-unsigned-int-range-support +66 -0
84 lines not on this page · raw message
_