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:   Thu, 4 Feb 2021 18:18:29 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Vladimir Oltean <vladimir.oltean@....com>
Cc:     "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        netdev <netdev@...r.kernel.org>,
        Florian Fainelli <f.fainelli@...il.com>,
        Vivien Didelot <vivien.didelot@...il.com>
Subject: Re: [PATCH net] net: dsa: call teardown method on probe failure

On Thu, Feb 04, 2021 at 05:06:15PM +0000, Vladimir Oltean wrote:
> On Thu, Feb 04, 2021 at 06:00:26PM +0100, Andrew Lunn wrote:
> > On Thu, Feb 04, 2021 at 06:33:51PM +0200, Vladimir Oltean wrote:
> > > Since teardown is supposed to undo the effects of the setup method, it
> > > should be called in the error path for dsa_switch_setup, not just in
> > > dsa_switch_teardown.
> > 
> > I disagree with this. If setup failed, it should of cleaned itself up.
> > That is the generally accepted way of doing things. If a function is
> > going to exit with an error, it should first undo whatever it did
> > before exiting.
> > 
> > You are adding extra semantics to the teardown op. It can no longer
> > assume setup was successful. So it needs to be very careful about what
> > it tears down, it cannot assume everything has been setup. I doubt the
> > existing implementations actually do that.
> 
> I'm sorry, I don't understand.
> I write a driver, I implement .setup(). I allocate some memory, I expect
> that I can deallocate it in .teardown().
> Now dsa_switch_setup comes, calls my .setup() which succedes. But then
> mdiobus_register(ds->slave_mii_bus) which comes right after .setup()
> fails. Are you saying we shouldn't call the driver's .teardown()?
> Why not?

Hi Vladimir

Ah, sorry. Read you commit message wrongly. I though you were calling
teardown if setup failed. But that is not what the patch does. It
calls it if things after setup fail.

Reviewed-by: Andrew Lunn <andrew@...n.ch>

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ