Commit cb65fc21 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Greg Kroah-Hartman

mmc: dw_mmc-k3: Fix out-of-bounds access through DT alias

commit 325501d9 upstream.

The hs_timing_cfg[] array is indexed using a value derived from the
"mshcN" alias in DT, which may lead to an out-of-bounds access.

Fix this by adding a range check.

Fixes: 361c7fe9 ("mmc: dw_mmc-k3: add sd support for hi3660")
Signed-off-by: default avatarGeert Uytterhoeven <>
Reviewed-by: default avatarShawn Lin <>
Cc: <>
Signed-off-by: default avatarUlf Hansson <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 33b42aa6
......@@ -135,6 +135,9 @@ static int dw_mci_hi6220_parse_dt(struct dw_mci *host)
if (priv->ctrl_id < 0)
priv->ctrl_id = 0;
if (priv->ctrl_id >= TIMING_MODE)
return -EINVAL;
host->priv = priv;
return 0;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment