diff options
Diffstat (limited to 'fs/ecryptfs/file.c')
-rw-r--r-- | fs/ecryptfs/file.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index 91da02987bff..81e10e6a9443 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -47,7 +47,7 @@ static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb, | |||
47 | const struct iovec *iov, | 47 | const struct iovec *iov, |
48 | unsigned long nr_segs, loff_t pos) | 48 | unsigned long nr_segs, loff_t pos) |
49 | { | 49 | { |
50 | int rc; | 50 | ssize_t rc; |
51 | struct dentry *lower_dentry; | 51 | struct dentry *lower_dentry; |
52 | struct vfsmount *lower_vfsmount; | 52 | struct vfsmount *lower_vfsmount; |
53 | struct file *file = iocb->ki_filp; | 53 | struct file *file = iocb->ki_filp; |
@@ -191,18 +191,16 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
191 | | ECRYPTFS_ENCRYPTED); | 191 | | ECRYPTFS_ENCRYPTED); |
192 | } | 192 | } |
193 | mutex_unlock(&crypt_stat->cs_mutex); | 193 | mutex_unlock(&crypt_stat->cs_mutex); |
194 | if (!ecryptfs_inode_to_private(inode)->lower_file) { | 194 | rc = ecryptfs_init_persistent_file(ecryptfs_dentry); |
195 | rc = ecryptfs_init_persistent_file(ecryptfs_dentry); | 195 | if (rc) { |
196 | if (rc) { | 196 | printk(KERN_ERR "%s: Error attempting to initialize " |
197 | printk(KERN_ERR "%s: Error attempting to initialize " | 197 | "the persistent file for the dentry with name " |
198 | "the persistent file for the dentry with name " | 198 | "[%s]; rc = [%d]\n", __func__, |
199 | "[%s]; rc = [%d]\n", __func__, | 199 | ecryptfs_dentry->d_name.name, rc); |
200 | ecryptfs_dentry->d_name.name, rc); | 200 | goto out_free; |
201 | goto out_free; | ||
202 | } | ||
203 | } | 201 | } |
204 | if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY) | 202 | if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE) |
205 | && !(file->f_flags & O_RDONLY)) { | 203 | == O_RDONLY && (file->f_flags & O_ACCMODE) != O_RDONLY) { |
206 | rc = -EPERM; | 204 | rc = -EPERM; |
207 | printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs " | 205 | printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs " |
208 | "file must hence be opened RO\n", __func__); | 206 | "file must hence be opened RO\n", __func__); |
@@ -243,9 +241,9 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
243 | } | 241 | } |
244 | } | 242 | } |
245 | mutex_unlock(&crypt_stat->cs_mutex); | 243 | mutex_unlock(&crypt_stat->cs_mutex); |
246 | ecryptfs_printk(KERN_DEBUG, "inode w/ addr = [0x%p], i_ino = [0x%.16x] " | 244 | ecryptfs_printk(KERN_DEBUG, "inode w/ addr = [0x%p], i_ino = " |
247 | "size: [0x%.16x]\n", inode, inode->i_ino, | 245 | "[0x%.16lx] size: [0x%.16llx]\n", inode, inode->i_ino, |
248 | i_size_read(inode)); | 246 | (unsigned long long)i_size_read(inode)); |
249 | goto out; | 247 | goto out; |
250 | out_free: | 248 | out_free: |
251 | kmem_cache_free(ecryptfs_file_info_cache, | 249 | kmem_cache_free(ecryptfs_file_info_cache, |