name and nlen parameters passed to ->strategy hook are unused, remove them. In general ->strategy hook should know what it's doing, and don't do something tricky for which, say, pointer to original userspace array may be needed (name).
Showing the changes to kernel/sysctl.c (1 of 16 files). Show all
Unified · Split
| @@ -1500,7 +1500,6 @@ void register_sysctl_root(struct ctl_table_root *root) · 1499 unmodified lines | ||
| 1500 | 1500 | /* Perform the actual read/write of a sysctl table entry. */ |
| 1501 | 1501 | static int do_sysctl_strategy(struct ctl_table_root *root, |
| 1502 | 1502 | struct ctl_table *table, |
| 1503 | − int __user *name, int nlen, | |
| 1504 | 1503 | void __user *oldval, size_t __user *oldlenp, |
| 1505 | 1504 | void __user *newval, size_t newlen) |
| 1506 | 1505 | { |
| @@ -1514,8 +1513,7 @@ static int do_sysctl_strategy(struct ctl_table_root *root, · 7 unmodified lines | ||
| 1514 | 1513 | return -EPERM; |
| 1515 | 1514 | |
| 1516 | 1515 | if (table->strategy) { |
| 1517 | − rc = table->strategy(table, name, nlen, oldval, oldlenp, | |
| 1518 | − newval, newlen); | |
| 1516 | + rc = table->strategy(table, oldval, oldlenp, newval, newlen); | |
| 1519 | 1517 | if (rc < 0) |
| 1520 | 1518 | return rc; |
| 1521 | 1519 | if (rc > 0) |
| @@ -1525,8 +1523,7 @@ static int do_sysctl_strategy(struct ctl_table_root *root, · 3 unmodified lines | ||
| 1525 | 1523 | /* If there is no strategy routine, or if the strategy returns |
| 1526 | 1524 | * zero, proceed with automatic r/w */ |
| 1527 | 1525 | if (table->data && table->maxlen) { |
| 1528 | − rc = sysctl_data(table, name, nlen, oldval, oldlenp, | |
| 1529 | − newval, newlen); | |
| 1526 | + rc = sysctl_data(table, oldval, oldlenp, newval, newlen); | |
| 1530 | 1527 | if (rc < 0) |
| 1531 | 1528 | return rc; |
| 1532 | 1529 | } |
| @@ -1558,7 +1555,7 @@ repeat: · 25 unmodified lines | ||
| 1558 | 1555 | table = table->child; |
| 1559 | 1556 | goto repeat; |
| 1560 | 1557 | } |
| 1561 | − error = do_sysctl_strategy(root, table, name, nlen, | |
| 1558 | + error = do_sysctl_strategy(root, table, | |
| 1562 | 1559 | oldval, oldlenp, |
| 1563 | 1560 | newval, newlen); |
| 1564 | 1561 | return error; |
| @@ -2707,7 +2704,7 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, · 1142 unmodified lines | ||
| 2707 | 2704 | */ |
| 2708 | 2705 | |
| 2709 | 2706 | /* The generic sysctl data routine (used if no strategy routine supplied) */ |
| 2710 | −int sysctl_data(struct ctl_table *table, int __user *name, int nlen, | |
| 2707 | +int sysctl_data(struct ctl_table *table, | |
| 2711 | 2708 | void __user *oldval, size_t __user *oldlenp, |
| 2712 | 2709 | void __user *newval, size_t newlen) |
| 2713 | 2710 | { |
| @@ -2741,7 +2738,7 @@ int sysctl_data(struct ctl_table *table, int __user *name, int nlen, · 27 unmodified lines | ||
| 2741 | 2738 | } |
| 2742 | 2739 | |
| 2743 | 2740 | /* The generic string strategy routine: */ |
| 2744 | −int sysctl_string(struct ctl_table *table, int __user *name, int nlen, | |
| 2741 | +int sysctl_string(struct ctl_table *table, | |
| 2745 | 2742 | void __user *oldval, size_t __user *oldlenp, |
| 2746 | 2743 | void __user *newval, size_t newlen) |
| 2747 | 2744 | { |
| @@ -2787,7 +2784,7 @@ int sysctl_string(struct ctl_table *table, int __user *name, int nlen, · 39 unmodified lines | ||
| 2787 | 2784 | * are between the minimum and maximum values given in the arrays |
| 2788 | 2785 | * table->extra1 and table->extra2, respectively. |
| 2789 | 2786 | */ |
| 2790 | −int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen, | |
| 2787 | +int sysctl_intvec(struct ctl_table *table, | |
| 2791 | 2788 | void __user *oldval, size_t __user *oldlenp, |
| 2792 | 2789 | void __user *newval, size_t newlen) |
| 2793 | 2790 | { |
| @@ -2823,7 +2820,7 @@ int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen, · 29 unmodified lines | ||
| 2823 | 2820 | } |
| 2824 | 2821 | |
| 2825 | 2822 | /* Strategy function to convert jiffies to seconds */ |
| 2826 | −int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen, | |
| 2823 | +int sysctl_jiffies(struct ctl_table *table, | |
| 2827 | 2824 | void __user *oldval, size_t __user *oldlenp, |
| 2828 | 2825 | void __user *newval, size_t newlen) |
| 2829 | 2826 | { |
| @@ -2857,7 +2854,7 @@ int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen, · 27 unmodified lines | ||
| 2857 | 2854 | } |
| 2858 | 2855 | |
| 2859 | 2856 | /* Strategy function to convert jiffies to seconds */ |
| 2860 | −int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen, | |
| 2857 | +int sysctl_ms_jiffies(struct ctl_table *table, | |
| 2861 | 2858 | void __user *oldval, size_t __user *oldlenp, |
| 2862 | 2859 | void __user *newval, size_t newlen) |
| 2863 | 2860 | { |
| @@ -2912,35 +2909,35 @@ asmlinkage long sys_sysctl(struct __sysctl_args __user *args) · 48 unmodified lines | ||
| 2912 | 2909 | return error; |
| 2913 | 2910 | } |
| 2914 | 2911 | |
| 2915 | −int sysctl_data(struct ctl_table *table, int __user *name, int nlen, | |
| 2912 | +int sysctl_data(struct ctl_table *table, | |
| 2916 | 2913 | void __user *oldval, size_t __user *oldlenp, |
| 2917 | 2914 | void __user *newval, size_t newlen) |
| 2918 | 2915 | { |
| 2919 | 2916 | return -ENOSYS; |
| 2920 | 2917 | } |
| 2921 | 2918 | |
| 2922 | −int sysctl_string(struct ctl_table *table, int __user *name, int nlen, | |
| 2919 | +int sysctl_string(struct ctl_table *table, | |
| 2923 | 2920 | void __user *oldval, size_t __user *oldlenp, |
| 2924 | 2921 | void __user *newval, size_t newlen) |
| 2925 | 2922 | { |
| 2926 | 2923 | return -ENOSYS; |
| 2927 | 2924 | } |
| 2928 | 2925 | |
| 2929 | −int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen, | |
| 2926 | +int sysctl_intvec(struct ctl_table *table, | |
| 2930 | 2927 | void __user *oldval, size_t __user *oldlenp, |
| 2931 | 2928 | void __user *newval, size_t newlen) |
| 2932 | 2929 | { |
| 2933 | 2930 | return -ENOSYS; |
| 2934 | 2931 | } |
| 2935 | 2932 | |
| 2936 | −int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen, | |
| 2933 | +int sysctl_jiffies(struct ctl_table *table, | |
| 2937 | 2934 | void __user *oldval, size_t __user *oldlenp, |
| 2938 | 2935 | void __user *newval, size_t newlen) |
| 2939 | 2936 | { |
| 2940 | 2937 | return -ENOSYS; |
| 2941 | 2938 | } |
| 2942 | 2939 | |
| 2943 | −int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen, | |
| 2940 | +int sysctl_ms_jiffies(struct ctl_table *table, | |
| 2944 | 2941 | void __user *oldval, size_t __user *oldlenp, |
| 2945 | 2942 | void __user *newval, size_t newlen) |
| 2946 | 2943 | { |