summaryrefslogtreecommitdiff
path: root/drivers/mmc/host/bcm2835.c
diff options
context:
space:
mode:
authorStefan Wahren <stefan.wahren@i2se.com>2017-03-25 13:17:00 +0000
committerUlf Hansson <ulf.hansson@linaro.org>2017-04-24 21:41:53 +0200
commitbf3240bada0211b4a555d75f027181c8432b2d20 (patch)
tree830e85cb32866e6278852d24b9d67b2f39df9abd /drivers/mmc/host/bcm2835.c
parentfeeef096a770d288c943c1759785bd9d4f9247b7 (diff)
mmc: bcm2835: Fix possible NULL ptr dereference in bcm2835_request
This fixes a NULL pointer dereference in case of a MMC request with a set block count command and no data. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Tested-by: Peter Robinson <pbrobinson@gmail.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/bcm2835.c')
-rw-r--r--drivers/mmc/host/bcm2835.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index 7d1b0db7fbb7..1f343a477b3d 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -1200,7 +1200,8 @@ static void bcm2835_request(struct mmc_host *mmc, struct mmc_request *mrq)
return;
}
- host->use_sbc = !!mrq->sbc && (host->mrq->data->flags & MMC_DATA_READ);
+ host->use_sbc = !!mrq->sbc && host->mrq->data &&
+ (host->mrq->data->flags & MMC_DATA_READ);
if (host->use_sbc) {
if (bcm2835_send_command(host, mrq->sbc)) {
if (!host->use_busy)