diff options
author | Serge E. Hallyn <serue@us.ibm.com> | 2009-12-29 14:50:19 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-01-06 15:17:18 -0800 |
commit | 5289cdcc9189f993d8f875676f68bd85f00c8092 (patch) | |
tree | 2848e32679fec1877953382203b60e886268ca74 /fs | |
parent | 43e1e809a5b7f9bdc65cfd0bdf45675dc7d40fb4 (diff) |
generic_permission: MAY_OPEN is not write access
commit 7ea6600148c265b1fd53e521022b1d7aec81d974 upstream.
generic_permission was refusing CAP_DAC_READ_SEARCH-enabled
processes from opening DAC-protected files read-only, because
do_filp_open adds MAY_OPEN to the open mask.
Ignore MAY_OPEN. After this patch, CAP_DAC_READ_SEARCH is
again sufficient to open(fname, O_RDONLY) on a file to which
DAC otherwise refuses us read permission.
Reported-by: Mike Kazantsev <mk.fraggod@gmail.com>
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Tested-by: Mike Kazantsev <mk.fraggod@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namei.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c index 2259d21ae28..e6c73de3a8a 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -220,6 +220,7 @@ int generic_permission(struct inode *inode, int mask, /* * Searching includes executable on directories, else just read. */ + mask &= MAY_READ | MAY_WRITE | MAY_EXEC; if (mask == MAY_READ || (S_ISDIR(inode->i_mode) && !(mask & MAY_WRITE))) if (capable(CAP_DAC_READ_SEARCH)) return 0; |