aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sysctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r--kernel/sysctl.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c8bcbfb2e069..77ea4fc386ef 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -137,6 +137,10 @@ static int parse_table(int __user *, int, void __user *, size_t __user *,
137static int proc_do_uts_string(ctl_table *table, int write, struct file *filp, 137static int proc_do_uts_string(ctl_table *table, int write, struct file *filp,
138 void __user *buffer, size_t *lenp, loff_t *ppos); 138 void __user *buffer, size_t *lenp, loff_t *ppos);
139 139
140static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen,
141 void __user *oldval, size_t __user *oldlenp,
142 void __user *newval, size_t newlen, void **context);
143
140#ifdef CONFIG_PROC_SYSCTL 144#ifdef CONFIG_PROC_SYSCTL
141static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp, 145static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
142 void __user *buffer, size_t *lenp, loff_t *ppos); 146 void __user *buffer, size_t *lenp, loff_t *ppos);
@@ -258,7 +262,7 @@ static ctl_table kern_table[] = {
258 .maxlen = sizeof(init_uts_ns.name.sysname), 262 .maxlen = sizeof(init_uts_ns.name.sysname),
259 .mode = 0444, 263 .mode = 0444,
260 .proc_handler = &proc_do_uts_string, 264 .proc_handler = &proc_do_uts_string,
261 .strategy = &sysctl_string, 265 .strategy = &sysctl_uts_string,
262 }, 266 },
263 { 267 {
264 .ctl_name = KERN_OSRELEASE, 268 .ctl_name = KERN_OSRELEASE,
@@ -267,7 +271,7 @@ static ctl_table kern_table[] = {
267 .maxlen = sizeof(init_uts_ns.name.release), 271 .maxlen = sizeof(init_uts_ns.name.release),
268 .mode = 0444, 272 .mode = 0444,
269 .proc_handler = &proc_do_uts_string, 273 .proc_handler = &proc_do_uts_string,
270 .strategy = &sysctl_string, 274 .strategy = &sysctl_uts_string,
271 }, 275 },
272 { 276 {
273 .ctl_name = KERN_VERSION, 277 .ctl_name = KERN_VERSION,
@@ -276,7 +280,7 @@ static ctl_table kern_table[] = {
276 .maxlen = sizeof(init_uts_ns.name.version), 280 .maxlen = sizeof(init_uts_ns.name.version),
277 .mode = 0444, 281 .mode = 0444,
278 .proc_handler = &proc_do_uts_string, 282 .proc_handler = &proc_do_uts_string,
279 .strategy = &sysctl_string, 283 .strategy = &sysctl_uts_string,
280 }, 284 },
281 { 285 {
282 .ctl_name = KERN_NODENAME, 286 .ctl_name = KERN_NODENAME,
@@ -285,7 +289,7 @@ static ctl_table kern_table[] = {
285 .maxlen = sizeof(init_uts_ns.name.nodename), 289 .maxlen = sizeof(init_uts_ns.name.nodename),
286 .mode = 0644, 290 .mode = 0644,
287 .proc_handler = &proc_do_uts_string, 291 .proc_handler = &proc_do_uts_string,
288 .strategy = &sysctl_string, 292 .strategy = &sysctl_uts_string,
289 }, 293 },
290 { 294 {
291 .ctl_name = KERN_DOMAINNAME, 295 .ctl_name = KERN_DOMAINNAME,
@@ -294,7 +298,7 @@ static ctl_table kern_table[] = {
294 .maxlen = sizeof(init_uts_ns.name.domainname), 298 .maxlen = sizeof(init_uts_ns.name.domainname),
295 .mode = 0644, 299 .mode = 0644,
296 .proc_handler = &proc_do_uts_string, 300 .proc_handler = &proc_do_uts_string,
297 .strategy = &sysctl_string, 301 .strategy = &sysctl_uts_string,
298 }, 302 },
299 { 303 {
300 .ctl_name = KERN_PANIC, 304 .ctl_name = KERN_PANIC,
@@ -2598,6 +2602,23 @@ int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
2598 return 1; 2602 return 1;
2599} 2603}
2600 2604
2605
2606/* The generic string strategy routine: */
2607static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen,
2608 void __user *oldval, size_t __user *oldlenp,
2609 void __user *newval, size_t newlen, void **context)
2610{
2611 struct ctl_table uts_table;
2612 int r, write;
2613 write = newval && newlen;
2614 memcpy(&uts_table, table, sizeof(uts_table));
2615 uts_table.data = get_uts(table, write);
2616 r = sysctl_string(&uts_table, name, nlen,
2617 oldval, oldlenp, newval, newlen, context);
2618 put_uts(table, write, uts_table.data);
2619 return r;
2620}
2621
2601#else /* CONFIG_SYSCTL_SYSCALL */ 2622#else /* CONFIG_SYSCTL_SYSCALL */
2602 2623
2603 2624
@@ -2662,6 +2683,12 @@ int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
2662 return -ENOSYS; 2683 return -ENOSYS;
2663} 2684}
2664 2685
2686static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen,
2687 void __user *oldval, size_t __user *oldlenp,
2688 void __user *newval, size_t newlen, void **context)
2689{
2690 return -ENOSYS;
2691}
2665#endif /* CONFIG_SYSCTL_SYSCALL */ 2692#endif /* CONFIG_SYSCTL_SYSCALL */
2666 2693
2667/* 2694/*