Commit 16317ec2 authored by Eric Sandeen's avatar Eric Sandeen Committed by Linus Torvalds

ecryptfs: redo dget,mntget on dentry_open failure

Thanks to Jeff Moyer for pointing this out.

If the RDWR dentry_open() in ecryptfs_init_persistent_file fails,
it will do a dput/mntput.  Need to re-take references if we
retry as RDONLY.
Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
Acked-by: default avatarMike Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: default avatarJeff Moyer <jmoyer@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c8161f64
...@@ -138,11 +138,14 @@ int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry) ...@@ -138,11 +138,14 @@ int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry)
inode_info->lower_file = dentry_open(lower_dentry, inode_info->lower_file = dentry_open(lower_dentry,
lower_mnt, lower_mnt,
(O_RDWR | O_LARGEFILE)); (O_RDWR | O_LARGEFILE));
if (IS_ERR(inode_info->lower_file)) if (IS_ERR(inode_info->lower_file)) {
dget(lower_dentry);
mntget(lower_mnt);
inode_info->lower_file = dentry_open(lower_dentry, inode_info->lower_file = dentry_open(lower_dentry,
lower_mnt, lower_mnt,
(O_RDONLY (O_RDONLY
| O_LARGEFILE)); | O_LARGEFILE));
}
if (IS_ERR(inode_info->lower_file)) { if (IS_ERR(inode_info->lower_file)) {
printk(KERN_ERR "Error opening lower persistent file " printk(KERN_ERR "Error opening lower persistent file "
"for lower_dentry [0x%p] and lower_mnt [0x%p]\n", "for lower_dentry [0x%p] and lower_mnt [0x%p]\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment