public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] eCryptfs: fix ecryptfs_privileged_open() for read only files
@ 2012-06-09  9:11 Dan Carpenter
  2012-06-12 19:02 ` Tyler Hicks
  2012-06-12 19:17 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2012-06-09  9:11 UTC (permalink / raw)
  To: kernel-janitors

The intent here is to handle read only opens differently.  For example,
if we don't want to create the file if it doesn't exist.  The problem
here is that O_RDONLY is 0 and if (x & 0) {... is always false.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This is a static checker bug, and I am not very familiar with eCryptfs.
Please review carefully.

diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c
index 69f994a..d01b364 100644
--- a/fs/ecryptfs/kthread.c
+++ b/fs/ecryptfs/kthread.c
@@ -149,7 +149,7 @@ int ecryptfs_privileged_open(struct file **lower_file,
 	(*lower_file) = dentry_open(lower_dentry, lower_mnt, flags, cred);
 	if (!IS_ERR(*lower_file))
 		goto out;
-	if (flags & O_RDONLY) {
+	if (!(flags & O_RDWR)) {
 		rc = PTR_ERR((*lower_file));
 		goto out;
 	}

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

* Re: [patch] eCryptfs: fix ecryptfs_privileged_open() for read only files
  2012-06-09  9:11 [patch] eCryptfs: fix ecryptfs_privileged_open() for read only files Dan Carpenter
@ 2012-06-12 19:02 ` Tyler Hicks
  2012-06-12 19:17 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Tyler Hicks @ 2012-06-12 19:02 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]

On 2012-06-09 12:11:29, Dan Carpenter wrote:
> The intent here is to handle read only opens differently.  For example,
> if we don't want to create the file if it doesn't exist.  The problem
> here is that O_RDONLY is 0 and if (x & 0) {... is always false.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, Dan! I committed a slightly different fix with more context in
the commit message (because I had to remind myself what was going on
with that conditional in the first place).

http://git.kernel.org/?p=linux/kernel/git/tyhicks/ecryptfs.git;a=commitdiff;h=91425d9b57c024bf8b28055b6a480809fe0941ee

Tyler

> ---
> This is a static checker bug, and I am not very familiar with eCryptfs.
> Please review carefully.
> 
> diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c
> index 69f994a..d01b364 100644
> --- a/fs/ecryptfs/kthread.c
> +++ b/fs/ecryptfs/kthread.c
> @@ -149,7 +149,7 @@ int ecryptfs_privileged_open(struct file **lower_file,
>  	(*lower_file) = dentry_open(lower_dentry, lower_mnt, flags, cred);
>  	if (!IS_ERR(*lower_file))
>  		goto out;
> -	if (flags & O_RDONLY) {
> +	if (!(flags & O_RDWR)) {
>  		rc = PTR_ERR((*lower_file));
>  		goto out;
>  	}
> --
> To unsubscribe from this list: send the line "unsubscribe ecryptfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [patch] eCryptfs: fix ecryptfs_privileged_open() for read only files
  2012-06-09  9:11 [patch] eCryptfs: fix ecryptfs_privileged_open() for read only files Dan Carpenter
  2012-06-12 19:02 ` Tyler Hicks
@ 2012-06-12 19:17 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2012-06-12 19:17 UTC (permalink / raw)
  To: kernel-janitors

On Tue, Jun 12, 2012 at 12:02:47PM -0700, Tyler Hicks wrote:
> On 2012-06-09 12:11:29, Dan Carpenter wrote:
> > The intent here is to handle read only opens differently.  For example,
> > if we don't want to create the file if it doesn't exist.  The problem
> > here is that O_RDONLY is 0 and if (x & 0) {... is always false.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Thanks, Dan! I committed a slightly different fix with more context in
> the commit message (because I had to remind myself what was going on
> with that conditional in the first place).
> 
> http://git.kernel.org/?p=linux/kernel/git/tyhicks/ecryptfs.git;a=commitdiff;h‘425d9b57c024bf8b28055b6a480809fe0941ee
> 

Looks good.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2012-06-12 19:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-09  9:11 [patch] eCryptfs: fix ecryptfs_privileged_open() for read only files Dan Carpenter
2012-06-12 19:02 ` Tyler Hicks
2012-06-12 19:17 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox