All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tyler Hicks <tyhicks@canonical.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dustin Kirkland <dustin.kirkland@gazzang.com>,
	ecryptfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] eCryptfs: fix ecryptfs_privileged_open() for read only files
Date: Tue, 12 Jun 2012 12:02:47 -0700	[thread overview]
Message-ID: <20120612190243.GA32418@boyd> (raw)
In-Reply-To: <20120609091129.GD877@elgon.mountain>

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

WARNING: multiple messages have this Message-ID (diff)
From: Tyler Hicks <tyhicks@canonical.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch] eCryptfs: fix ecryptfs_privileged_open() for read only files
Date: Tue, 12 Jun 2012 19:02:47 +0000	[thread overview]
Message-ID: <20120612190243.GA32418@boyd> (raw)
In-Reply-To: <20120609091129.GD877@elgon.mountain>

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

  reply	other threads:[~2012-06-12 19:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-09  9:11 [patch] eCryptfs: fix ecryptfs_privileged_open() for read only files Dan Carpenter
2012-06-09  9:11 ` Dan Carpenter
2012-06-12 19:02 ` Tyler Hicks [this message]
2012-06-12 19:02   ` Tyler Hicks
2012-06-12 19:17   ` Dan Carpenter
2012-06-12 19:17     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120612190243.GA32418@boyd \
    --to=tyhicks@canonical.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dustin.kirkland@gazzang.com \
    --cc=ecryptfs@vger.kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.