[PATCH] eCryptfs: Protect crypt_stat->flags in ecryptfs_open()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Michael Halcrow
Date: Tuesday, April 22, 2008 - 8:41 am

Al Viro wrote:

Make sure crypt_stat->flags is protected with a lock in
ecryptfs_open().

Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com>
---
 fs/ecryptfs/file.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index 2b8f5ed..2258b8f 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;
 	}
-- 
1.5.1.6

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] eCryptfs: Protect crypt_stat->flags in ecryptfs_open(), Michael Halcrow, (Tue Apr 22, 8:41 am)