From: Hannes Reinecke <hare@suse.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
Jeff Mahoney <jeffm@suse.de>, Hannes Reinecke <hare@suse.de>
Subject: [PATCH] block: Check for valid bd_disk in bdev_get_queue()
Date: Wed, 30 Jan 2013 10:35:14 +0100 [thread overview]
Message-ID: <1359538514-46908-1-git-send-email-hare@suse.de> (raw)
bdev_get_queue() needs to check for a valid bd_disk pointer,
otherwise it'll dereference a NULL pointer.
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index f94bc83..7e28aaa 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -794,7 +794,7 @@ extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
{
- return bdev->bd_disk->queue;
+ return bdev->bd_disk ? bdev->bd_disk->queue : NULL;
}
/*
reply other threads:[~2013-01-30 9:35 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=1359538514-46908-1-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=axboe@kernel.dk \
--cc=jeffm@suse.de \
--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
Powered by JetHome