Skip to contentSkip to conversation

kill suid bit only for regular files

PATCH In review [email protected] 1 participant 1 message Dec 1, 2008

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 6/11 kill suid bit only for regular files

From: Dmitri Monakhov <[email protected]>

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)

---

 mm/filemap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/filemap.c renamed from mm/filemap.c~kill-suid-bit-only-for-regular-files +1 -1
diff -puN mm/filemap.c~kill-suid-bit-only-for-regular-files mm/filemap.c
@@ -1766,7 +1766,7 @@ int should_remove_suid(struct dentry *de
 	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;

_