From mboxrd@z Thu Jan 1 00:00:00 1970 From: akpm@linux-foundation.org Subject: [patch 06/11] kill suid bit only for regular files Date: Mon, 01 Dec 2008 14:34:56 -0800 Message-ID: <200812012234.mB1MYvWx021124@imap1.linux-foundation.org> Cc: linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org, dmonakhov@openvz.org To: viro@zeniv.linux.org.uk Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:33239 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752565AbYLAWfa (ORCPT ); Mon, 1 Dec 2008 17:35:30 -0500 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Dmitri Monakhov 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 Cc: Al Viro Signed-off-by: Andrew Morton --- mm/filemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -puN mm/filemap.c~kill-suid-bit-only-for-regular-files mm/filemap.c --- a/mm/filemap.c~kill-suid-bit-only-for-regular-files +++ a/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; _