mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
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>
This commit is contained in:
parent
c8161f64cc
commit
16317ec2e5
1 changed files with 4 additions and 1 deletions
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue