diff options
author | Jovi Zhang <bookjovi@gmail.com> | 2011-03-23 19:42:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-23 22:46:36 -0400 |
commit | fc3d8767b2b6de955579852d7a150f1734265eaf (patch) | |
tree | 282762d459af3ebdf0bf8661a9422d55fc74dbb1 /fs/proc/base.c | |
parent | 0db0c01b53a1a421513f91573241aabafb87802a (diff) |
procfs: fix some wrong error code usage
[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>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index c3af15e9c070..daba13653256 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -775,7 +775,8 @@ static ssize_t mem_read(struct file * file, char __user * buf, | |||
775 | if (!task) | 775 | if (!task) |
776 | goto out_no_task; | 776 | goto out_no_task; |
777 | 777 | ||
778 | if (check_mem_permission(task)) | 778 | ret = check_mem_permission(task); |
779 | if (ret) | ||
779 | goto out; | 780 | goto out; |
780 | 781 | ||
781 | ret = -ENOMEM; | 782 | ret = -ENOMEM; |
@@ -845,7 +846,8 @@ static ssize_t mem_write(struct file * file, const char __user *buf, | |||
845 | if (!task) | 846 | if (!task) |
846 | goto out_no_task; | 847 | goto out_no_task; |
847 | 848 | ||
848 | if (check_mem_permission(task)) | 849 | copied = check_mem_permission(task); |
850 | if (copied) | ||
849 | goto out; | 851 | goto out; |
850 | 852 | ||
851 | copied = -ENOMEM; | 853 | copied = -ENOMEM; |
@@ -917,6 +919,7 @@ static ssize_t environ_read(struct file *file, char __user *buf, | |||
917 | if (!task) | 919 | if (!task) |
918 | goto out_no_task; | 920 | goto out_no_task; |
919 | 921 | ||
922 | ret = -EPERM; | ||
920 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) | 923 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) |
921 | goto out; | 924 | goto out; |
922 | 925 | ||