public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Emelianov <xemul@openvz.org>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>
Subject: [PATCH] Fix potential OOPs in blkdev_open()
Date: Fri, 20 Oct 2006 18:30:26 +0400	[thread overview]
Message-ID: <4538DD82.3010408@openvz.org> (raw)

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

                 reply	other threads:[~2006-10-20 14:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4538DD82.3010408@openvz.org \
    --to=xemul@openvz.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox