lkml.org 
[lkml]   [2013]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] block: Check for valid bd_disk in bdev_get_queue()
Date
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;
}

/*

\
 
 \ /
  Last update: 2013-01-30 11:21    [W:0.025 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site