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, 20 Jun 2024 11:29:04 -0300
From: Marcelo Schmitt <marcelo.schmitt1@...il.com>
To: David Lechner <dlechner@...libre.com>
Cc: Marcelo Schmitt <marcelo.schmitt@...log.com>, broonie@...nel.org,
	lars@...afoo.de, Michael.Hennerich@...log.com, jic23@...nel.org,
	robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org,
	conor+dt@...nel.org, nuno.sa@...log.com, linux-iio@...r.kernel.org,
	devicetree@...r.kernel.org, linux-spi@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 1/6] spi: Enable controllers to extend the SPI
 protocol with MOSI idle configuration

On 06/19, David Lechner wrote:
> On 6/18/24 6:10 PM, Marcelo Schmitt wrote:
> 
> ...
> 
> > @@ -3928,7 +3934,8 @@ int spi_setup(struct spi_device *spi)
> >  	 * so it is ignored here.
> >  	 */
> >  	bad_bits = spi->mode & ~(spi->controller->mode_bits | SPI_CS_WORD |
> > -				 SPI_NO_TX | SPI_NO_RX);
> > +				 SPI_NO_TX | SPI_NO_RX | SPI_MOSI_IDLE_LOW |
> > +				 SPI_MOSI_IDLE_HIGH);
> 
> This looks wrong to me. Adding flags here causes them to be ignored
> rather than to be checked.
> 
> I also did a runtime check with a random driver and a SPI controller
> that does not have the flag.
> 
> 	spi->mode |= SPI_MOSI_IDLE_LOW;
> 	ret = spi_setup(spi);
> 	if (ret)
> 		return ret;
> 
> It incorrectly passes when used with this change but correctly fails
> without this change.

That's right, adding flags to bad_bits makes spi_setup() ignore those mode bits
instead of failing when they don't match.
Changed bad_bits assignment back to what it was in v3 (i.e. no change to bad_bits).
	bad_bits = spi->mode & ~(spi->controller->mode_bits | SPI_CS_WORD |
				 SPI_NO_TX | SPI_NO_RX);

> 
> >  	ugly_bits = bad_bits &
> >  		    (SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL |
> >  		     SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ