summaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2007-12-22 14:03:26 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-23 12:54:37 -0800
commit16317ec2e5a85884fea680d24c1b228a5602159f (patch)
tree68b24327c001d9f0def6bad8ba7ef0b2522a464c /fs/ecryptfs
parentc8161f64ccdcc3ac05c7bbfebc031e7ad5ca6412 (diff)
downloadop-kernel-dev-16317ec2e5a85884fea680d24c1b228a5602159f.zip
op-kernel-dev-16317ec2e5a85884fea680d24c1b228a5602159f.tar.gz
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: Eric Sandeen <sandeen@redhat.com> Acked-by: Mike Halcrow <mhalcrow@us.ibm.com> Signed-off-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs')
-rw-r--r--fs/ecryptfs/main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index a277754..e5580bc 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -138,11 +138,14 @@ int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry)
inode_info->lower_file = dentry_open(lower_dentry,
lower_mnt,
(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,
lower_mnt,
(O_RDONLY
| O_LARGEFILE));
+ }
if (IS_ERR(inode_info->lower_file)) {
printk(KERN_ERR "Error opening lower persistent file "
"for lower_dentry [0x%p] and lower_mnt [0x%p]\n",
OpenPOWER on IntegriCloud