[PATCH] Fix potential OOPs in blkdev_open()
From: Pavel Emelianov
Date: Fri Oct 20 2006 - 10:31:25 EST
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@xxxxxxxxxx>
--- ./fs/block_dev.c.bdopen 2006-10-17 14:49:18.000000000 +0400
+++ ./fs/block_dev.c 2006-10-20 17:32:14.000000000 +0400
@@ -1126,6 +1126,8 @@ static int blkdev_open(struct inode * in
filp->f_flags |= O_LARGEFILE;
bdev = bd_acquire(inode);
+ if (bdev == NULL)
+ return -ENOMEM;
res = do_open(bdev, filp, BD_MUTEX_NORMAL);
if (res)