aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sysctl.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-02-07 01:15:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-07 01:15:42 -0500
commita2e5790d841658485d642196dbb0927303d6c22f (patch)
treeb3d28c9bcb7da6880806146fd22a88a7ee7f733e /kernel/sysctl.c
parentab2d92ad881da11331280aedf612d82e61cb6d41 (diff)
parent60c3e026d73ccabb075fb70ba02f8512ab40cf2c (diff)
Merge branch 'akpm' (patches from Andrew)
Merge misc updates from Andrew Morton: - kasan updates - procfs - lib/bitmap updates - other lib/ updates - checkpatch tweaks - rapidio - ubsan - pipe fixes and cleanups - lots of other misc bits * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (114 commits) Documentation/sysctl/user.txt: fix typo MAINTAINERS: update ARM/QUALCOMM SUPPORT patterns MAINTAINERS: update various PALM patterns MAINTAINERS: update "ARM/OXNAS platform support" patterns MAINTAINERS: update Cortina/Gemini patterns MAINTAINERS: remove ARM/CLKDEV SUPPORT file pattern MAINTAINERS: remove ANDROID ION pattern mm: docs: add blank lines to silence sphinx "Unexpected indentation" errors mm: docs: fix parameter names mismatch mm: docs: fixup punctuation pipe: read buffer limits atomically pipe: simplify round_pipe_size() pipe: reject F_SETPIPE_SZ with size over UINT_MAX pipe: fix off-by-one error when checking buffer limits pipe: actually allow root to exceed the pipe buffer limits pipe, sysctl: remove pipe_proc_fn() pipe, sysctl: drop 'min' parameter from pipe-max-size converter kasan: rework Kconfig settings crash_dump: is_kdump_kernel can be boolean kernel/mutex: mutex_is_locked can be boolean ...
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r--kernel/sysctl.c33
1 files changed, 6 insertions, 27 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 2fb4e27c636a..f98f28c12020 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -218,6 +218,8 @@ static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
218static int proc_dostring_coredump(struct ctl_table *table, int write, 218static int proc_dostring_coredump(struct ctl_table *table, int write,
219 void __user *buffer, size_t *lenp, loff_t *ppos); 219 void __user *buffer, size_t *lenp, loff_t *ppos);
220#endif 220#endif
221static int proc_dopipe_max_size(struct ctl_table *table, int write,
222 void __user *buffer, size_t *lenp, loff_t *ppos);
221 223
222#ifdef CONFIG_MAGIC_SYSRQ 224#ifdef CONFIG_MAGIC_SYSRQ
223/* Note: sysrq code uses it's own private copy */ 225/* Note: sysrq code uses it's own private copy */
@@ -1812,8 +1814,7 @@ static struct ctl_table fs_table[] = {
1812 .data = &pipe_max_size, 1814 .data = &pipe_max_size,
1813 .maxlen = sizeof(pipe_max_size), 1815 .maxlen = sizeof(pipe_max_size),
1814 .mode = 0644, 1816 .mode = 0644,
1815 .proc_handler = &pipe_proc_fn, 1817 .proc_handler = proc_dopipe_max_size,
1816 .extra1 = &pipe_min_size,
1817 }, 1818 },
1818 { 1819 {
1819 .procname = "pipe-user-pages-hard", 1820 .procname = "pipe-user-pages-hard",
@@ -2615,29 +2616,17 @@ int proc_douintvec_minmax(struct ctl_table *table, int write,
2615 do_proc_douintvec_minmax_conv, &param); 2616 do_proc_douintvec_minmax_conv, &param);
2616} 2617}
2617 2618
2618struct do_proc_dopipe_max_size_conv_param {
2619 unsigned int *min;
2620};
2621
2622static int do_proc_dopipe_max_size_conv(unsigned long *lvalp, 2619static int do_proc_dopipe_max_size_conv(unsigned long *lvalp,
2623 unsigned int *valp, 2620 unsigned int *valp,
2624 int write, void *data) 2621 int write, void *data)
2625{ 2622{
2626 struct do_proc_dopipe_max_size_conv_param *param = data;
2627
2628 if (write) { 2623 if (write) {
2629 unsigned int val; 2624 unsigned int val;
2630 2625
2631 if (*lvalp > UINT_MAX)
2632 return -EINVAL;
2633
2634 val = round_pipe_size(*lvalp); 2626 val = round_pipe_size(*lvalp);
2635 if (val == 0) 2627 if (val == 0)
2636 return -EINVAL; 2628 return -EINVAL;
2637 2629
2638 if (param->min && *param->min > val)
2639 return -ERANGE;
2640
2641 *valp = val; 2630 *valp = val;
2642 } else { 2631 } else {
2643 unsigned int val = *valp; 2632 unsigned int val = *valp;
@@ -2647,14 +2636,11 @@ static int do_proc_dopipe_max_size_conv(unsigned long *lvalp,
2647 return 0; 2636 return 0;
2648} 2637}
2649 2638
2650int proc_dopipe_max_size(struct ctl_table *table, int write, 2639static int proc_dopipe_max_size(struct ctl_table *table, int write,
2651 void __user *buffer, size_t *lenp, loff_t *ppos) 2640 void __user *buffer, size_t *lenp, loff_t *ppos)
2652{ 2641{
2653 struct do_proc_dopipe_max_size_conv_param param = {
2654 .min = (unsigned int *) table->extra1,
2655 };
2656 return do_proc_douintvec(table, write, buffer, lenp, ppos, 2642 return do_proc_douintvec(table, write, buffer, lenp, ppos,
2657 do_proc_dopipe_max_size_conv, &param); 2643 do_proc_dopipe_max_size_conv, NULL);
2658} 2644}
2659 2645
2660static void validate_coredump_safety(void) 2646static void validate_coredump_safety(void)
@@ -3160,12 +3146,6 @@ int proc_douintvec_minmax(struct ctl_table *table, int write,
3160 return -ENOSYS; 3146 return -ENOSYS;
3161} 3147}
3162 3148
3163int proc_dopipe_max_size(struct ctl_table *table, int write,
3164 void __user *buffer, size_t *lenp, loff_t *ppos)
3165{
3166 return -ENOSYS;
3167}
3168
3169int proc_dointvec_jiffies(struct ctl_table *table, int write, 3149int proc_dointvec_jiffies(struct ctl_table *table, int write,
3170 void __user *buffer, size_t *lenp, loff_t *ppos) 3150 void __user *buffer, size_t *lenp, loff_t *ppos)
3171{ 3151{
@@ -3209,7 +3189,6 @@ EXPORT_SYMBOL(proc_douintvec);
3209EXPORT_SYMBOL(proc_dointvec_jiffies); 3189EXPORT_SYMBOL(proc_dointvec_jiffies);
3210EXPORT_SYMBOL(proc_dointvec_minmax); 3190EXPORT_SYMBOL(proc_dointvec_minmax);
3211EXPORT_SYMBOL_GPL(proc_douintvec_minmax); 3191EXPORT_SYMBOL_GPL(proc_douintvec_minmax);
3212EXPORT_SYMBOL_GPL(proc_dopipe_max_size);
3213EXPORT_SYMBOL(proc_dointvec_userhz_jiffies); 3192EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
3214EXPORT_SYMBOL(proc_dointvec_ms_jiffies); 3193EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
3215EXPORT_SYMBOL(proc_dostring); 3194EXPORT_SYMBOL(proc_dostring);