All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] eCryptfs: fix ecryptfs_privileged_open() for read only files
@ 2012-06-09  9:11 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2012-06-09  9:11 UTC (permalink / raw)
  To: Tyler Hicks; +Cc: Dustin Kirkland, ecryptfs, 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] 6+ messages in thread

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

Thread overview: 6+ 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-09  9:11 ` Dan Carpenter
2012-06-12 19:02 ` Tyler Hicks
2012-06-12 19:02   ` Tyler Hicks
2012-06-12 19:17   ` Dan Carpenter
2012-06-12 19:17     ` Dan Carpenter

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.