From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [PATCH] kill suid bit only for regular files Date: Sun, 26 Oct 2008 21:47:41 -0700 Message-ID: <20081026214741.332c7656.akpm@linux-foundation.org> References: <1224424839-3892-1-git-send-email-dmonakhov@openvz.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Dmitri Monakhov Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:33666 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750735AbYJ0Eru (ORCPT ); Mon, 27 Oct 2008 00:47:50 -0400 In-Reply-To: <1224424839-3892-1-git-send-email-dmonakhov@openvz.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sun, 19 Oct 2008 18:00:39 +0400 Dmitri Monakhov wrote: > We don't have to do it because it is useless for non regular files. Are we sure that should_remove_suid() is not and never will used for directories? > In fact block device may trigger this path without dentry->d_inode->i_mutex. What's wrong with blockdevs triggering this path? Better changelogs, please. > Signed-off-by: Dmitri Monakhov > --- > mm/filemap.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/mm/filemap.c b/mm/filemap.c > index a2907d5..3d5a2e7 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -1767,7 +1767,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;