Skip to content

Commit 2f9b12a

Browse files
Michael Halcrowtorvalds
authored andcommitted
eCryptfs: protect crypt_stat->flags in ecryptfs_open()
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>
1 parent 6a3fd92 commit 2f9b12a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/ecryptfs/file.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
195195
file, ecryptfs_inode_to_private(inode)->lower_file);
196196
if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) {
197197
ecryptfs_printk(KERN_DEBUG, "This is a directory\n");
198+
mutex_lock(&crypt_stat->cs_mutex);
198199
crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
200+
mutex_unlock(&crypt_stat->cs_mutex);
199201
rc = 0;
200202
goto out;
201203
}

0 commit comments

Comments
 (0)