diff options
Diffstat (limited to 'fs/ecryptfs/crypto.c')
-rw-r--r-- | fs/ecryptfs/crypto.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 2a1b6aa1a4a1..f49f105394b7 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -1191,28 +1191,28 @@ int ecryptfs_cipher_code_to_string(char *str, u16 cipher_code) | |||
1191 | int ecryptfs_read_header_region(char *data, struct dentry *dentry, | 1191 | int ecryptfs_read_header_region(char *data, struct dentry *dentry, |
1192 | struct vfsmount *mnt) | 1192 | struct vfsmount *mnt) |
1193 | { | 1193 | { |
1194 | struct file *file; | 1194 | struct file *lower_file; |
1195 | mm_segment_t oldfs; | 1195 | mm_segment_t oldfs; |
1196 | int rc; | 1196 | int rc; |
1197 | 1197 | ||
1198 | mnt = mntget(mnt); | 1198 | if ((rc = ecryptfs_open_lower_file(&lower_file, dentry, mnt, |
1199 | file = dentry_open(dentry, mnt, O_RDONLY); | 1199 | O_RDONLY))) { |
1200 | if (IS_ERR(file)) { | 1200 | printk(KERN_ERR |
1201 | ecryptfs_printk(KERN_DEBUG, "Error opening file to " | 1201 | "Error opening lower_file to read header region\n"); |
1202 | "read header region\n"); | ||
1203 | mntput(mnt); | ||
1204 | rc = PTR_ERR(file); | ||
1205 | goto out; | 1202 | goto out; |
1206 | } | 1203 | } |
1207 | file->f_pos = 0; | 1204 | lower_file->f_pos = 0; |
1208 | oldfs = get_fs(); | 1205 | oldfs = get_fs(); |
1209 | set_fs(get_ds()); | 1206 | set_fs(get_ds()); |
1210 | /* For releases 0.1 and 0.2, all of the header information | 1207 | /* For releases 0.1 and 0.2, all of the header information |
1211 | * fits in the first data extent-sized region. */ | 1208 | * fits in the first data extent-sized region. */ |
1212 | rc = file->f_op->read(file, (char __user *)data, | 1209 | rc = lower_file->f_op->read(lower_file, (char __user *)data, |
1213 | ECRYPTFS_DEFAULT_EXTENT_SIZE, &file->f_pos); | 1210 | ECRYPTFS_DEFAULT_EXTENT_SIZE, &lower_file->f_pos); |
1214 | set_fs(oldfs); | 1211 | set_fs(oldfs); |
1215 | fput(file); | 1212 | if ((rc = ecryptfs_close_lower_file(lower_file))) { |
1213 | printk(KERN_ERR "Error closing lower_file\n"); | ||
1214 | goto out; | ||
1215 | } | ||
1216 | rc = 0; | 1216 | rc = 0; |
1217 | out: | 1217 | out: |
1218 | return rc; | 1218 | return rc; |