summaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@axis.com>2015-11-27 06:59:11 -0500
committerUlf Hansson <ulf.hansson@linaro.org>2015-12-22 05:32:18 -0500
commit05caee939f8d58d81e962071da85761e1e3a4c73 (patch)
tree66f4f2a7224de468b916bd9d53eca0424b963475 /drivers/mmc
parent60b71f607796f10ec8814312724759574398512b (diff)
mmc: usdhi6rol0: handle NULL data in timeout
Commit bb08a7d489bd ("mmc: usdhi6rol0: fix NULL pointer deref in debug print") fixed one NULL pointer dereference but unfortunately introduced another. "data" may be NULL if this is a command timeout for a command without any data, so we should only use it if we're actually waiting for data. Fixes: bb08a7d489bd ("mmc: usdhi6rol0: fix NULL pointer deref in debug print") Cc: stable@vger.kernel.org # v4.3 Signed-off-by: Rabin Vincent <rabin.vincent@axis.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/usdhi6rol0.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c
index 4498e92116b8..b47122d3e8d8 100644
--- a/drivers/mmc/host/usdhi6rol0.c
+++ b/drivers/mmc/host/usdhi6rol0.c
@@ -1634,7 +1634,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
1634 struct usdhi6_host *host = container_of(d, struct usdhi6_host, timeout_work); 1634 struct usdhi6_host *host = container_of(d, struct usdhi6_host, timeout_work);
1635 struct mmc_request *mrq = host->mrq; 1635 struct mmc_request *mrq = host->mrq;
1636 struct mmc_data *data = mrq ? mrq->data : NULL; 1636 struct mmc_data *data = mrq ? mrq->data : NULL;
1637 struct scatterlist *sg = host->sg ?: data->sg; 1637 struct scatterlist *sg;
1638 1638
1639 dev_warn(mmc_dev(host->mmc), 1639 dev_warn(mmc_dev(host->mmc),
1640 "%s timeout wait %u CMD%d: IRQ 0x%08x:0x%08x, last IRQ 0x%08x\n", 1640 "%s timeout wait %u CMD%d: IRQ 0x%08x:0x%08x, last IRQ 0x%08x\n",
@@ -1666,6 +1666,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
1666 case USDHI6_WAIT_FOR_MWRITE: 1666 case USDHI6_WAIT_FOR_MWRITE:
1667 case USDHI6_WAIT_FOR_READ: 1667 case USDHI6_WAIT_FOR_READ:
1668 case USDHI6_WAIT_FOR_WRITE: 1668 case USDHI6_WAIT_FOR_WRITE:
1669 sg = host->sg ?: data->sg;
1669 dev_dbg(mmc_dev(host->mmc), 1670 dev_dbg(mmc_dev(host->mmc),
1670 "%c: page #%u @ +0x%zx %ux%u in SG%u. Current SG %u bytes @ %u\n", 1671 "%c: page #%u @ +0x%zx %ux%u in SG%u. Current SG %u bytes @ %u\n",
1671 data->flags & MMC_DATA_READ ? 'R' : 'W', host->page_idx, 1672 data->flags & MMC_DATA_READ ? 'R' : 'W', host->page_idx,