Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753178AbZKHH1l (ORCPT ); Sun, 8 Nov 2009 02:27:41 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753032AbZKHH1k (ORCPT ); Sun, 8 Nov 2009 02:27:40 -0500 Received: from out01.mta.xmission.com ([166.70.13.231]:46978 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752750AbZKHH1f (ORCPT ); Sun, 8 Nov 2009 02:27:35 -0500 From: "Eric W. Biederman" To: Greg Kroah-Hartman Cc: Kay Sievers , Greg KH , linux-kernel@vger.kernel.org, Tejun Heo , Cornelia Huck , linux-fsdevel@vger.kernel.org, Eric Dumazet , Benjamin LaHaise , Serge Hallyn , "Eric W. Biederman" , "Eric W. Biederman" Subject: [PATCH 14/15] sysfs: sysfs_setattr remove unnecessary permission check. Date: Sat, 7 Nov 2009 23:27:12 -0800 Message-Id: <1257665233-12468-14-git-send-email-ebiederm@xmission.com> X-Mailer: git-send-email 1.6.5.2.143.g8cc62 In-Reply-To: References: X-XM-SPF: eid=;;;mid=;;;hst=in01.mta.xmission.com;;;ip=76.21.114.89;;;frm=ebiederm@xmission.com;;;spf=neutral X-SA-Exim-Connect-IP: 76.21.114.89 X-SA-Exim-Mail-From: ebiederm@xmission.com X-SA-Exim-Scanned: No (on in01.mta.xmission.com); Exit with error (see exim mainlog) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1295 Lines: 38 From: Eric W. Biederman inode_change_ok already clears the SGID bit when necessary so there is no reason for sysfs_setattr to carry code to do the same, and it is good to kill the extra copy because when I moved the code last in certain corner cases the code will look at the wrong gid. Acked-by: Serge Hallyn Acked-by: Tejun Heo Signed-off-by: Eric W. Biederman --- fs/sysfs/inode.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index 082a3eb..8197e1a 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c @@ -117,10 +117,6 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr) return error; iattr->ia_valid &= ~ATTR_SIZE; /* ignore size changes */ - if (iattr->ia_valid & ATTR_MODE) { - if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) - iattr->ia_mode &= ~S_ISGID; - } error = inode_setattr(inode, iattr); if (error) -- 1.6.5.2.143.g8cc62 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/