Skip to content

Commit

Permalink
kill suid bit only for regular files
Browse files Browse the repository at this point in the history
We don't have to do it because it is useless for non regular files.
In fact block device may trigger this path without dentry->d_inode->i_mutex.

(akpm: concerns were expressed (by me) about S_ISDIR inodes)

Signed-off-by: Dmitri Monakhov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Dmitri Monakhov authored and Al Viro committed Jan 5, 2009
1 parent 5b6f1eb commit 7f5ff76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,7 @@ int should_remove_suid(struct dentry *dentry)
if (unlikely((mode & S_ISGID) && (mode & S_IXGRP)))
kill |= ATTR_KILL_SGID;

if (unlikely(kill && !capable(CAP_FSETID)))
if (unlikely(kill && !capable(CAP_FSETID) && S_ISREG(mode)))
return kill;

return 0;
Expand Down

0 comments on commit 7f5ff76

Please sign in to comment.