linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ecryptfs: pass matching flags to interpose as defined and used there
@ 2009-12-06 23:51 Erez Zadok
  2009-12-07 22:40 ` Tyler Hicks
  0 siblings, 1 reply; 2+ messages in thread
From: Erez Zadok @ 2009-12-06 23:51 UTC (permalink / raw)
  To: Tyler Hicks, Dustin Kirkland
  Cc: Erez Zadok <ezk@cs.sunysb.edu> Andrew Morton, viro,
	linux-fsdevel


ecryptfs: pass matching flags to interpose as defined and used there

ecryptfs_interpose checks if one of the flags passed is
ECRYPTFS_INTERPOSE_FLAG_D_ADD, defined as 0x00000001 in ecryptfs_kernel.h.
But the only user of ecryptfs_interpose to pass a non-zero flag to it, has
hard-coded the value as "1". This could spell trouble if any of these values
changes in the future.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 91a5dba..dd5d1ba 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -282,7 +282,8 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry,
 		goto out;
 	}
 	rc = ecryptfs_interpose(lower_dentry, ecryptfs_dentry,
-				ecryptfs_dir_inode->i_sb, 1);
+				ecryptfs_dir_inode->i_sb,
+				ECRYPTFS_INTERPOSE_FLAG_D_ADD);
 	if (rc) {
 		printk(KERN_ERR "%s: Error interposing; rc = [%d]\n",
 		       __func__, rc);

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

* Re: [PATCH] ecryptfs: pass matching flags to interpose as defined and used there
  2009-12-06 23:51 [PATCH] ecryptfs: pass matching flags to interpose as defined and used there Erez Zadok
@ 2009-12-07 22:40 ` Tyler Hicks
  0 siblings, 0 replies; 2+ messages in thread
From: Tyler Hicks @ 2009-12-07 22:40 UTC (permalink / raw)
  To: Erez Zadok; +Cc: Dustin Kirkland, Andrew Morton, viro, linux-fsdevel

On Sun Dec 06, 2009 at 06:51:15PM -0500, Erez Zadok (ezk@cs.sunysb.edu) was quoted:
> 
> ecryptfs: pass matching flags to interpose as defined and used there
> 
> ecryptfs_interpose checks if one of the flags passed is
> ECRYPTFS_INTERPOSE_FLAG_D_ADD, defined as 0x00000001 in ecryptfs_kernel.h.
> But the only user of ecryptfs_interpose to pass a non-zero flag to it, has
> hard-coded the value as "1". This could spell trouble if any of these values
> changes in the future.
> 
> Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>

Nice catch!  Thanks again!

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/ecryptfs/ecryptfs-2.6.git#next

> diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
> index 91a5dba..dd5d1ba 100644
> --- a/fs/ecryptfs/inode.c
> +++ b/fs/ecryptfs/inode.c
> @@ -282,7 +282,8 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry,
>  		goto out;
>  	}
>  	rc = ecryptfs_interpose(lower_dentry, ecryptfs_dentry,
> -				ecryptfs_dir_inode->i_sb, 1);
> +				ecryptfs_dir_inode->i_sb,
> +				ECRYPTFS_INTERPOSE_FLAG_D_ADD);
>  	if (rc) {
>  		printk(KERN_ERR "%s: Error interposing; rc = [%d]\n",
>  		       __func__, rc);

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

end of thread, other threads:[~2009-12-07 22:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-06 23:51 [PATCH] ecryptfs: pass matching flags to interpose as defined and used there Erez Zadok
2009-12-07 22:40 ` Tyler Hicks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).