All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ecryptfs: redo dget,mntget on dentry_open failure
@ 2007-12-19 17:34 Eric Sandeen
  2007-12-19 17:42 ` Jeff Moyer
  2007-12-19 18:14 ` Michael Halcrow
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2007-12-19 17:34 UTC (permalink / raw)
  To: Linux Kernel Mailing List, Andrew Morton, Michael Halcrow
  Cc: mike, Jeff Moyer

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>
---

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",


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ecryptfs: redo dget,mntget on dentry_open failure
  2007-12-19 17:34 [PATCH] ecryptfs: redo dget,mntget on dentry_open failure Eric Sandeen
@ 2007-12-19 17:42 ` Jeff Moyer
  2007-12-19 18:14 ` Michael Halcrow
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Moyer @ 2007-12-19 17:42 UTC (permalink / raw)
  To: Eric Sandeen
  Cc: Linux Kernel Mailing List, Andrew Morton, Michael Halcrow, mike

Eric Sandeen <sandeen@redhat.com> writes:

> 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>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

Thanks,

Jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ecryptfs: redo dget,mntget on dentry_open failure
  2007-12-19 17:34 [PATCH] ecryptfs: redo dget,mntget on dentry_open failure Eric Sandeen
  2007-12-19 17:42 ` Jeff Moyer
@ 2007-12-19 18:14 ` Michael Halcrow
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Halcrow @ 2007-12-19 18:14 UTC (permalink / raw)
  To: Eric Sandeen
  Cc: Linux Kernel Mailing List, Andrew Morton, Michael Halcrow,
	Jeff Moyer

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@redhat.com>

Acked-by: Mike Halcrow <mhalcrow@us.ibm.com>

> ---
> 
> 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",
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-12-19 18:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-19 17:34 [PATCH] ecryptfs: redo dget,mntget on dentry_open failure Eric Sandeen
2007-12-19 17:42 ` Jeff Moyer
2007-12-19 18:14 ` Michael Halcrow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.