diff options
author | Zhao Hongjiang <zhaohongjiang@huawei.com> | 2013-02-19 21:13:55 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-26 02:46:14 -0500 |
commit | 41735818766c0ec215b9a69591e7eae642061954 (patch) | |
tree | 564ccbbc05d987f833050573e7fad23ce34dfc89 /fs/proc/base.c | |
parent | 9cc64ceaa8b8e8c874519caee79e18cb35d3ce3e (diff) |
fs: change return values from -EACCES to -EPERM
According to SUSv3:
[EACCES] Permission denied. An attempt was made to access a file in a way
forbidden by its file access permissions.
[EPERM] Operation not permitted. An attempt was made to perform an operation
limited to processes with appropriate privileges or to the owner of a file
or other resource.
So -EPERM should be returned if capability checks fails.
Strictly speaking this is an API change since the error code user sees is
altered.
Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com>
Acked-by: Jan Kara <jack@suse.cz>
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
Acked-by: Ian Kent <raven@themaw.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 9d9625559727..f3b133d79914 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1711,7 +1711,7 @@ static int map_files_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
1711 | return -ECHILD; | 1711 | return -ECHILD; |
1712 | 1712 | ||
1713 | if (!capable(CAP_SYS_ADMIN)) { | 1713 | if (!capable(CAP_SYS_ADMIN)) { |
1714 | status = -EACCES; | 1714 | status = -EPERM; |
1715 | goto out_notask; | 1715 | goto out_notask; |
1716 | } | 1716 | } |
1717 | 1717 | ||
@@ -1844,7 +1844,7 @@ static struct dentry *proc_map_files_lookup(struct inode *dir, | |||
1844 | struct dentry *result; | 1844 | struct dentry *result; |
1845 | struct mm_struct *mm; | 1845 | struct mm_struct *mm; |
1846 | 1846 | ||
1847 | result = ERR_PTR(-EACCES); | 1847 | result = ERR_PTR(-EPERM); |
1848 | if (!capable(CAP_SYS_ADMIN)) | 1848 | if (!capable(CAP_SYS_ADMIN)) |
1849 | goto out; | 1849 | goto out; |
1850 | 1850 | ||
@@ -1900,7 +1900,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
1900 | ino_t ino; | 1900 | ino_t ino; |
1901 | int ret; | 1901 | int ret; |
1902 | 1902 | ||
1903 | ret = -EACCES; | 1903 | ret = -EPERM; |
1904 | if (!capable(CAP_SYS_ADMIN)) | 1904 | if (!capable(CAP_SYS_ADMIN)) |
1905 | goto out; | 1905 | goto out; |
1906 | 1906 | ||