Skip to content

Commit

Permalink
ecryptfs: redo dget,mntget on dentry_open failure
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Mike Halcrow <[email protected]>
Signed-off-by: Jeff Moyer <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Eric Sandeen authored and Linus Torvalds committed Dec 23, 2007
1 parent c8161f6 commit 16317ec
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/ecryptfs/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 16317ec

Please sign in to comment.