Re: [patch] eCryptfs: fix ecryptfs_privileged_open() for read only files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux