Re: [PATCH] ecryptfs: redo dget,mntget on dentry_open failure

From: Michael Halcrow
Date: Wed Dec 19 2007 - 13:23:22 EST


On Wed, Dec 19, 2007 at 11:34:25AM -0600, Eric Sandeen wrote:
> 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@xxxxxxxxxx>

Acked-by: Mike Halcrow <mhalcrow@xxxxxxxxxx>

> ---
>
> Index: linux-2.6.24-rc3/fs/ecryptfs/main.c
> ===================================================================
> --- linux-2.6.24-rc3.orig/fs/ecryptfs/main.c
> +++ linux-2.6.24-rc3/fs/ecryptfs/main.c
> @@ -138,11 +138,14 @@ int ecryptfs_init_persistent_file(struct
> 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",
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/