Implement ->proc_write_buf() so procfs copies in what is written before it pins the entry. The write only clears the statistics and doesn't look at what was written anyway. Writes larger than PAGE_SIZE - 1 bytes fail with -EINVAL now.
Signed-off-by: Christian Brauner (Amutable) <[email protected]> --- kernel/latencytop.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/latencytop.c b/kernel/latencytop.c index b764f47606d3..35f73ca07656 100644 --- a/kernel/latencytop.c +++ b/kernel/latencytop.c @@ -267,8 +267,7 @@ static int lstats_show(struct seq_file *m, void *v) } static ssize_t -lstats_write(struct file *file, const char __user *buf, size_t count, - loff_t *offs) +lstats_write(struct file *file, char *buf, size_t count, loff_t *offs) { clear_global_latency_tracing(); @@ -277,7 +276,7 @@ lstats_write(struct file *file, const char __user *buf, size_t count, static const struct proc_ops lstats_proc_ops = { .proc_show = lstats_show, - .proc_write = lstats_write, + .proc_write_buf = lstats_write, }; static int __init init_lstats_procfs(void) -- 2.53.0
