summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2018-02-06 18:41:49 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-06 21:32:47 -0500
commit319e0a21bb7823abbb4818fe2724e572bbac77a2 (patch)
tree99dca1041887a3131014b99dbef9244c8affce00
parent4c2e4befb3cc9ce42d506aa537c9ab504723e98c (diff)
pipe, sysctl: remove pipe_proc_fn()
pipe_proc_fn() is no longer needed, as it only calls through to proc_dopipe_max_size(). Just put proc_dopipe_max_size() in the ctl_table entry directly, and remove the unneeded EXPORT_SYMBOL() and the ENOSYS stub for it. (The reason the ENOSYS stub isn't needed is that the pipe-max-size ctl_table entry is located directly in 'kern_table' rather than being registered separately. Therefore, the entry is already only defined when the kernel is built with sysctl support.) Link: http://lkml.kernel.org/r/20180111052902.14409-3-ebiggers3@gmail.com Signed-off-by: Eric Biggers <ebiggers@google.com> Acked-by: Kees Cook <keescook@chromium.org> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: "Luis R . Rodriguez" <mcgrof@kernel.org> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Cc: Mikulas Patocka <mpatocka@redhat.com> Cc: Willy Tarreau <w@1wt.eu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/pipe.c10
-rw-r--r--include/linux/pipe_fs_i.h1
-rw-r--r--include/linux/sysctl.h3
-rw-r--r--kernel/sysctl.c15
4 files changed, 5 insertions, 24 deletions
diff --git a/fs/pipe.c b/fs/pipe.c
index 1f6ec1051e59..61adbf0f5b53 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1121,16 +1121,6 @@ out_revert_acct:
1121} 1121}
1122 1122
1123/* 1123/*
1124 * This should work even if CONFIG_PROC_FS isn't set, as proc_dopipe_max_size
1125 * will return an error.
1126 */
1127int pipe_proc_fn(struct ctl_table *table, int write, void __user *buf,
1128 size_t *lenp, loff_t *ppos)
1129{
1130 return proc_dopipe_max_size(table, write, buf, lenp, ppos);
1131}
1132
1133/*
1134 * After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same 1124 * After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same
1135 * location, so checking ->i_pipe is not enough to verify that this is a 1125 * location, so checking ->i_pipe is not enough to verify that this is a
1136 * pipe. 1126 * pipe.
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 7d9beda14584..5028bd4b2c96 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -170,7 +170,6 @@ void pipe_double_lock(struct pipe_inode_info *, struct pipe_inode_info *);
170extern unsigned int pipe_max_size; 170extern unsigned int pipe_max_size;
171extern unsigned long pipe_user_pages_hard; 171extern unsigned long pipe_user_pages_hard;
172extern unsigned long pipe_user_pages_soft; 172extern unsigned long pipe_user_pages_soft;
173int pipe_proc_fn(struct ctl_table *, int, void __user *, size_t *, loff_t *);
174 173
175/* Drop the inode semaphore and wait for a pipe event, atomically */ 174/* Drop the inode semaphore and wait for a pipe event, atomically */
176void pipe_wait(struct pipe_inode_info *pipe); 175void pipe_wait(struct pipe_inode_info *pipe);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 992bc9948232..b769ecfcc3bd 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -51,9 +51,6 @@ extern int proc_dointvec_minmax(struct ctl_table *, int,
51extern int proc_douintvec_minmax(struct ctl_table *table, int write, 51extern int proc_douintvec_minmax(struct ctl_table *table, int write,
52 void __user *buffer, size_t *lenp, 52 void __user *buffer, size_t *lenp,
53 loff_t *ppos); 53 loff_t *ppos);
54extern int proc_dopipe_max_size(struct ctl_table *table, int write,
55 void __user *buffer, size_t *lenp,
56 loff_t *ppos);
57extern int proc_dointvec_jiffies(struct ctl_table *, int, 54extern int proc_dointvec_jiffies(struct ctl_table *, int,
58 void __user *, size_t *, loff_t *); 55 void __user *, size_t *, loff_t *);
59extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int, 56extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int,
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index f21375aa6cf6..59f09ea3ca3e 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,7 +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 }, 1818 },
1817 { 1819 {
1818 .procname = "pipe-user-pages-hard", 1820 .procname = "pipe-user-pages-hard",
@@ -2637,8 +2639,8 @@ static int do_proc_dopipe_max_size_conv(unsigned long *lvalp,
2637 return 0; 2639 return 0;
2638} 2640}
2639 2641
2640int proc_dopipe_max_size(struct ctl_table *table, int write, 2642static int proc_dopipe_max_size(struct ctl_table *table, int write,
2641 void __user *buffer, size_t *lenp, loff_t *ppos) 2643 void __user *buffer, size_t *lenp, loff_t *ppos)
2642{ 2644{
2643 return do_proc_douintvec(table, write, buffer, lenp, ppos, 2645 return do_proc_douintvec(table, write, buffer, lenp, ppos,
2644 do_proc_dopipe_max_size_conv, NULL); 2646 do_proc_dopipe_max_size_conv, NULL);
@@ -3147,12 +3149,6 @@ int proc_douintvec_minmax(struct ctl_table *table, int write,
3147 return -ENOSYS; 3149 return -ENOSYS;
3148} 3150}
3149 3151
3150int proc_dopipe_max_size(struct ctl_table *table, int write,
3151 void __user *buffer, size_t *lenp, loff_t *ppos)
3152{
3153 return -ENOSYS;
3154}
3155
3156int proc_dointvec_jiffies(struct ctl_table *table, int write, 3152int proc_dointvec_jiffies(struct ctl_table *table, int write,
3157 void __user *buffer, size_t *lenp, loff_t *ppos) 3153 void __user *buffer, size_t *lenp, loff_t *ppos)
3158{ 3154{
@@ -3196,7 +3192,6 @@ EXPORT_SYMBOL(proc_douintvec);
3196EXPORT_SYMBOL(proc_dointvec_jiffies); 3192EXPORT_SYMBOL(proc_dointvec_jiffies);
3197EXPORT_SYMBOL(proc_dointvec_minmax); 3193EXPORT_SYMBOL(proc_dointvec_minmax);
3198EXPORT_SYMBOL_GPL(proc_douintvec_minmax); 3194EXPORT_SYMBOL_GPL(proc_douintvec_minmax);
3199EXPORT_SYMBOL_GPL(proc_dopipe_max_size);
3200EXPORT_SYMBOL(proc_dointvec_userhz_jiffies); 3195EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
3201EXPORT_SYMBOL(proc_dointvec_ms_jiffies); 3196EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
3202EXPORT_SYMBOL(proc_dostring); 3197EXPORT_SYMBOL(proc_dostring);