proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter
Subsystems (2)
PATCH 1/3 proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter
From: Colin Ian King <[email protected]>
Subject: proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter
echo 0 > /proc/self/coredump_filter
bash: echo: write error: No such process
Writing to /proc/$pid/coredump_filter always returns -ESRCH because commit 774636e19ed51 ("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.
Fixes 774636e19ed51 ("proc: convert to kstrto*()/kstrto*_from_user()")
Signed-off-by Colin Ian King <[email protected]>
Acked-by Kees Cook <[email protected]>
Cc <[email protected]> [4.3+]
Signed-off-by Andrew Morton <[email protected]>
---
fs/proc/base.c | 1 + 1 file changed, 1 insertion(+)
fs/proc/base.c renamed from fs/proc/base.c~proc-fix-esrch-error-when-writing-to-proc-pid-coredump_filter +1 -0
@@ -2494,6 +2494,7 @@ static ssize_t proc_coredump_filter_writ 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)
_