[<prev] [next>] [day] [month] [year] [list]
Message-Id: <201011031111.35066.roberto.sassu@polito.it>
Date: Wed, 3 Nov 2010 11:11:34 +0100
From: Roberto Sassu <roberto.sassu@...ito.it>
To: tyhicks@...ux.vnet.ibm.com
Cc: kirkland@...onical.com, jmorris@...ei.org,
linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: [PATCH 4/5] ecryptfs: fixed testing of file descriptor flags
This patch replaces the check (lower_file->f_flags & O_RDONLY) with
((lower_file & O_ACCMODE) == O_RDONLY).
Signed-off-by: Roberto Sassu <roberto.sassu@...ito.it>
---
fs/ecryptfs/file.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index 5cfcc3c..26bd93d 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -200,8 +200,8 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
ecryptfs_dentry->d_name.name, rc);
goto out_free;
}
- if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY)
- && !(file->f_flags & O_RDONLY)) {
+ if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE) == O_RDONLY
+ && (file->f_flags & O_ACCMODE) != O_RDONLY) {
rc = -EPERM;
printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs "
"file must hence be opened RO\n", __func__);
--
1.7.2.3
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4707 bytes)
Powered by blists - more mailing lists