1
0
Fork 0

[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: Pavel Emelianov <xemul@openvz.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
hifive-unleashed-5.1
Pavel Emelianov 2006-10-28 10:38:33 -07:00 committed by Linus Torvalds
parent f2d0aa5bf8
commit 6a2aae06cc
1 changed files with 2 additions and 0 deletions

View File

@ -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)