mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-11-30 15:53:22 -05:00
pinctrl: mediatek: fix global-out-of-bounds issue
commit 2d5446da5acecf9c67db1c9d55ae2c3e5de01f8d upstream. When eint virtual eint number is greater than gpio number, it maybe produce 'desc[eint_n]' size globle-out-of-bounds issue. Signed-off-by: Guodong Liu <[email protected]> Signed-off-by: Zhiyong Tao <[email protected]> Reviewed-by: Chen-Yu Tsai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
bf04afb613
commit
f373298e1b
1 changed files with 6 additions and 2 deletions
|
|
@ -236,8 +236,12 @@ static int mtk_xt_get_gpio_n(void *data, unsigned long eint_n,
|
|||
desc = (const struct mtk_pin_desc *)hw->soc->pins;
|
||||
*gpio_chip = &hw->chip;
|
||||
|
||||
/* Be greedy to guess first gpio_n is equal to eint_n */
|
||||
if (desc[eint_n].eint.eint_n == eint_n)
|
||||
/*
|
||||
* Be greedy to guess first gpio_n is equal to eint_n.
|
||||
* Only eint virtual eint number is greater than gpio number.
|
||||
*/
|
||||
if (hw->soc->npins > eint_n &&
|
||||
desc[eint_n].eint.eint_n == eint_n)
|
||||
*gpio_n = eint_n;
|
||||
else
|
||||
*gpio_n = mtk_xt_find_eint_num(hw, eint_n);
|
||||
|
|
|
|||
Loading…
Reference in a new issue