提交 6a2aae06 编写于 作者: P Pavel Emelianov 提交者: Linus Torvalds

[PATCH] Fix potential OOPs in blkdev_open()

blkdev_open() calls bc_acquire() to get a struct block_device.  Since
bc_acquire() may return NULL when system is out of memory an appropriate
check is required.
Signed-off-by: NPavel Emelianov <xemul@openvz.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 f2d0aa5b
......@@ -1131,6 +1131,8 @@ static int blkdev_open(struct inode * inode, struct file * filp)
filp->f_flags |= O_LARGEFILE;
bdev = bd_acquire(inode);
if (bdev == NULL)
return -ENOMEM;
res = do_open(bdev, filp, BD_MUTEX_NORMAL);
if (res)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册