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:   Mon, 11 Feb 2019 17:22:16 +0000
From:   "Derrick, Jonathan" <jonathan.derrick@...el.com>
To:     "zub@...ux.fjfi.cvut.cz" <zub@...ux.fjfi.cvut.cz>
CC:     "hch@...radead.org" <hch@...radead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
        "sbauer@...donthack.me" <sbauer@...donthack.me>,
        "jonas.rabenstein@...dium.uni-erlangen.de" 
        <jonas.rabenstein@...dium.uni-erlangen.de>,
        "axboe@...nel.dk" <axboe@...nel.dk>
Subject: Re: [PATCH v4 15/16] block: sed-opal: don't repeat opal_discovery0
 in each steps array

Hi David,

On Sun, 2019-02-10 at 18:46 +0100, David Kozub wrote:
> On Fri, 8 Feb 2019, Derrick, Jonathan wrote:
> 
> > On Mon, 2019-02-04 at 23:44 +0100, David Kozub wrote:
> > > On Mon, 4 Feb 2019, Christoph Hellwig wrote:
> > > 
> > > > > +	/* first do a discovery0 */
> > > > > +	error = opal_discovery0_step(dev);
> > > > > 
> > > > > +	for (state = 0; !error && state < n_steps; state++)
> > > > > +		error = execute_step(dev, &steps[state], state);
This was implemented in v4's 14/16, rather than this patch (15/16)

> > > > > +
> > > > > +	/*
> > > > > +	 * For each OPAL command the first step in steps starts some sort of
> > > > > +	 * session. If an error occurred in the initial discovery0 or if an
> > > > > +	 * error occurred in the first step (and thus stopping the loop with
> > > > > +	 * state == 1) then there was an error before or during the attempt to
> > > > > +	 * start a session. Therefore we shouldn't attempt to terminate a
> > > > > +	 * session, as one has not yet been created.
> > > > > +	 */
> > > > > +	if (error && state > 1)
> > > > > +		end_opal_session_error(dev);
> > > > > 
> > > > >  	return error;
> > > > 
> > > > The flow here is a little too condensed for my taste.  Why not the
> > > > plain obvoious, if a little longer:
> > > > 
> > > > 	error = error = opal_discovery0_step(dev);
> > > > 	if (error)
> > > > 		return error;
> > > > 
> > > > 	for (state = 0; state < n_steps; state++) {
> > > > 		error = execute_step(dev, &steps[state], state);
> > > > 		if (error)
> > > > 			goto out_error;
> > > > 	}
> > > > 
> > > > 	return 0;
> > > > 
> > > > out_error:
> > > > 	if (state > 1)
> > > > 		end_opal_session_error(dev);
> > > > 	return error;
> > > 
> > > No problem, I can use this version. But I think there is a minor issue -
> > > the same one I hit in my original change, just from the other direction:
> > > 
> > > If the loop succeds for the 0-th element of steps, and then fails for the
> > > 1st element, then state equals 1 yet the session has been started, so we
> > > should close it.
> > > 
> > > I think the condition in out_error should be if (state > 0).
> > > 
> > > Best regards,
> > > David
> > 
> > Looks good with Christoph's suggestion (for 14/16) and your state check fix
> > 
> > 
> > Reviewed-by: Jon Derrick <jonathan.derrick@...el.com>
> 
> Hi Jon,
> 
> What suggestion by Christoph you have in mind? I don't see any for 14/16. 
> Currently, in my git repo, for this patch, I applied Christoph suggestion 
> for this (15/16) patch + the "state > 0" fix. Is this what you mean?
> 
> Best regards,
> David
Download attachment "smime.p7s" of type "application/x-pkcs7-signature" (3278 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ