proc: put task earlier in /proc/*/fail-nth
authorAlexey Dobriyan <adobriyan@gmail.com>
Wed, 22 Aug 2018 04:54:27 +0000 (21:54 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 22 Aug 2018 17:52:45 +0000 (10:52 -0700)
Link: http://lkml.kernel.org/r/20180627195427.GE18113@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/base.c

index ad047977ed0457f78cfe793a3541cb0b8adb27f1..912a0306bb4d6705a610e2f901084e69d2957e6a 100644 (file)
@@ -1366,10 +1366,8 @@ static ssize_t proc_fail_nth_read(struct file *file, char __user *buf,
        if (!task)
                return -ESRCH;
        len = snprintf(numbuf, sizeof(numbuf), "%u\n", task->fail_nth);
-       len = simple_read_from_buffer(buf, count, ppos, numbuf, len);
        put_task_struct(task);
-
-       return len;
+       return simple_read_from_buffer(buf, count, ppos, numbuf, len);
 }
 
 static const struct file_operations proc_fail_nth_operations = {