mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] block: Check for valid bd_disk in bdev_get_queue()
@ 2013-01-30  9:35 Hannes Reinecke
  0 siblings, 0 replies; only message in thread
From: Hannes Reinecke @ 2013-01-30  9:35 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Linux Kernel, Jeff Mahoney, Hannes Reinecke

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;
 }
 
 /*

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

only message in thread, other threads:[~2013-01-30  9:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-30  9:35 [PATCH] block: Check for valid bd_disk in bdev_get_queue() Hannes Reinecke

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