From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mimi Zohar Subject: [PATCH v4 01/12] vfs: extend vfs_removexattr locking Date: Thu, 29 Mar 2012 10:41:29 -0400 Message-ID: <1333032100-4159-2-git-send-email-zohar@linux.vnet.ibm.com> References: <1333032100-4159-1-git-send-email-zohar@linux.vnet.ibm.com> Cc: Mimi Zohar , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Al Viro , David Safford , Dmitry Kasatkin , Mimi Zohar , Dmitry Kasatkin To: linux-security-module@vger.kernel.org Return-path: Received: from e37.co.us.ibm.com ([32.97.110.158]:55153 "EHLO e37.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933255Ab2C2Omm (ORCPT ); Thu, 29 Mar 2012 10:42:42 -0400 Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 29 Mar 2012 08:42:41 -0600 In-Reply-To: <1333032100-4159-1-git-send-email-zohar@linux.vnet.ibm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: This patch takes the i_mutex lock before security_inode_removexattr(), instead of after, in preparation of calling ima_inode_removexattr(). Signed-off-by: Mimi Zohar Signed-off-by: Dmitry Kasatkin --- fs/xattr.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/xattr.c b/fs/xattr.c index 82f4337..6112c92 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -294,11 +294,13 @@ vfs_removexattr(struct dentry *dentry, const char *name) if (error) return error; + mutex_lock(&inode->i_mutex); error = security_inode_removexattr(dentry, name); - if (error) + if (error) { + mutex_unlock(&inode->i_mutex); return error; + } - mutex_lock(&inode->i_mutex); error = inode->i_op->removexattr(dentry, name); mutex_unlock(&inode->i_mutex); -- 1.7.6.5