diff options
Diffstat (limited to 'kernel/sysctl.c')
| -rw-r--r-- | kernel/sysctl.c | 68 |
1 files changed, 33 insertions, 35 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 025fcb3c66f8..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) |
| @@ -1931,9 +1928,6 @@ int proc_dointvec(ctl_table *table, int write, struct file *filp, | |||
| 1931 | 1928 | ||
| 1932 | #define OP_SET 0 | 1929 | #define OP_SET 0 |
| 1933 | #define OP_AND 1 | 1930 | #define OP_AND 1 |
| 1934 | #define OP_OR 2 | ||
| 1935 | #define OP_MAX 3 | ||
| 1936 | #define OP_MIN 4 | ||
| 1937 | 1931 | ||
| 1938 | static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp, | 1932 | static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp, |
| 1939 | int *valp, | 1933 | int *valp, |
| @@ -1945,13 +1939,6 @@ static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp, | |||
| 1945 | switch(op) { | 1939 | switch(op) { |
| 1946 | case OP_SET: *valp = val; break; | 1940 | case OP_SET: *valp = val; break; |
| 1947 | case OP_AND: *valp &= val; break; | 1941 | case OP_AND: *valp &= val; break; |
| 1948 | case OP_OR: *valp |= val; break; | ||
| 1949 | case OP_MAX: if(*valp < val) | ||
| 1950 | *valp = val; | ||
| 1951 | break; | ||
| 1952 | case OP_MIN: if(*valp > val) | ||
| 1953 | *valp = val; | ||
| 1954 | break; | ||
| 1955 | } | 1942 | } |
| 1956 | } else { | 1943 | } else { |
| 1957 | int val = *valp; | 1944 | int val = *valp; |
| @@ -2408,6 +2395,17 @@ static int proc_do_ipc_string(ctl_table *table, int write, struct file *filp, | |||
| 2408 | { | 2395 | { |
| 2409 | return -ENOSYS; | 2396 | return -ENOSYS; |
| 2410 | } | 2397 | } |
| 2398 | static int proc_ipc_dointvec(ctl_table *table, int write, struct file *filp, | ||
| 2399 | void __user *buffer, size_t *lenp, loff_t *ppos) | ||
| 2400 | { | ||
| 2401 | return -ENOSYS; | ||
| 2402 | } | ||
| 2403 | static int proc_ipc_doulongvec_minmax(ctl_table *table, int write, | ||
| 2404 | struct file *filp, void __user *buffer, | ||
| 2405 | size_t *lenp, loff_t *ppos) | ||
| 2406 | { | ||
| 2407 | return -ENOSYS; | ||
| 2408 | } | ||
| 2411 | #endif | 2409 | #endif |
| 2412 | 2410 | ||
| 2413 | int proc_dointvec(ctl_table *table, int write, struct file *filp, | 2411 | int proc_dointvec(ctl_table *table, int write, struct file *filp, |
| @@ -2472,7 +2470,7 @@ int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write, | |||
| 2472 | /* The generic string strategy routine: */ | 2470 | /* The generic string strategy routine: */ |
| 2473 | int sysctl_string(ctl_table *table, int __user *name, int nlen, | 2471 | int sysctl_string(ctl_table *table, int __user *name, int nlen, |
| 2474 | void __user *oldval, size_t __user *oldlenp, | 2472 | void __user *oldval, size_t __user *oldlenp, |
| 2475 | void __user *newval, size_t newlen, void **context) | 2473 | void __user *newval, size_t newlen) |
| 2476 | { | 2474 | { |
| 2477 | if (!table->data || !table->maxlen) | 2475 | if (!table->data || !table->maxlen) |
| 2478 | return -ENOTDIR; | 2476 | return -ENOTDIR; |
| @@ -2518,7 +2516,7 @@ int sysctl_string(ctl_table *table, int __user *name, int nlen, | |||
| 2518 | */ | 2516 | */ |
| 2519 | int sysctl_intvec(ctl_table *table, int __user *name, int nlen, | 2517 | int sysctl_intvec(ctl_table *table, int __user *name, int nlen, |
| 2520 | void __user *oldval, size_t __user *oldlenp, | 2518 | void __user *oldval, size_t __user *oldlenp, |
| 2521 | void __user *newval, size_t newlen, void **context) | 2519 | void __user *newval, size_t newlen) |
| 2522 | { | 2520 | { |
| 2523 | 2521 | ||
| 2524 | if (newval && newlen) { | 2522 | if (newval && newlen) { |
| @@ -2554,7 +2552,7 @@ int sysctl_intvec(ctl_table *table, int __user *name, int nlen, | |||
| 2554 | /* Strategy function to convert jiffies to seconds */ | 2552 | /* Strategy function to convert jiffies to seconds */ |
| 2555 | int sysctl_jiffies(ctl_table *table, int __user *name, int nlen, | 2553 | int sysctl_jiffies(ctl_table *table, int __user *name, int nlen, |
| 2556 | void __user *oldval, size_t __user *oldlenp, | 2554 | void __user *oldval, size_t __user *oldlenp, |
| 2557 | void __user *newval, size_t newlen, void **context) | 2555 | void __user *newval, size_t newlen) |
| 2558 | { | 2556 | { |
| 2559 | if (oldval) { | 2557 | if (oldval) { |
| 2560 | size_t olen; | 2558 | size_t olen; |
| @@ -2582,7 +2580,7 @@ int sysctl_jiffies(ctl_table *table, int __user *name, int nlen, | |||
| 2582 | /* Strategy function to convert jiffies to seconds */ | 2580 | /* Strategy function to convert jiffies to seconds */ |
| 2583 | 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, |
| 2584 | void __user *oldval, size_t __user *oldlenp, | 2582 | void __user *oldval, size_t __user *oldlenp, |
| 2585 | void __user *newval, size_t newlen, void **context) | 2583 | void __user *newval, size_t newlen) |
| 2586 | { | 2584 | { |
| 2587 | if (oldval) { | 2585 | if (oldval) { |
| 2588 | size_t olen; | 2586 | size_t olen; |
| @@ -2611,7 +2609,7 @@ int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen, | |||
| 2611 | /* The generic string strategy routine: */ | 2609 | /* The generic string strategy routine: */ |
| 2612 | 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, |
| 2613 | void __user *oldval, size_t __user *oldlenp, | 2611 | void __user *oldval, size_t __user *oldlenp, |
| 2614 | void __user *newval, size_t newlen, void **context) | 2612 | void __user *newval, size_t newlen) |
| 2615 | { | 2613 | { |
| 2616 | struct ctl_table uts_table; | 2614 | struct ctl_table uts_table; |
| 2617 | int r, write; | 2615 | int r, write; |
| @@ -2619,7 +2617,7 @@ static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen, | |||
| 2619 | memcpy(&uts_table, table, sizeof(uts_table)); | 2617 | memcpy(&uts_table, table, sizeof(uts_table)); |
| 2620 | uts_table.data = get_uts(table, write); | 2618 | uts_table.data = get_uts(table, write); |
| 2621 | r = sysctl_string(&uts_table, name, nlen, | 2619 | r = sysctl_string(&uts_table, name, nlen, |
| 2622 | oldval, oldlenp, newval, newlen, context); | 2620 | oldval, oldlenp, newval, newlen); |
| 2623 | put_uts(table, write, uts_table.data); | 2621 | put_uts(table, write, uts_table.data); |
| 2624 | return r; | 2622 | return r; |
| 2625 | } | 2623 | } |
| @@ -2628,7 +2626,7 @@ static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen, | |||
| 2628 | /* The generic sysctl ipc data routine. */ | 2626 | /* The generic sysctl ipc data routine. */ |
| 2629 | 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, |
| 2630 | void __user *oldval, size_t __user *oldlenp, | 2628 | void __user *oldval, size_t __user *oldlenp, |
| 2631 | void __user *newval, size_t newlen, void **context) | 2629 | void __user *newval, size_t newlen) |
| 2632 | { | 2630 | { |
| 2633 | size_t len; | 2631 | size_t len; |
| 2634 | void *data; | 2632 | void *data; |
| @@ -2703,41 +2701,41 @@ out: | |||
| 2703 | 2701 | ||
| 2704 | int sysctl_string(ctl_table *table, int __user *name, int nlen, | 2702 | int sysctl_string(ctl_table *table, int __user *name, int nlen, |
| 2705 | void __user *oldval, size_t __user *oldlenp, | 2703 | void __user *oldval, size_t __user *oldlenp, |
| 2706 | void __user *newval, size_t newlen, void **context) | 2704 | void __user *newval, size_t newlen) |
| 2707 | { | 2705 | { |
| 2708 | return -ENOSYS; | 2706 | return -ENOSYS; |
| 2709 | } | 2707 | } |
| 2710 | 2708 | ||
| 2711 | int sysctl_intvec(ctl_table *table, int __user *name, int nlen, | 2709 | int sysctl_intvec(ctl_table *table, int __user *name, int nlen, |
| 2712 | void __user *oldval, size_t __user *oldlenp, | 2710 | void __user *oldval, size_t __user *oldlenp, |
| 2713 | void __user *newval, size_t newlen, void **context) | 2711 | void __user *newval, size_t newlen) |
| 2714 | { | 2712 | { |
| 2715 | return -ENOSYS; | 2713 | return -ENOSYS; |
| 2716 | } | 2714 | } |
| 2717 | 2715 | ||
| 2718 | int sysctl_jiffies(ctl_table *table, int __user *name, int nlen, | 2716 | int sysctl_jiffies(ctl_table *table, int __user *name, int nlen, |
| 2719 | void __user *oldval, size_t __user *oldlenp, | 2717 | void __user *oldval, size_t __user *oldlenp, |
| 2720 | void __user *newval, size_t newlen, void **context) | 2718 | void __user *newval, size_t newlen) |
| 2721 | { | 2719 | { |
| 2722 | return -ENOSYS; | 2720 | return -ENOSYS; |
| 2723 | } | 2721 | } |
| 2724 | 2722 | ||
| 2725 | 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, |
| 2726 | void __user *oldval, size_t __user *oldlenp, | 2724 | void __user *oldval, size_t __user *oldlenp, |
| 2727 | void __user *newval, size_t newlen, void **context) | 2725 | void __user *newval, size_t newlen) |
| 2728 | { | 2726 | { |
| 2729 | return -ENOSYS; | 2727 | return -ENOSYS; |
| 2730 | } | 2728 | } |
| 2731 | 2729 | ||
| 2732 | 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, |
| 2733 | void __user *oldval, size_t __user *oldlenp, | 2731 | void __user *oldval, size_t __user *oldlenp, |
| 2734 | void __user *newval, size_t newlen, void **context) | 2732 | void __user *newval, size_t newlen) |
| 2735 | { | 2733 | { |
| 2736 | return -ENOSYS; | 2734 | return -ENOSYS; |
| 2737 | } | 2735 | } |
| 2738 | 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, |
| 2739 | void __user *oldval, size_t __user *oldlenp, | 2737 | void __user *oldval, size_t __user *oldlenp, |
| 2740 | void __user *newval, size_t newlen, void **context) | 2738 | void __user *newval, size_t newlen) |
| 2741 | { | 2739 | { |
| 2742 | return -ENOSYS; | 2740 | return -ENOSYS; |
| 2743 | } | 2741 | } |
