From: Dan Carpenter Date: Fri, 8 Dec 2017 11:55:16 +0000 (+0300) Subject: mmc: block: blk-mq: Potential NULL deref on mmc_blk_alloc_req() failure X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=2361bfb055f948eac6583fa3c75a014da84fe554;p=linux.git mmc: block: blk-mq: Potential NULL deref on mmc_blk_alloc_req() failure mmc_blk_alloc_req() is supposed to return error pointers but there is one path where we forget to set the error code and accidentally return NULL. The callers are not expecting that and will have a NULL pointer dereference. Fixes: 41e3efd07d5a ("mmc: block: Simplify cleaning up the queue") Signed-off-by: Dan Carpenter Acked-by: Adrian Hunter Signed-off-by: Ulf Hansson --- diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 579fc0bd722f3..654fc1ebd675b 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -2328,6 +2328,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, */ if (!blk_get_queue(md->queue.queue)) { mmc_cleanup_queue(&md->queue); + ret = -ENODEV; goto err_putdisk; }