summaryrefslogtreecommitdiff
path: root/drivers/mmc/core
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-12-08 14:55:16 +0300
committerUlf Hansson <ulf.hansson@linaro.org>2017-12-11 13:13:38 +0100
commit2361bfb055f948eac6583fa3c75a014da84fe554 (patch)
tree861cae40e0a7e64d1bfbc79ad55d643283340cac /drivers/mmc/core
parent0562315b86372d2cdd9cc8924b92cfab37049fbc (diff)
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 <dan.carpenter@oracle.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r--drivers/mmc/core/block.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 579fc0bd722f..654fc1ebd675 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;
}