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: <DM4PR12MB77655BA189E1F71716F436E68F8DA@DM4PR12MB7765.namprd12.prod.outlook.com>
Date:   Wed, 13 Dec 2023 06:14:10 +0000
From:   "Gangurde, Abhijit" <abhijit.gangurde@....com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        Dan Carpenter <dan.carpenter@...aro.org>
CC:     "Gupta, Nipun" <Nipun.Gupta@....com>,
        "Agarwal, Nikhil" <nikhil.agarwal@....com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: RE: [PATCH] cdx: Unlock on error path in rescan_store()

> Le 12/12/2023 à 10:20, Dan Carpenter a écrit :
> > We added locking to this function but these two error paths were
> > accidentally overlooked.
> >
> > Fixes: f0af81683466 ("cdx: Introduce lock to protect controller ops")
> > Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> > ---
> >   drivers/cdx/cdx.c | 14 +++++++++-----
> >   1 file changed, 9 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c
> > index d84d153078d7..f4f9f0c88c09 100644
> > --- a/drivers/cdx/cdx.c
> > +++ b/drivers/cdx/cdx.c
> > @@ -572,12 +572,16 @@ static ssize_t rescan_store(const struct bus_type
> *bus,
> >
> >   	/* Rescan all the devices */
> >   	for_each_compatible_node(np, NULL, compat_node_name) {
> > -		if (!np)
> > -			return -EINVAL;
> > +		if (!np) {
> > +			count = -EINVAL;
> > +			goto unlock;
> > +		}
> >
> >   		pd = of_find_device_by_node(np);
> > -		if (!pd)
> > -			return -EINVAL;
> > +		if (!pd) {
> > +			count = -EINVAL;
> > +			goto unlock;
> 
> Unrelated to your patch, but should we have a of_node_put(np); here, on
> early exit?

Yes. of_node_put(np) is needed here.

Thanks,
Abhijit

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ