mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
mmc: dw_mmc-k3: Fix out-of-bounds access through DT alias
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: 361c7fe9b0 ("mmc: dw_mmc-k3: add sd support for hi3660")
Signed-off-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Shawn Lin <[email protected]>
Cc: <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
This commit is contained in:
parent
f8870ae6e2
commit
325501d936
1 changed files with 3 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue