diff options
Diffstat (limited to 'fs/ecryptfs/file.c')
-rw-r--r-- | fs/ecryptfs/file.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index 779c3477d93c..f22c3a73485c 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 1997-2004 Erez Zadok | 4 | * Copyright (C) 1997-2004 Erez Zadok |
5 | * Copyright (C) 2001-2004 Stony Brook University | 5 | * Copyright (C) 2001-2004 Stony Brook University |
6 | * Copyright (C) 2004-2006 International Business Machines Corp. | 6 | * Copyright (C) 2004-2007 International Business Machines Corp. |
7 | * Author(s): Michael A. Halcrow <mhalcrow@us.ibm.com> | 7 | * Author(s): Michael A. Halcrow <mhalcrow@us.ibm.com> |
8 | * Michael C. Thompson <mcthomps@us.ibm.com> | 8 | * Michael C. Thompson <mcthomps@us.ibm.com> |
9 | * | 9 | * |
@@ -293,26 +293,11 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
293 | goto out; | 293 | goto out; |
294 | } | 294 | } |
295 | mutex_lock(&crypt_stat->cs_mutex); | 295 | mutex_lock(&crypt_stat->cs_mutex); |
296 | if (i_size_read(lower_inode) < ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE) { | 296 | if (!ECRYPTFS_CHECK_FLAG(crypt_stat->flags, |
297 | if (!(mount_crypt_stat->flags | 297 | ECRYPTFS_POLICY_APPLIED) |
298 | & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)) { | 298 | || !ECRYPTFS_CHECK_FLAG(crypt_stat->flags, |
299 | rc = -EIO; | 299 | ECRYPTFS_KEY_VALID)) { |
300 | printk(KERN_WARNING "Attempt to read file that is " | 300 | rc = ecryptfs_read_metadata(ecryptfs_dentry, lower_file); |
301 | "not in a valid eCryptfs format, and plaintext " | ||
302 | "passthrough mode is not enabled; returning " | ||
303 | "-EIO\n"); | ||
304 | mutex_unlock(&crypt_stat->cs_mutex); | ||
305 | goto out_puts; | ||
306 | } | ||
307 | crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED); | ||
308 | rc = 0; | ||
309 | mutex_unlock(&crypt_stat->cs_mutex); | ||
310 | goto out; | ||
311 | } else if (!ECRYPTFS_CHECK_FLAG(crypt_stat->flags, | ||
312 | ECRYPTFS_POLICY_APPLIED) | ||
313 | || !ECRYPTFS_CHECK_FLAG(crypt_stat->flags, | ||
314 | ECRYPTFS_KEY_VALID)) { | ||
315 | rc = ecryptfs_read_headers(ecryptfs_dentry, lower_file); | ||
316 | if (rc) { | 301 | if (rc) { |
317 | ecryptfs_printk(KERN_DEBUG, | 302 | ecryptfs_printk(KERN_DEBUG, |
318 | "Valid headers not found\n"); | 303 | "Valid headers not found\n"); |