From: Dmitri Monakhov Date: Mon, 1 Dec 2008 22:34:56 +0000 (-0800) Subject: kill suid bit only for regular files X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7f5ff766a7babd72fc192125e12ef5570effff4c;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Signed-off-by: Andrew Morton Signed-off-by: Al Viro --- diff --git a/mm/filemap.c b/mm/filemap.c index f3e5f8944d17..ed53ce876259 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -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;