summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@us.ibm.com>2008-06-08 10:58:02 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2008-06-16 13:19:50 -0700
commitb2c908b6b75478eb7cd88bfc69b85082444574d2 (patch)
tree286006909b71115e8fccca696e6c325f95551342
parent2583783370aa26010ca861111b21700a9655d238 (diff)
eCryptfs: protect crypt_stat->flags in ecryptfs_open()
upstream commit: 2f9b12a31fcb738ea8c9eb0d4ddf906c6f1d696c Make sure crypt_stat->flags is protected with a lock in ecryptfs_open(). Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com> Cc: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Chris Wright <chrisw@sous-sol.org>
-rw-r--r--fs/ecryptfs/file.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index 2b8f5ed4adea..2258b8f654a6 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -195,7 +195,9 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
file, ecryptfs_inode_to_private(inode)->lower_file);
if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) {
ecryptfs_printk(KERN_DEBUG, "This is a directory\n");
+ mutex_lock(&crypt_stat->cs_mutex);
crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
+ mutex_unlock(&crypt_stat->cs_mutex);
rc = 0;
goto out;
}