Skip to content

Commit 16198ee

Browse files
bastien-curutchetstorulf
authored andcommitted
mmc: davinci_mmc: Prevent transmitted data size from exceeding sgm's length
No check is done on the size of the data to be transmiited. This causes a kernel panic when this size exceeds the sg_miter's length. Limit the number of transmitted bytes to sgm->length. Cc: [email protected] Fixes: ed01d21 ("mmc: davinci_mmc: Use sg_miter for PIO") Signed-off-by: Bastien Curutchet <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 63d20a9 commit 16198ee

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/mmc/host/davinci_mmc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ static void davinci_fifo_data_trans(struct mmc_davinci_host *host,
224224
}
225225
p = sgm->addr;
226226

227+
if (n > sgm->length)
228+
n = sgm->length;
229+
227230
/* NOTE: we never transfer more than rw_threshold bytes
228231
* to/from the fifo here; there's no I/O overlap.
229232
* This also assumes that access width( i.e. ACCWD) is 4 bytes

0 commit comments

Comments
 (0)