diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sysctl.c | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index c86445a62af2..130c5ec9ee0b 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -133,7 +133,7 @@ extern int max_lock_depth; | |||
133 | 133 | ||
134 | #ifdef CONFIG_SYSCTL_SYSCALL | 134 | #ifdef CONFIG_SYSCTL_SYSCALL |
135 | static int parse_table(int __user *, int, void __user *, size_t __user *, | 135 | static int parse_table(int __user *, int, void __user *, size_t __user *, |
136 | void __user *, size_t, ctl_table *, void **); | 136 | void __user *, size_t, ctl_table *); |
137 | #endif | 137 | #endif |
138 | 138 | ||
139 | static int proc_do_uts_string(ctl_table *table, int write, struct file *filp, | 139 | static int proc_do_uts_string(ctl_table *table, int write, struct file *filp, |
@@ -141,12 +141,12 @@ static int proc_do_uts_string(ctl_table *table, int write, struct file *filp, | |||
141 | 141 | ||
142 | static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen, | 142 | static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen, |
143 | void __user *oldval, size_t __user *oldlenp, | 143 | void __user *oldval, size_t __user *oldlenp, |
144 | void __user *newval, size_t newlen, void **context); | 144 | void __user *newval, size_t newlen); |
145 | 145 | ||
146 | #ifdef CONFIG_SYSVIPC | 146 | #ifdef CONFIG_SYSVIPC |
147 | static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen, | 147 | static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen, |
148 | void __user *oldval, size_t __user *oldlenp, | 148 | void __user *oldval, size_t __user *oldlenp, |
149 | void __user *newval, size_t newlen, void **context); | 149 | void __user *newval, size_t newlen); |
150 | #endif | 150 | #endif |
151 | 151 | ||
152 | #ifdef CONFIG_PROC_SYSCTL | 152 | #ifdef CONFIG_PROC_SYSCTL |
@@ -1243,7 +1243,6 @@ int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *ol | |||
1243 | do { | 1243 | do { |
1244 | struct ctl_table_header *head = | 1244 | struct ctl_table_header *head = |
1245 | list_entry(tmp, struct ctl_table_header, ctl_entry); | 1245 | list_entry(tmp, struct ctl_table_header, ctl_entry); |
1246 | void *context = NULL; | ||
1247 | 1246 | ||
1248 | if (!use_table(head)) | 1247 | if (!use_table(head)) |
1249 | continue; | 1248 | continue; |
@@ -1251,9 +1250,7 @@ int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *ol | |||
1251 | spin_unlock(&sysctl_lock); | 1250 | spin_unlock(&sysctl_lock); |
1252 | 1251 | ||
1253 | error = parse_table(name, nlen, oldval, oldlenp, | 1252 | error = parse_table(name, nlen, oldval, oldlenp, |
1254 | newval, newlen, head->ctl_table, | 1253 | newval, newlen, head->ctl_table); |
1255 | &context); | ||
1256 | kfree(context); | ||
1257 | 1254 | ||
1258 | spin_lock(&sysctl_lock); | 1255 | spin_lock(&sysctl_lock); |
1259 | unuse_table(head); | 1256 | unuse_table(head); |
@@ -1309,7 +1306,7 @@ static inline int ctl_perm(ctl_table *table, int op) | |||
1309 | static int parse_table(int __user *name, int nlen, | 1306 | static int parse_table(int __user *name, int nlen, |
1310 | void __user *oldval, size_t __user *oldlenp, | 1307 | void __user *oldval, size_t __user *oldlenp, |
1311 | void __user *newval, size_t newlen, | 1308 | void __user *newval, size_t newlen, |
1312 | ctl_table *table, void **context) | 1309 | ctl_table *table) |
1313 | { | 1310 | { |
1314 | int n; | 1311 | int n; |
1315 | repeat: | 1312 | repeat: |
@@ -1329,7 +1326,7 @@ repeat: | |||
1329 | error = table->strategy( | 1326 | error = table->strategy( |
1330 | table, name, nlen, | 1327 | table, name, nlen, |
1331 | oldval, oldlenp, | 1328 | oldval, oldlenp, |
1332 | newval, newlen, context); | 1329 | newval, newlen); |
1333 | if (error) | 1330 | if (error) |
1334 | return error; | 1331 | return error; |
1335 | } | 1332 | } |
@@ -1340,7 +1337,7 @@ repeat: | |||
1340 | } | 1337 | } |
1341 | error = do_sysctl_strategy(table, name, nlen, | 1338 | error = do_sysctl_strategy(table, name, nlen, |
1342 | oldval, oldlenp, | 1339 | oldval, oldlenp, |
1343 | newval, newlen, context); | 1340 | newval, newlen); |
1344 | return error; | 1341 | return error; |
1345 | } | 1342 | } |
1346 | } | 1343 | } |
@@ -1351,7 +1348,7 @@ repeat: | |||
1351 | int do_sysctl_strategy (ctl_table *table, | 1348 | int do_sysctl_strategy (ctl_table *table, |
1352 | int __user *name, int nlen, | 1349 | int __user *name, int nlen, |
1353 | void __user *oldval, size_t __user *oldlenp, | 1350 | void __user *oldval, size_t __user *oldlenp, |
1354 | void __user *newval, size_t newlen, void **context) | 1351 | void __user *newval, size_t newlen) |
1355 | { | 1352 | { |
1356 | int op = 0, rc; | 1353 | int op = 0, rc; |
1357 | size_t len; | 1354 | size_t len; |
@@ -1365,7 +1362,7 @@ int do_sysctl_strategy (ctl_table *table, | |||
1365 | 1362 | ||
1366 | if (table->strategy) { | 1363 | if (table->strategy) { |
1367 | rc = table->strategy(table, name, nlen, oldval, oldlenp, | 1364 | rc = table->strategy(table, name, nlen, oldval, oldlenp, |
1368 | newval, newlen, context); | 1365 | newval, newlen); |
1369 | if (rc < 0) | 1366 | if (rc < 0) |
1370 | return rc; | 1367 | return rc; |
1371 | if (rc > 0) | 1368 | if (rc > 0) |
@@ -2473,7 +2470,7 @@ int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write, | |||
2473 | /* The generic string strategy routine: */ | 2470 | /* The generic string strategy routine: */ |
2474 | int sysctl_string(ctl_table *table, int __user *name, int nlen, | 2471 | int sysctl_string(ctl_table *table, int __user *name, int nlen, |
2475 | void __user *oldval, size_t __user *oldlenp, | 2472 | void __user *oldval, size_t __user *oldlenp, |
2476 | void __user *newval, size_t newlen, void **context) | 2473 | void __user *newval, size_t newlen) |
2477 | { | 2474 | { |
2478 | if (!table->data || !table->maxlen) | 2475 | if (!table->data || !table->maxlen) |
2479 | return -ENOTDIR; | 2476 | return -ENOTDIR; |
@@ -2519,7 +2516,7 @@ int sysctl_string(ctl_table *table, int __user *name, int nlen, | |||
2519 | */ | 2516 | */ |
2520 | int sysctl_intvec(ctl_table *table, int __user *name, int nlen, | 2517 | int sysctl_intvec(ctl_table *table, int __user *name, int nlen, |
2521 | void __user *oldval, size_t __user *oldlenp, | 2518 | void __user *oldval, size_t __user *oldlenp, |
2522 | void __user *newval, size_t newlen, void **context) | 2519 | void __user *newval, size_t newlen) |
2523 | { | 2520 | { |
2524 | 2521 | ||
2525 | if (newval && newlen) { | 2522 | if (newval && newlen) { |
@@ -2555,7 +2552,7 @@ int sysctl_intvec(ctl_table *table, int __user *name, int nlen, | |||
2555 | /* Strategy function to convert jiffies to seconds */ | 2552 | /* Strategy function to convert jiffies to seconds */ |
2556 | int sysctl_jiffies(ctl_table *table, int __user *name, int nlen, | 2553 | int sysctl_jiffies(ctl_table *table, int __user *name, int nlen, |
2557 | void __user *oldval, size_t __user *oldlenp, | 2554 | void __user *oldval, size_t __user *oldlenp, |
2558 | void __user *newval, size_t newlen, void **context) | 2555 | void __user *newval, size_t newlen) |
2559 | { | 2556 | { |
2560 | if (oldval) { | 2557 | if (oldval) { |
2561 | size_t olen; | 2558 | size_t olen; |
@@ -2583,7 +2580,7 @@ int sysctl_jiffies(ctl_table *table, int __user *name, int nlen, | |||
2583 | /* Strategy function to convert jiffies to seconds */ | 2580 | /* Strategy function to convert jiffies to seconds */ |
2584 | int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen, | 2581 | int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen, |
2585 | void __user *oldval, size_t __user *oldlenp, | 2582 | void __user *oldval, size_t __user *oldlenp, |
2586 | void __user *newval, size_t newlen, void **context) | 2583 | void __user *newval, size_t newlen) |
2587 | { | 2584 | { |
2588 | if (oldval) { | 2585 | if (oldval) { |
2589 | size_t olen; | 2586 | size_t olen; |
@@ -2612,7 +2609,7 @@ int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen, | |||
2612 | /* The generic string strategy routine: */ | 2609 | /* The generic string strategy routine: */ |
2613 | static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen, | 2610 | static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen, |
2614 | void __user *oldval, size_t __user *oldlenp, | 2611 | void __user *oldval, size_t __user *oldlenp, |
2615 | void __user *newval, size_t newlen, void **context) | 2612 | void __user *newval, size_t newlen) |
2616 | { | 2613 | { |
2617 | struct ctl_table uts_table; | 2614 | struct ctl_table uts_table; |
2618 | int r, write; | 2615 | int r, write; |
@@ -2620,7 +2617,7 @@ static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen, | |||
2620 | memcpy(&uts_table, table, sizeof(uts_table)); | 2617 | memcpy(&uts_table, table, sizeof(uts_table)); |
2621 | uts_table.data = get_uts(table, write); | 2618 | uts_table.data = get_uts(table, write); |
2622 | r = sysctl_string(&uts_table, name, nlen, | 2619 | r = sysctl_string(&uts_table, name, nlen, |
2623 | oldval, oldlenp, newval, newlen, context); | 2620 | oldval, oldlenp, newval, newlen); |
2624 | put_uts(table, write, uts_table.data); | 2621 | put_uts(table, write, uts_table.data); |
2625 | return r; | 2622 | return r; |
2626 | } | 2623 | } |
@@ -2629,7 +2626,7 @@ static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen, | |||
2629 | /* The generic sysctl ipc data routine. */ | 2626 | /* The generic sysctl ipc data routine. */ |
2630 | static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen, | 2627 | static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen, |
2631 | void __user *oldval, size_t __user *oldlenp, | 2628 | void __user *oldval, size_t __user *oldlenp, |
2632 | void __user *newval, size_t newlen, void **context) | 2629 | void __user *newval, size_t newlen) |
2633 | { | 2630 | { |
2634 | size_t len; | 2631 | size_t len; |
2635 | void *data; | 2632 | void *data; |
@@ -2704,41 +2701,41 @@ out: | |||
2704 | 2701 | ||
2705 | int sysctl_string(ctl_table *table, int __user *name, int nlen, | 2702 | int sysctl_string(ctl_table *table, int __user *name, int nlen, |
2706 | void __user *oldval, size_t __user *oldlenp, | 2703 | void __user *oldval, size_t __user *oldlenp, |
2707 | void __user *newval, size_t newlen, void **context) | 2704 | void __user *newval, size_t newlen) |
2708 | { | 2705 | { |
2709 | return -ENOSYS; | 2706 | return -ENOSYS; |
2710 | } | 2707 | } |
2711 | 2708 | ||
2712 | int sysctl_intvec(ctl_table *table, int __user *name, int nlen, | 2709 | int sysctl_intvec(ctl_table *table, int __user *name, int nlen, |
2713 | void __user *oldval, size_t __user *oldlenp, | 2710 | void __user *oldval, size_t __user *oldlenp, |
2714 | void __user *newval, size_t newlen, void **context) | 2711 | void __user *newval, size_t newlen) |
2715 | { | 2712 | { |
2716 | return -ENOSYS; | 2713 | return -ENOSYS; |
2717 | } | 2714 | } |
2718 | 2715 | ||
2719 | int sysctl_jiffies(ctl_table *table, int __user *name, int nlen, | 2716 | int sysctl_jiffies(ctl_table *table, int __user *name, int nlen, |
2720 | void __user *oldval, size_t __user *oldlenp, | 2717 | void __user *oldval, size_t __user *oldlenp, |
2721 | void __user *newval, size_t newlen, void **context) | 2718 | void __user *newval, size_t newlen) |
2722 | { | 2719 | { |
2723 | return -ENOSYS; | 2720 | return -ENOSYS; |
2724 | } | 2721 | } |
2725 | 2722 | ||
2726 | int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen, | 2723 | int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen, |
2727 | void __user *oldval, size_t __user *oldlenp, | 2724 | void __user *oldval, size_t __user *oldlenp, |
2728 | void __user *newval, size_t newlen, void **context) | 2725 | void __user *newval, size_t newlen) |
2729 | { | 2726 | { |
2730 | return -ENOSYS; | 2727 | return -ENOSYS; |
2731 | } | 2728 | } |
2732 | 2729 | ||
2733 | static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen, | 2730 | static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen, |
2734 | void __user *oldval, size_t __user *oldlenp, | 2731 | void __user *oldval, size_t __user *oldlenp, |
2735 | void __user *newval, size_t newlen, void **context) | 2732 | void __user *newval, size_t newlen) |
2736 | { | 2733 | { |
2737 | return -ENOSYS; | 2734 | return -ENOSYS; |
2738 | } | 2735 | } |
2739 | static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen, | 2736 | static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen, |
2740 | void __user *oldval, size_t __user *oldlenp, | 2737 | void __user *oldval, size_t __user *oldlenp, |
2741 | void __user *newval, size_t newlen, void **context) | 2738 | void __user *newval, size_t newlen) |
2742 | { | 2739 | { |
2743 | return -ENOSYS; | 2740 | return -ENOSYS; |
2744 | } | 2741 | } |