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: <YfP/TuEERCrgst+k@smile.fi.intel.com>
Date:   Fri, 28 Jan 2022 16:35:58 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Florian Fainelli <f.fainelli@...il.com>
Cc:     linux-kernel@...r.kernel.org,
        Linus Walleij <linus.walleij@...aro.org>,
        Ray Jui <rjui@...adcom.com>,
        Scott Branden <sbranden@...adcom.com>,
        "maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE..." 
        <bcm-kernel-feedback-list@...adcom.com>,
        Nicolas Saenz Julienne <nsaenz@...nel.org>,
        Phil Elwell <phil@...pberrypi.com>,
        Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
        Hans Verkuil <hverkuil-cisco@...all.nl>,
        Jason Wang <wangborong@...rlc.com>,
        Marc Zyngier <maz@...nel.org>,
        "open list:PIN CONTROL SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" 
        <linux-rpi-kernel@...ts.infradead.org>,
        "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" 
        <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH] pinctrl: bcm2835: Fix a few error paths

On Thu, Jan 27, 2022 at 01:50:31PM -0800, Florian Fainelli wrote:
> After commit 266423e60ea1 ("pinctrl: bcm2835: Change init order for gpio
> hogs") a few error paths would not unwind properly the registration of
> gpio ranges. Correct that by assigning a single error label and goto it
> whenever we encounter a fatal error.

>  1 file changed, 15 insertions(+), 8 deletions(-)

While this seems legit per se, my eyes caught this:


>  	if (!girq->parents) {
> -		pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
> -		return -ENOMEM;
> +		err = -ENOMEM;
> +		goto out_remove;

Non-devm....

>  	}
>  
>  	if (is_7211) {
>  		pc->wake_irq = devm_kcalloc(dev, BCM2835_NUM_IRQS,
>  					    sizeof(*pc->wake_irq),
>  					    GFP_KERNEL);

...followed by devm.

It means more ordering bugs in the ->remove() and error path are lurking
around. Can you double check and be sure that we do not have a case where
non-devm registration code followed by devm?

If that is the case it has to be fixed as well.

> -		if (!pc->wake_irq)
> -			return -ENOMEM;
> +		if (!pc->wake_irq) {
> +			err = -ENOMEM;
> +			goto out_remove;
> +		}
>  	}


-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ