From: Dan Carpenter <error27@gmail.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>, tj@kernel.org
Cc: linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] block: NULL dereference on error path in __blkdev_get()
Date: Sun, 13 Mar 2011 20:59:37 +0000 [thread overview]
Message-ID: <20110313205937.GI2008@bicker> (raw)
"disk" is always NULL when we goto out. There was a check for this
before, but it was removed in 69e02c59a7d9 "block: Don't check events
while open is in progress".
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/fs/block_dev.c b/fs/block_dev.c
index fbe05cb..7d02afb 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1181,9 +1181,9 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
out_unlock_bdev:
mutex_unlock(&bdev->bd_mutex);
disk_unblock_events(disk);
- out:
module_put(disk->fops->owner);
put_disk(disk);
+ out:
bdput(bdev);
return ret;
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>, tj@kernel.org
Cc: linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] block: NULL dereference on error path in __blkdev_get()
Date: Sun, 13 Mar 2011 23:59:37 +0300 [thread overview]
Message-ID: <20110313205937.GI2008@bicker> (raw)
"disk" is always NULL when we goto out. There was a check for this
before, but it was removed in 69e02c59a7d9 "block: Don't check events
while open is in progress".
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/fs/block_dev.c b/fs/block_dev.c
index fbe05cb..7d02afb 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1181,9 +1181,9 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
out_unlock_bdev:
mutex_unlock(&bdev->bd_mutex);
disk_unblock_events(disk);
- out:
module_put(disk->fops->owner);
put_disk(disk);
+ out:
bdput(bdev);
return ret;
next reply other threads:[~2011-03-13 20:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-13 20:59 Dan Carpenter [this message]
2011-03-13 20:59 ` [patch] block: NULL dereference on error path in __blkdev_get() Dan Carpenter
2011-03-14 8:58 ` Tejun Heo
2011-03-14 8:58 ` Tejun Heo
2011-03-18 8:32 ` Tejun Heo
2011-03-18 8:32 ` Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2011-03-18 8:37 [PATCH] " Tejun Heo
2011-03-18 22:26 ` Justin TerAvest
2011-03-19 12:54 ` Jens Axboe
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=20110313205937.GI2008@bicker \
--to=error27@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.