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>
This commit is contained in:
Stefan Wahren 2017-03-25 13:17:00 +00:00 committed by Ulf Hansson
parent feeef096a7
commit bf3240bada
1 changed files with 2 additions and 1 deletions

View File

@ -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)