Commit 41735818766c0ec215b9a69591e7eae642061954
Committed by
Al Viro
1 parent
9cc64ceaa8
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 6 changed files with 16 additions and 16 deletions Side-by-side Diff
fs/autofs4/root.c
... | ... | @@ -587,7 +587,7 @@ |
587 | 587 | |
588 | 588 | /* This allows root to remove symlinks */ |
589 | 589 | if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN)) |
590 | - return -EACCES; | |
590 | + return -EPERM; | |
591 | 591 | |
592 | 592 | if (atomic_dec_and_test(&ino->count)) { |
593 | 593 | p_ino = autofs4_dentry_ino(dentry->d_parent); |
fs/dlm/config.c
fs/gfs2/sys.c
... | ... | @@ -107,7 +107,7 @@ |
107 | 107 | int n = simple_strtol(buf, NULL, 0); |
108 | 108 | |
109 | 109 | if (!capable(CAP_SYS_ADMIN)) |
110 | - return -EACCES; | |
110 | + return -EPERM; | |
111 | 111 | |
112 | 112 | switch (n) { |
113 | 113 | case 0: |
... | ... | @@ -135,7 +135,7 @@ |
135 | 135 | static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len) |
136 | 136 | { |
137 | 137 | if (!capable(CAP_SYS_ADMIN)) |
138 | - return -EACCES; | |
138 | + return -EPERM; | |
139 | 139 | |
140 | 140 | if (simple_strtol(buf, NULL, 0) != 1) |
141 | 141 | return -EINVAL; |
... | ... | @@ -150,7 +150,7 @@ |
150 | 150 | size_t len) |
151 | 151 | { |
152 | 152 | if (!capable(CAP_SYS_ADMIN)) |
153 | - return -EACCES; | |
153 | + return -EPERM; | |
154 | 154 | |
155 | 155 | if (simple_strtol(buf, NULL, 0) != 1) |
156 | 156 | return -EINVAL; |
... | ... | @@ -163,7 +163,7 @@ |
163 | 163 | size_t len) |
164 | 164 | { |
165 | 165 | if (!capable(CAP_SYS_ADMIN)) |
166 | - return -EACCES; | |
166 | + return -EPERM; | |
167 | 167 | |
168 | 168 | if (simple_strtol(buf, NULL, 0) != 1) |
169 | 169 | return -EINVAL; |
... | ... | @@ -179,7 +179,7 @@ |
179 | 179 | u32 id; |
180 | 180 | |
181 | 181 | if (!capable(CAP_SYS_ADMIN)) |
182 | - return -EACCES; | |
182 | + return -EPERM; | |
183 | 183 | |
184 | 184 | id = simple_strtoul(buf, NULL, 0); |
185 | 185 | |
... | ... | @@ -194,7 +194,7 @@ |
194 | 194 | u32 id; |
195 | 195 | |
196 | 196 | if (!capable(CAP_SYS_ADMIN)) |
197 | - return -EACCES; | |
197 | + return -EPERM; | |
198 | 198 | |
199 | 199 | id = simple_strtoul(buf, NULL, 0); |
200 | 200 | |
... | ... | @@ -213,7 +213,7 @@ |
213 | 213 | int rv; |
214 | 214 | |
215 | 215 | if (!capable(CAP_SYS_ADMIN)) |
216 | - return -EACCES; | |
216 | + return -EPERM; | |
217 | 217 | |
218 | 218 | rv = sscanf(buf, "%u:%llu %15s", &gltype, &glnum, |
219 | 219 | mode); |
... | ... | @@ -502,7 +502,7 @@ |
502 | 502 | unsigned int x, y; |
503 | 503 | |
504 | 504 | if (!capable(CAP_SYS_ADMIN)) |
505 | - return -EACCES; | |
505 | + return -EPERM; | |
506 | 506 | |
507 | 507 | if (sscanf(buf, "%u %u", &x, &y) != 2 || !y) |
508 | 508 | return -EINVAL; |
... | ... | @@ -521,7 +521,7 @@ |
521 | 521 | unsigned int x; |
522 | 522 | |
523 | 523 | if (!capable(CAP_SYS_ADMIN)) |
524 | - return -EACCES; | |
524 | + return -EPERM; | |
525 | 525 | |
526 | 526 | x = simple_strtoul(buf, NULL, 0); |
527 | 527 |
fs/ncpfs/ioctl.c
fs/proc/base.c
... | ... | @@ -1711,7 +1711,7 @@ |
1711 | 1711 | return -ECHILD; |
1712 | 1712 | |
1713 | 1713 | if (!capable(CAP_SYS_ADMIN)) { |
1714 | - status = -EACCES; | |
1714 | + status = -EPERM; | |
1715 | 1715 | goto out_notask; |
1716 | 1716 | } |
1717 | 1717 | |
... | ... | @@ -1844,7 +1844,7 @@ |
1844 | 1844 | struct dentry *result; |
1845 | 1845 | struct mm_struct *mm; |
1846 | 1846 | |
1847 | - result = ERR_PTR(-EACCES); | |
1847 | + result = ERR_PTR(-EPERM); | |
1848 | 1848 | if (!capable(CAP_SYS_ADMIN)) |
1849 | 1849 | goto out; |
1850 | 1850 | |
... | ... | @@ -1900,7 +1900,7 @@ |
1900 | 1900 | ino_t ino; |
1901 | 1901 | int ret; |
1902 | 1902 | |
1903 | - ret = -EACCES; | |
1903 | + ret = -EPERM; | |
1904 | 1904 | if (!capable(CAP_SYS_ADMIN)) |
1905 | 1905 | goto out; |
1906 | 1906 |