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 | |
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>
-rw-r--r-- | fs/autofs4/root.c | 2 | ||||
-rw-r--r-- | fs/dlm/config.c | 2 | ||||
-rw-r--r-- | fs/gfs2/sys.c | 18 | ||||
-rw-r--r-- | fs/ncpfs/ioctl.c | 2 | ||||
-rw-r--r-- | fs/proc/base.c | 6 | ||||
-rw-r--r-- | fs/udf/file.c | 2 |
6 files changed, 16 insertions, 16 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 3cdf835e8b49..230bd2aad4f4 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -587,7 +587,7 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry) | |||
587 | 587 | ||
588 | /* This allows root to remove symlinks */ | 588 | /* This allows root to remove symlinks */ |
589 | if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN)) | 589 | if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN)) |
590 | return -EACCES; | 590 | return -EPERM; |
591 | 591 | ||
592 | if (atomic_dec_and_test(&ino->count)) { | 592 | if (atomic_dec_and_test(&ino->count)) { |
593 | p_ino = autofs4_dentry_ino(dentry->d_parent); | 593 | p_ino = autofs4_dentry_ino(dentry->d_parent); |
diff --git a/fs/dlm/config.c b/fs/dlm/config.c index a0387dd8b1f0..7d58d5b112b5 100644 --- a/fs/dlm/config.c +++ b/fs/dlm/config.c | |||
@@ -158,7 +158,7 @@ static ssize_t cluster_set(struct dlm_cluster *cl, unsigned int *cl_field, | |||
158 | unsigned int x; | 158 | unsigned int x; |
159 | 159 | ||
160 | if (!capable(CAP_SYS_ADMIN)) | 160 | if (!capable(CAP_SYS_ADMIN)) |
161 | return -EACCES; | 161 | return -EPERM; |
162 | 162 | ||
163 | x = simple_strtoul(buf, NULL, 0); | 163 | x = simple_strtoul(buf, NULL, 0); |
164 | 164 | ||
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 8056b7b7238e..0acbe2ff1e5d 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -107,7 +107,7 @@ static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len) | |||
107 | int n = simple_strtol(buf, NULL, 0); | 107 | int n = simple_strtol(buf, NULL, 0); |
108 | 108 | ||
109 | if (!capable(CAP_SYS_ADMIN)) | 109 | if (!capable(CAP_SYS_ADMIN)) |
110 | return -EACCES; | 110 | return -EPERM; |
111 | 111 | ||
112 | switch (n) { | 112 | switch (n) { |
113 | case 0: | 113 | case 0: |
@@ -135,7 +135,7 @@ static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf) | |||
135 | static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len) | 135 | static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len) |
136 | { | 136 | { |
137 | if (!capable(CAP_SYS_ADMIN)) | 137 | if (!capable(CAP_SYS_ADMIN)) |
138 | return -EACCES; | 138 | return -EPERM; |
139 | 139 | ||
140 | if (simple_strtol(buf, NULL, 0) != 1) | 140 | if (simple_strtol(buf, NULL, 0) != 1) |
141 | return -EINVAL; | 141 | return -EINVAL; |
@@ -150,7 +150,7 @@ static ssize_t statfs_sync_store(struct gfs2_sbd *sdp, const char *buf, | |||
150 | size_t len) | 150 | size_t len) |
151 | { | 151 | { |
152 | if (!capable(CAP_SYS_ADMIN)) | 152 | if (!capable(CAP_SYS_ADMIN)) |
153 | return -EACCES; | 153 | return -EPERM; |
154 | 154 | ||
155 | if (simple_strtol(buf, NULL, 0) != 1) | 155 | if (simple_strtol(buf, NULL, 0) != 1) |
156 | return -EINVAL; | 156 | return -EINVAL; |
@@ -163,7 +163,7 @@ static ssize_t quota_sync_store(struct gfs2_sbd *sdp, const char *buf, | |||
163 | size_t len) | 163 | size_t len) |
164 | { | 164 | { |
165 | if (!capable(CAP_SYS_ADMIN)) | 165 | if (!capable(CAP_SYS_ADMIN)) |
166 | return -EACCES; | 166 | return -EPERM; |
167 | 167 | ||
168 | if (simple_strtol(buf, NULL, 0) != 1) | 168 | if (simple_strtol(buf, NULL, 0) != 1) |
169 | return -EINVAL; | 169 | return -EINVAL; |
@@ -179,7 +179,7 @@ static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf, | |||
179 | u32 id; | 179 | u32 id; |
180 | 180 | ||
181 | if (!capable(CAP_SYS_ADMIN)) | 181 | if (!capable(CAP_SYS_ADMIN)) |
182 | return -EACCES; | 182 | return -EPERM; |
183 | 183 | ||
184 | id = simple_strtoul(buf, NULL, 0); | 184 | id = simple_strtoul(buf, NULL, 0); |
185 | 185 | ||
@@ -194,7 +194,7 @@ static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf, | |||
194 | u32 id; | 194 | u32 id; |
195 | 195 | ||
196 | if (!capable(CAP_SYS_ADMIN)) | 196 | if (!capable(CAP_SYS_ADMIN)) |
197 | return -EACCES; | 197 | return -EPERM; |
198 | 198 | ||
199 | id = simple_strtoul(buf, NULL, 0); | 199 | id = simple_strtoul(buf, NULL, 0); |
200 | 200 | ||
@@ -213,7 +213,7 @@ static ssize_t demote_rq_store(struct gfs2_sbd *sdp, const char *buf, size_t len | |||
213 | int rv; | 213 | int rv; |
214 | 214 | ||
215 | if (!capable(CAP_SYS_ADMIN)) | 215 | if (!capable(CAP_SYS_ADMIN)) |
216 | return -EACCES; | 216 | return -EPERM; |
217 | 217 | ||
218 | rv = sscanf(buf, "%u:%llu %15s", &gltype, &glnum, | 218 | rv = sscanf(buf, "%u:%llu %15s", &gltype, &glnum, |
219 | mode); | 219 | mode); |
@@ -502,7 +502,7 @@ static ssize_t quota_scale_store(struct gfs2_sbd *sdp, const char *buf, | |||
502 | unsigned int x, y; | 502 | unsigned int x, y; |
503 | 503 | ||
504 | if (!capable(CAP_SYS_ADMIN)) | 504 | if (!capable(CAP_SYS_ADMIN)) |
505 | return -EACCES; | 505 | return -EPERM; |
506 | 506 | ||
507 | if (sscanf(buf, "%u %u", &x, &y) != 2 || !y) | 507 | if (sscanf(buf, "%u %u", &x, &y) != 2 || !y) |
508 | return -EINVAL; | 508 | return -EINVAL; |
@@ -521,7 +521,7 @@ static ssize_t tune_set(struct gfs2_sbd *sdp, unsigned int *field, | |||
521 | unsigned int x; | 521 | unsigned int x; |
522 | 522 | ||
523 | if (!capable(CAP_SYS_ADMIN)) | 523 | if (!capable(CAP_SYS_ADMIN)) |
524 | return -EACCES; | 524 | return -EPERM; |
525 | 525 | ||
526 | x = simple_strtoul(buf, NULL, 0); | 526 | x = simple_strtoul(buf, NULL, 0); |
527 | 527 | ||
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index 5c1e9262219c..811d411418de 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c | |||
@@ -819,7 +819,7 @@ long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
819 | case NCP_IOC_CONN_LOGGED_IN: | 819 | case NCP_IOC_CONN_LOGGED_IN: |
820 | case NCP_IOC_SETROOT: | 820 | case NCP_IOC_SETROOT: |
821 | if (!capable(CAP_SYS_ADMIN)) { | 821 | if (!capable(CAP_SYS_ADMIN)) { |
822 | ret = -EACCES; | 822 | ret = -EPERM; |
823 | goto out; | 823 | goto out; |
824 | } | 824 | } |
825 | break; | 825 | break; |
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 | ||
diff --git a/fs/udf/file.c b/fs/udf/file.c index 4257a1f5302a..29569dd08168 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -204,7 +204,7 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
204 | goto out; | 204 | goto out; |
205 | case UDF_RELOCATE_BLOCKS: | 205 | case UDF_RELOCATE_BLOCKS: |
206 | if (!capable(CAP_SYS_ADMIN)) { | 206 | if (!capable(CAP_SYS_ADMIN)) { |
207 | result = -EACCES; | 207 | result = -EPERM; |
208 | goto out; | 208 | goto out; |
209 | } | 209 | } |
210 | if (get_user(old_block, (long __user *)arg)) { | 210 | if (get_user(old_block, (long __user *)arg)) { |