Skip to content

Commit

Permalink
proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter
Browse files Browse the repository at this point in the history
Writing to /proc/$pid/coredump_filter always returns -ESRCH because commit
774636e ("proc: convert to kstrto*()/kstrto*_from_user()") removed
the setting of ret after the get_proc_task call and incorrectly left it as
-ESRCH.  Instead, return 0 when successful.

Example breakage:

  echo 0 > /proc/self/coredump_filter
  bash: echo: write error: No such process

Fixes: 774636e ("proc: convert to kstrto*()/kstrto*_from_user()")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: <stable@vger.kernel.org> [4.3+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Colin Ian King authored and Linus Torvalds committed Dec 18, 2015
1 parent 73796d8 commit 41a0c24
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2494,6 +2494,7 @@ static ssize_t proc_coredump_filter_write(struct file *file,
mm = get_task_mm(task);
if (!mm)
goto out_no_mm;
ret = 0;

for (i = 0, mask = 1; i < MMF_DUMP_FILTER_BITS; i++, mask <<= 1) {
if (val & mask)
Expand Down

0 comments on commit 41a0c24

Please sign in to comment.