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]
Date:   Tue, 8 Aug 2023 09:24:33 +0200
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        Robert Marko <robert.marko@...tura.hr>,
        Luka Perkov <luka.perkov@...tura.hr>,
        Michael Walle <michael@...le.cc>, linux-kernel@...r.kernel.org,
        Randy Dunlap <rdunlap@...radead.org>,
        Chen-Yu Tsai <wenst@...omium.org>,
        Daniel Golle <daniel@...rotopia.org>,
        Rafał Miłecki <rafal@...ecki.pl>
Subject: Re: [PATCH v9 1/7] nvmem: core: Create all cells before adding the
 nvmem device

Hi Srinivas,

srinivas.kandagatla@...aro.org wrote on Tue, 8 Aug 2023 07:56:47 +0100:

> On 08/08/2023 07:29, Miquel Raynal wrote:
> > Let's pack all the cells creation in one place, so they are all created
> > before we add the nvmem device.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@...tlin.com>
> > ---
> >   drivers/nvmem/core.c | 12 ++++++------
> >   1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> > index 3f8c7718412b..48659106a1e2 100644
> > --- a/drivers/nvmem/core.c
> > +++ b/drivers/nvmem/core.c
> > @@ -998,12 +998,6 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
> >   	if (rval)
> >   		goto err_remove_cells;  
> >   > -	dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);  
> > -
> > -	rval = device_add(&nvmem->dev);
> > -	if (rval)
> > -		goto err_remove_cells;
> > -
> >   	rval = nvmem_add_cells_from_fixed_layout(nvmem);
> >   	if (rval)
> >   		goto err_remove_cells;
> > @@ -1012,6 +1006,12 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
> >   	if (rval)
> >   		goto err_remove_cells;  
> >   > +	dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);  
> > +
> > +	rval = device_add(&nvmem->dev);
> > +	if (rval)
> > +		goto err_remove_cells;  
> 
> All the error handling paths are now messed up with this patch, put_device() in error path will be called incorrectly from multiple places.

I'm not sure what this means. Perhaps I should additionally call
device_del() after device_add was successful to mimic the
device_unregister() call from the remove path. Is that what you mean?

I also see the layout_np below should be freed before jumping in the
error section.

Is there anything else I missed? Because you said "from multiple
places", and I don't see this.

Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ