diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/block_dev.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 470c10ceb0fb..10d8a0aa871a 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -931,8 +931,16 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part) | |||
931 | struct gendisk *disk; | 931 | struct gendisk *disk; |
932 | int ret; | 932 | int ret; |
933 | int part; | 933 | int part; |
934 | int perm = 0; | ||
934 | 935 | ||
935 | ret = devcgroup_inode_permission(bdev->bd_inode, file->f_mode); | 936 | if (file->f_mode & FMODE_READ) |
937 | perm |= MAY_READ; | ||
938 | if (file->f_mode & FMODE_WRITE) | ||
939 | perm |= MAY_WRITE; | ||
940 | /* | ||
941 | * hooks: /n/, see "layering violations". | ||
942 | */ | ||
943 | ret = devcgroup_inode_permission(bdev->bd_inode, perm); | ||
936 | if (ret != 0) | 944 | if (ret != 0) |
937 | return ret; | 945 | return ret; |
938 | 946 | ||