Skip to content

Commit bb08a7d

Browse files
vwaxstorulf
authored andcommitted
mmc: usdhi6rol0: fix NULL pointer deref in debug print
host->sg is only set when we're transferring multiple blocks. Check for its availibility before dereferencing it in the timeout work debug print. Signed-off-by: Rabin Vincent <rabin.vincent@axis.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 7672647 commit bb08a7d

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,6 +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;
16371638

16381639
dev_warn(mmc_dev(host->mmc),
16391640
"%s timeout wait %u CMD%d: IRQ 0x%08x:0x%08x, last IRQ 0x%08x\n",
@@ -1669,7 +1670,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
16691670
"%c: page #%u @ +0x%zx %ux%u in SG%u. Current SG %u bytes @ %u\n",
16701671
data->flags & MMC_DATA_READ ? 'R' : 'W', host->page_idx,
16711672
host->offset, data->blocks, data->blksz, data->sg_len,
1672-
sg_dma_len(host->sg), host->sg->offset);
1673+
sg_dma_len(sg), sg->offset);
16731674
usdhi6_sg_unmap(host, true);
16741675
/*
16751676
* If USDHI6_WAIT_FOR_DATA_END times out, we have already unmapped

0 commit comments

Comments
 (0)