Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
d594e7ec
Commit
d594e7ec
authored
Jun 20, 2011
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
massage generic_permission() to treat directories on a separate path
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
eecdd358
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
fs/namei.c
fs/namei.c
+13
-4
No files found.
fs/namei.c
View file @
d594e7ec
...
...
@@ -235,12 +235,21 @@ int generic_permission(struct inode *inode, int mask)
if
(
ret
!=
-
EACCES
)
return
ret
;
if
(
S_ISDIR
(
inode
->
i_mode
))
{
/* DACs are overridable for directories */
if
(
ns_capable
(
inode_userns
(
inode
),
CAP_DAC_OVERRIDE
))
return
0
;
if
(
!
(
mask
&
MAY_WRITE
))
if
(
ns_capable
(
inode_userns
(
inode
),
CAP_DAC_READ_SEARCH
))
return
0
;
return
-
EACCES
;
}
/*
* Read/write DACs are always overridable.
* Executable DACs are overridable
for all directories and
*
for non-directories that have
least one exec bit set.
* Executable DACs are overridable
when there is
*
at
least one exec bit set.
*/
if
(
!
(
mask
&
MAY_EXEC
)
||
execute_ok
(
inode
))
if
(
!
(
mask
&
MAY_EXEC
)
||
(
inode
->
i_mode
&
S_IXUGO
))
if
(
ns_capable
(
inode_userns
(
inode
),
CAP_DAC_OVERRIDE
))
return
0
;
...
...
@@ -248,7 +257,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
(
mask
==
MAY_READ
)
if
(
ns_capable
(
inode_userns
(
inode
),
CAP_DAC_READ_SEARCH
))
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment