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] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZOuZ+n3PZWqxsG35@probook>
Date:   Sun, 27 Aug 2023 20:46:18 +0200
From:   Jonathan Neuschäfer <j.neuschaefer@....net>
To:     Mikhail Kobuk <m.kobuk@...ras.ru>
Cc:     Jonathan Neuschäfer <j.neuschaefer@....net>,
        lvc-project@...uxtesting.org,
        Linus Walleij <linus.walleij@...aro.org>,
        linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
        openbmc@...ts.ozlabs.org,
        Alexey Khoroshilov <khoroshilov@...ras.ru>
Subject: Re: [PATCH] pinctrl: nuvoton: wpcm450: fix out of bounds write

On Fri, Aug 25, 2023 at 01:15:28PM +0300, Mikhail Kobuk wrote:
> Write into 'pctrl->gpio_bank' happens before the check for GPIO index
> validity, so out of bounds write may happen.

Good point.

Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@....net>

Thanks!


> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
> Signed-off-by: Mikhail Kobuk <m.kobuk@...ras.ru>
> Reviewed-by: Alexey Khoroshilov <khoroshilov@...ras.ru>
> ---
>  drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> index 2d1c1652cfd9..8a9961ac8712 100644
> --- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> +++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> @@ -1062,13 +1062,13 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
>  		if (ret < 0)
>  			return ret;
>  
> -		gpio = &pctrl->gpio_bank[reg];
> -		gpio->pctrl = pctrl;
> -
>  		if (reg >= WPCM450_NUM_BANKS)
>  			return dev_err_probe(dev, -EINVAL,
>  					     "GPIO index %d out of range!\n", reg);
>  
> +		gpio = &pctrl->gpio_bank[reg];
> +		gpio->pctrl = pctrl;
> +
>  		bank = &wpcm450_banks[reg];
>  		gpio->bank = bank;
>  
> -- 
> 2.42.0
> 

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ