]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
kill suid bit only for regular files
authorDmitri Monakhov <dmonakhov@openvz.org>
Mon, 1 Dec 2008 22:34:56 +0000 (14:34 -0800)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 5 Jan 2009 16:53:07 +0000 (11:53 -0500)
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>
mm/filemap.c

index f3e5f8944d1763474b4c19e411af129ed03ab324..ed53ce876259b32d53f1b7e52ebe3153bf694fd6 100644 (file)
@@ -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;