This is a note to let you know that I've just added the patch titled pinctrl: mediatek: fix global-out-of-bounds issue to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: pinctrl-mediatek-fix-global-out-of-bounds-issue.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 2d5446da5acecf9c67db1c9d55ae2c3e5de01f8d Mon Sep 17 00:00:00 2001 From: Guodong Liu <guodong.liu@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 10 Nov 2021 15:19:00 +0800 Subject: pinctrl: mediatek: fix global-out-of-bounds issue From: Guodong Liu <guodong.liu@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> 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 <guodong.liu@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> Signed-off-by: Zhiyong Tao <zhiyong.tao@xxxxxxxxxxxx> Reviewed-by: Chen-Yu Tsai <wenst@xxxxxxxxxxxx> Link: https://lore.kernel.org/r/20211110071900.4490-2-zhiyong.tao@xxxxxxxxxxxx Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c @@ -280,8 +280,12 @@ static int mtk_xt_get_gpio_n(void *data, 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); Patches currently in stable-queue which might be from guodong.liu@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx are queue-5.10/pinctrl-mediatek-fix-global-out-of-bounds-issue.patch