[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1359538514-46908-1-git-send-email-hare@suse.de>
Date: Wed, 30 Jan 2013 10:35:14 +0100
From: Hannes Reinecke <hare@...e.de>
To: Jens Axboe <axboe@...nel.dk>
Cc: Linux Kernel <linux-kernel@...r.kernel.org>,
Jeff Mahoney <jeffm@...e.de>, Hannes Reinecke <hare@...e.de>
Subject: [PATCH] block: Check for valid bd_disk in bdev_get_queue()
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@...e.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;
}
/*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists