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: <20200316143455.GA19141@qmqm.qmqm.pl>
Date:   Mon, 16 Mar 2020 15:34:55 +0100
From:   Michał Mirosław <mirq-linux@...e.qmqm.pl>
To:     Mark Brown <broonie@...nel.org>
Cc:     linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] spi: fix cs_change for last transfer

On Mon, Mar 16, 2020 at 12:17:50PM +0000, Mark Brown wrote:
> On Sun, Mar 15, 2020 at 06:08:53PM +0100, Michał Mirosław wrote:
> > Generic spi_transfer_one_message() implementation introduced in
> > commit b158935f70b9 has a bug in cs_change handling: it keeps CS
> > asserted when cs_change is set. Fix it.
> 
> >  	struct spi_transfer *xfer;
> > -	bool keep_cs = false;
> > +	bool keep_cs = true;
> >  	int ret = 0;
> >  	struct spi_statistics *statm = &ctlr->statistics;
> >  	struct spi_statistics *stats = &msg->spi->statistics;
> > @@ -1268,7 +1268,7 @@ static int spi_transfer_one_message(struct spi_controller *ctlr,
> >  		if (xfer->cs_change) {
> >  			if (list_is_last(&xfer->transfer_list,
> >  					 &msg->transfers)) {
> > -				keep_cs = true;
> > +				keep_cs = false;
> >  			} else {
> 
> This is the opposite of the intended behaviour - we want to deassert
> chip select at the end of the message unless cs_change is set on the
> last transfer.  If this were broken I would expect to see widespread
> problems being reported.

This is unfortunate naming I suppose. I reread the spi.h comments
a few more times and it seems indeed, that .cs_change == 1 on last
transfer means to a driver: "you may leave CS unchanged" - quite the
reverse compared to non-last transfers.

Please drop this patch then.

Best Regards
Michał Mirosław

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ