[root@wei 1]# cat /proc/1/mem
cat: /proc/1/mem: No such process
error code -ESRCH is wrong in this situation. Return -EPERM instead.
Signed-off-by: Jovi Zhang <bookjovi@gmail.com>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
if (!task)
goto out_no_task;
- if (check_mem_permission(task))
+ ret = check_mem_permission(task);
+ if (ret)
goto out;
ret = -ENOMEM;
if (!task)
goto out_no_task;
- if (check_mem_permission(task))
+ copied = check_mem_permission(task);
+ if (copied)
goto out;
copied = -ENOMEM;
if (!task)
goto out_no_task;
+ ret = -EPERM;
if (!ptrace_may_access(task, PTRACE_MODE_READ))
goto out;