lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGp9LzpEG_6w6fvmjaBAW3ihKQZm4uMEy9-5MaLLWkeu+QFqeQ@mail.gmail.com>
Date:   Wed, 3 Nov 2021 23:07:55 -0700
From:   Sean Wang <sean.wang@...nel.org>
To:     Zhiyong Tao <zhiyong.tao@...iatek.com>
Cc:     Rob Herring <robh+dt@...nel.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        Mark Rutland <mark.rutland@....com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        srv_heupstream <srv_heupstream@...iatek.com>,
        hui.liu@...iatek.com, Light Hsieh <light.hsieh@...iatek.com>,
        Sean Wang (王志亘) <sean.wang@...iatek.com>,
        Seiya Wang <seiya.wang@...iatek.com>, rex-bc.chen@...iatek.com,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>, lkml <linux-kernel@...r.kernel.org>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Guodong Liu <guodong.liu@...iatek.corp-partner.google.com>
Subject: Re: [PATCH] pinctrl: mediatek: fix global-out-of-bounds issue

HI, Zhiyong

On Wed, Nov 3, 2021 at 6:40 PM Zhiyong Tao <zhiyong.tao@...iatek.com> wrote:
>
> From: Guodong Liu <guodong.liu@...iatek.corp-partner.google.com>
>
> 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: Zhiyong Tao <zhiyong.tao@...iatek.com>
> Signed-off-by: Guodong Liu <guodong.liu@...iatek.corp-partner.google.com>
> ---
>  drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> index 45ebdeba985a..9d57c897835c 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> @@ -286,7 +286,8 @@ static int mtk_xt_get_gpio_n(void *data, unsigned long eint_n,
>         *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)
> +       if (((*gpio_chip)->ngpio > eint_n) &&

please use "hw->soc->npins > eint_n" to perform the boundary check to
be consistent with the other places for the same purpose

> +           desc[eint_n].eint.eint_n == eint_n)
>                 *gpio_n = eint_n;
>         else
>                 *gpio_n = mtk_xt_find_eint_num(hw, eint_n);
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ