From: Miklos Szeredi Subject: [patch 01/13] ecryptfs: add missing lock around notify_change Date: Thu, 24 Apr 2008 13:39:51 +0200 Message-ID: <20080424114008.353519557@szeredi.hu> References: <20080424113950.818688067@szeredi.hu> Cc: akpm@linux-foundation.org, torvalds@linux-foundation.org, dave@linux.vnet.ibm.com, ezk@cs.sunysb.edu, mhalcrow@us.ibm.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: viro@zeniv.linux.org.uk Return-path: Received: from fxip-0047f.externet.hu ([88.209.222.127]:57208 "EHLO pomaz-ex.szeredi.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756604AbYDXLki (ORCPT ); Thu, 24 Apr 2008 07:40:38 -0400 Content-Disposition: inline; filename=ecryptfs_locking_fix.patch Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Miklos Szeredi Caller of notify_change() need to hold i_mutex. Compile tested only. Signed-off-by: Miklos Szeredi --- fs/ecryptfs/inode.c | 2 ++ 1 file changed, 2 insertions(+) Index: vfs-2.6/fs/ecryptfs/inode.c =================================================================== --- vfs-2.6.orig/fs/ecryptfs/inode.c 2008-04-02 18:47:17.000000000 +0200 +++ vfs-2.6/fs/ecryptfs/inode.c 2008-04-02 18:49:18.000000000 +0200 @@ -908,7 +908,9 @@ static int ecryptfs_setattr(struct dentr if (ia->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) ia->ia_valid &= ~ATTR_MODE; + mutex_lock(&lower_dentry->d_inode->i_mutex); rc = notify_change(lower_dentry, ia); + mutex_unlock(&lower_dentry->d_inode->i_mutex); out: fsstack_copy_attr_all(inode, lower_inode, NULL); return rc; --