aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto Sassu <roberto.sassu@polito.it>2010-11-03 11:11:34 +0100
committerTyler Hicks <tyhicks@linux.vnet.ibm.com>2011-01-17 11:24:43 -0600
commit0abe1169470571c473ee720c35fe5b3481c46c46 (patch)
tree3261e72681db07a04a56f31af0edb536b9b7a5e2
parent27992890b02d340198a3a22fc210d13684a41564 (diff)
downloadkernel_samsung_aries-0abe1169470571c473ee720c35fe5b3481c46c46.zip
kernel_samsung_aries-0abe1169470571c473ee720c35fe5b3481c46c46.tar.gz
kernel_samsung_aries-0abe1169470571c473ee720c35fe5b3481c46c46.tar.bz2
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@polito.it> Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
-rw-r--r--fs/ecryptfs/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index 99259f8..e069e78 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -199,8 +199,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__);