diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-22 21:13:53 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-22 21:13:53 -0400 |
commit | cbfef53360ea88fa7ef9f80def778fba9b05d21e (patch) | |
tree | 9e23ee08206ec0304e25e8a93eabc2d5bcd8ae9c /fs/kernfs | |
parent | d35cc56ddfc948d8df1aa6d41ac345fcec01854d (diff) | |
parent | 4b660a7f5c8099d88d1a43d8ae138965112592c7 (diff) |
Merge 3.15-rc6 into driver-core-next
We want the kernfs fixes in this branch as well for testing.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs')
-rw-r--r-- | fs/kernfs/file.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index 40251cd741a0..e3d37f607f97 100644 --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c | |||
@@ -611,6 +611,7 @@ static void kernfs_put_open_node(struct kernfs_node *kn, | |||
611 | static int kernfs_fop_open(struct inode *inode, struct file *file) | 611 | static int kernfs_fop_open(struct inode *inode, struct file *file) |
612 | { | 612 | { |
613 | struct kernfs_node *kn = file->f_path.dentry->d_fsdata; | 613 | struct kernfs_node *kn = file->f_path.dentry->d_fsdata; |
614 | struct kernfs_root *root = kernfs_root(kn); | ||
614 | const struct kernfs_ops *ops; | 615 | const struct kernfs_ops *ops; |
615 | struct kernfs_open_file *of; | 616 | struct kernfs_open_file *of; |
616 | bool has_read, has_write, has_mmap; | 617 | bool has_read, has_write, has_mmap; |
@@ -625,14 +626,16 @@ static int kernfs_fop_open(struct inode *inode, struct file *file) | |||
625 | has_write = ops->write || ops->mmap; | 626 | has_write = ops->write || ops->mmap; |
626 | has_mmap = ops->mmap; | 627 | has_mmap = ops->mmap; |
627 | 628 | ||
628 | /* check perms and supported operations */ | 629 | /* see the flag definition for details */ |
629 | if ((file->f_mode & FMODE_WRITE) && | 630 | if (root->flags & KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK) { |
630 | (!(inode->i_mode & S_IWUGO) || !has_write)) | 631 | if ((file->f_mode & FMODE_WRITE) && |
631 | goto err_out; | 632 | (!(inode->i_mode & S_IWUGO) || !has_write)) |
633 | goto err_out; | ||
632 | 634 | ||
633 | if ((file->f_mode & FMODE_READ) && | 635 | if ((file->f_mode & FMODE_READ) && |
634 | (!(inode->i_mode & S_IRUGO) || !has_read)) | 636 | (!(inode->i_mode & S_IRUGO) || !has_read)) |
635 | goto err_out; | 637 | goto err_out; |
638 | } | ||
636 | 639 | ||
637 | /* allocate a kernfs_open_file for the file */ | 640 | /* allocate a kernfs_open_file for the file */ |
638 | error = -ENOMEM; | 641 | error = -ENOMEM; |