Commit 7f5ff766a7babd72fc192125e12ef5570effff4c

Authored by Dmitri Monakhov
Committed by Al Viro
1 parent 5b6f1eb97d

kill suid bit only for regular files

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 <dmonakhov@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -1766,7 +1766,7 @@
1766 1766 if (unlikely((mode & S_ISGID) && (mode & S_IXGRP)))
1767 1767 kill |= ATTR_KILL_SGID;
1768 1768  
1769   - if (unlikely(kill && !capable(CAP_FSETID)))
  1769 + if (unlikely(kill && !capable(CAP_FSETID) && S_ISREG(mode)))
1770 1770 return kill;
1771 1771  
1772 1772 return 0;