Commit 0abe1169 authored by Roberto Sassu's avatar Roberto Sassu Committed by Tyler Hicks

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: default avatarRoberto Sassu <roberto.sassu@polito.it>
Signed-off-by: default avatarTyler Hicks <tyhicks@linux.vnet.ibm.com>
parent 27992890
...@@ -199,8 +199,8 @@ static int ecryptfs_open(struct inode *inode, struct file *file) ...@@ -199,8 +199,8 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
ecryptfs_dentry->d_name.name, rc); ecryptfs_dentry->d_name.name, rc);
goto out_free; goto out_free;
} }
if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY) if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE)
&& !(file->f_flags & O_RDONLY)) { == O_RDONLY && (file->f_flags & O_ACCMODE) != O_RDONLY) {
rc = -EPERM; rc = -EPERM;
printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs " printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs "
"file must hence be opened RO\n", __func__); "file must hence be opened RO\n", __func__);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment