[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190513175521.84955-3-rrangel@chromium.org>
Date: Mon, 13 May 2019 11:55:20 -0600
From: Raul E Rangel <rrangel@...omium.org>
To: stable@...r.kernel.org
Cc: linux-mmc@...r.kernel.org, djkurtz@...gle.com,
adrian.hunter@...el.com, zwisler@...omium.org,
Raul E Rangel <rrangel@...omium.org>,
Linus Walleij <linus.walleij@...aro.org>,
linux-kernel@...r.kernel.org, Ulf Hansson <ulf.hansson@...aro.org>
Subject: [stable/4.14.y PATCH 2/3] mmc: Fix null pointer dereference in mmc_init_request
It is possible for queuedata to be cleared in mmc_cleanup_queue before
the request has been started. This will result in dereferencing a null
pointer.
Signed-off-by: Raul E Rangel <rrangel@...omium.org>
---
drivers/mmc/core/queue.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index d99fa4e63033c..bd7d521d5ad9d 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -159,8 +159,14 @@ static int mmc_init_request(struct request_queue *q, struct request *req,
{
struct mmc_queue_req *mq_rq = req_to_mmc_queue_req(req);
struct mmc_queue *mq = q->queuedata;
- struct mmc_card *card = mq->card;
- struct mmc_host *host = card->host;
+ struct mmc_card *card;
+ struct mmc_host *host;
+
+ if (!mq)
+ return -ENODEV;
+
+ card = mq->card;
+ host = card->host;
mq_rq->sg = mmc_alloc_sg(host->max_segs, gfp);
if (!mq_rq->sg)
--
2.21.0.1020.gf2820cf01a-goog
Powered by blists - more mailing lists