Skip to content

Commit 05caee9

Browse files
vwaxstorulf
authored andcommitted
mmc: usdhi6rol0: handle NULL data in timeout
Commit bb08a7d ("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: bb08a7d ("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>
1 parent 60b71f6 commit 05caee9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/mmc/host/usdhi6rol0.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
16341634
struct usdhi6_host *host = container_of(d, struct usdhi6_host, timeout_work);
16351635
struct mmc_request *mrq = host->mrq;
16361636
struct mmc_data *data = mrq ? mrq->data : NULL;
1637-
struct scatterlist *sg = host->sg ?: data->sg;
1637+
struct scatterlist *sg;
16381638

16391639
dev_warn(mmc_dev(host->mmc),
16401640
"%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)
16661666
case USDHI6_WAIT_FOR_MWRITE:
16671667
case USDHI6_WAIT_FOR_READ:
16681668
case USDHI6_WAIT_FOR_WRITE:
1669+
sg = host->sg ?: data->sg;
16691670
dev_dbg(mmc_dev(host->mmc),
16701671
"%c: page #%u @ +0x%zx %ux%u in SG%u. Current SG %u bytes @ %u\n",
16711672
data->flags & MMC_DATA_READ ? 'R' : 'W', host->page_idx,

0 commit comments

Comments
 (0)