[PATCH] Fix potential OOPs in blkdev_open()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>
--- ./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)

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux