public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix potential OOPs in blkdev_open()
@ 2006-10-20 14:30 Pavel Emelianov
  0 siblings, 0 replies; only message in thread
From: Pavel Emelianov @ 2006-10-20 14:30 UTC (permalink / raw)
  To: Linux Kernel Mailing List, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 212 bytes --]

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>

[-- Attachment #2: diff-blkdev-open-oops-fix --]
[-- Type: text/plain, Size: 344 bytes --]

--- ./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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-10-20 14:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-20 14:30 [PATCH] Fix potential OOPs in blkdev_open() Pavel Emelianov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox