diff options
author | James Morris <james.l.morris@oracle.com> | 2017-04-19 08:30:08 +1000 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2017-04-19 08:30:08 +1000 |
commit | fa5b5b26e25cbab819e0955f948e8a6d5363f06f (patch) | |
tree | 1dfb743d934832546a5b3e7cfd02d83c1736c051 /fs | |
parent | 30a83251dd8b7e3566be9ea8c4921bafc21bee8f (diff) | |
parent | cae303df3f379f04ce7efadb2e30de460918b302 (diff) |
Merge branch 'stable-4.12' of git://git.infradead.org/users/pcmoore/selinux into next
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namei.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/namei.c b/fs/namei.c index d41fab78798b..482414aa558b 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -340,22 +340,14 @@ int generic_permission(struct inode *inode, int mask) if (S_ISDIR(inode->i_mode)) { /* DACs are overridable for directories */ - if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE)) - return 0; if (!(mask & MAY_WRITE)) if (capable_wrt_inode_uidgid(inode, CAP_DAC_READ_SEARCH)) return 0; - return -EACCES; - } - /* - * Read/write DACs are always overridable. - * Executable DACs are overridable when there is - * at least one exec bit set. - */ - if (!(mask & MAY_EXEC) || (inode->i_mode & S_IXUGO)) if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE)) return 0; + return -EACCES; + } /* * Searching includes executable on directories, else just read. @@ -364,6 +356,14 @@ int generic_permission(struct inode *inode, int mask) if (mask == MAY_READ) if (capable_wrt_inode_uidgid(inode, CAP_DAC_READ_SEARCH)) return 0; + /* + * Read/write DACs are always overridable. + * Executable DACs are overridable when there is + * at least one exec bit set. + */ + if (!(mask & MAY_EXEC) || (inode->i_mode & S_IXUGO)) + if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE)) + return 0; return -EACCES; } |