You need to sign in or sign up before continuing.
提交 fe6e9c1f 编写于 作者: A Al Viro

[PATCH] fix cgroup-inflicted breakage in block_dev.c

devcgroup_inode_permission() expects MAY_FOO, not FMODE_FOO; kindly
keep your misdesign consistent if you positively have to inflict it
on the kernel.
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 481c5346
......@@ -931,8 +931,16 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
struct gendisk *disk;
int ret;
int part;
int perm = 0;
ret = devcgroup_inode_permission(bdev->bd_inode, file->f_mode);
if (file->f_mode & FMODE_READ)
perm |= MAY_READ;
if (file->f_mode & FMODE_WRITE)
perm |= MAY_WRITE;
/*
* hooks: /n/, see "layering violations".
*/
ret = devcgroup_inode_permission(bdev->bd_inode, perm);
if (ret != 0)
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册