]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fs: change return values from -EACCES to -EPERM
authorZhao Hongjiang <zhaohongjiang@huawei.com>
Wed, 20 Feb 2013 02:13:55 +0000 (13:13 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 20 Feb 2013 05:52:18 +0000 (16:52 +1100)
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>
fs/autofs4/root.c
fs/dlm/config.c
fs/gfs2/sys.c
fs/ncpfs/ioctl.c
fs/proc/base.c
fs/udf/file.c

index c93447604da859bf5b3de0435c4d26852811bb95..847ee4dd72a4703ae4cc357516be2a741463ba28 100644 (file)
@@ -587,7 +587,7 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry)
        
        /* This allows root to remove symlinks */
        if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN))
-               return -EACCES;
+               return -EPERM;
 
        if (atomic_dec_and_test(&ino->count)) {
                p_ino = autofs4_dentry_ino(dentry->d_parent);
index a0387dd8b1f0f3abf10ab7e257f9af34d7886900..7d58d5b112b559ccc9a9145a003f15e076d8a27b 100644 (file)
@@ -158,7 +158,7 @@ static ssize_t cluster_set(struct dlm_cluster *cl, unsigned int *cl_field,
        unsigned int x;
 
        if (!capable(CAP_SYS_ADMIN))
-               return -EACCES;
+               return -EPERM;
 
        x = simple_strtoul(buf, NULL, 0);
 
index 597a612834dc136a3addb508656daafed1784a5b..aa5c48044966697c2365712ab53a20d7bc5d8958 100644 (file)
@@ -103,7 +103,7 @@ static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
        int n = simple_strtol(buf, NULL, 0);
 
        if (!capable(CAP_SYS_ADMIN))
-               return -EACCES;
+               return -EPERM;
 
        switch (n) {
        case 0:
@@ -133,7 +133,7 @@ static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf)
 static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
 {
        if (!capable(CAP_SYS_ADMIN))
-               return -EACCES;
+               return -EPERM;
 
        if (simple_strtol(buf, NULL, 0) != 1)
                return -EINVAL;
@@ -148,7 +148,7 @@ static ssize_t statfs_sync_store(struct gfs2_sbd *sdp, const char *buf,
                                 size_t len)
 {
        if (!capable(CAP_SYS_ADMIN))
-               return -EACCES;
+               return -EPERM;
 
        if (simple_strtol(buf, NULL, 0) != 1)
                return -EINVAL;
@@ -161,7 +161,7 @@ static ssize_t quota_sync_store(struct gfs2_sbd *sdp, const char *buf,
                                size_t len)
 {
        if (!capable(CAP_SYS_ADMIN))
-               return -EACCES;
+               return -EPERM;
 
        if (simple_strtol(buf, NULL, 0) != 1)
                return -EINVAL;
@@ -178,7 +178,7 @@ static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf,
        u32 id;
 
        if (!capable(CAP_SYS_ADMIN))
-               return -EACCES;
+               return -EPERM;
 
        id = simple_strtoul(buf, NULL, 0);
 
@@ -198,7 +198,7 @@ static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf,
        u32 id;
 
        if (!capable(CAP_SYS_ADMIN))
-               return -EACCES;
+               return -EPERM;
 
        id = simple_strtoul(buf, NULL, 0);
 
@@ -221,7 +221,7 @@ static ssize_t demote_rq_store(struct gfs2_sbd *sdp, const char *buf, size_t len
        int rv;
 
        if (!capable(CAP_SYS_ADMIN))
-               return -EACCES;
+               return -EPERM;
 
        rv = sscanf(buf, "%u:%llu %15s", &gltype, &glnum,
                    mode);
@@ -532,7 +532,7 @@ static ssize_t quota_scale_store(struct gfs2_sbd *sdp, const char *buf,
        unsigned int x, y;
 
        if (!capable(CAP_SYS_ADMIN))
-               return -EACCES;
+               return -EPERM;
 
        if (sscanf(buf, "%u %u", &x, &y) != 2 || !y)
                return -EINVAL;
@@ -551,7 +551,7 @@ static ssize_t tune_set(struct gfs2_sbd *sdp, unsigned int *field,
        unsigned int x;
 
        if (!capable(CAP_SYS_ADMIN))
-               return -EACCES;
+               return -EPERM;
 
        x = simple_strtoul(buf, NULL, 0);
 
index d44318d275049c1dbe0971c23e0ca4876ad6b1ae..d384c230b0089197eec563b00595c526d0f70c8f 100644 (file)
@@ -822,7 +822,7 @@ long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
        case NCP_IOC_CONN_LOGGED_IN:
        case NCP_IOC_SETROOT:
                if (!capable(CAP_SYS_ADMIN)) {
-                       ret = -EACCES;
+                       ret = -EPERM;
                        goto out;
                }
                break;
index 9b43ff77a51ed3b0383f3e96489e1e542331555a..0a4443d15aff31b2cdededffc2226624aba139e1 100644 (file)
@@ -1711,7 +1711,7 @@ static int map_files_d_revalidate(struct dentry *dentry, unsigned int flags)
                return -ECHILD;
 
        if (!capable(CAP_SYS_ADMIN)) {
-               status = -EACCES;
+               status = -EPERM;
                goto out_notask;
        }
 
@@ -1844,7 +1844,7 @@ static struct dentry *proc_map_files_lookup(struct inode *dir,
        struct dentry *result;
        struct mm_struct *mm;
 
-       result = ERR_PTR(-EACCES);
+       result = ERR_PTR(-EPERM);
        if (!capable(CAP_SYS_ADMIN))
                goto out;
 
@@ -1900,7 +1900,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir)
        ino_t ino;
        int ret;
 
-       ret = -EACCES;
+       ret = -EPERM;
        if (!capable(CAP_SYS_ADMIN))
                goto out;
 
index 77b5953eaac87f708ed0ff6889eff5775dd3b465..63e25fc8332823c765e3c86de54e1c376dbdd0ef 100644 (file)
@@ -204,7 +204,7 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                goto out;
        case UDF_RELOCATE_BLOCKS:
                if (!capable(CAP_SYS_ADMIN)) {
-                       result = -EACCES;
+                       result = -EPERM;
                        goto out;
                }
                if (get_user(old_block, (long __user *)arg)) {