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] [day] [month] [year] [list]
Date:   Mon, 25 May 2020 21:13:49 +0000
From:   Chris Packham <Chris.Packham@...iedtelesis.co.nz>
To:     Peter Rosin <peda@...ntia.se>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     Mark Brown <broonie@...nel.org>,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        "linux-spi@...r.kernel.org" <linux-spi@...r.kernel.org>,
        Matthew Wilcox <willy@...radead.org>,
        "Geert Uytterhoeven" <geert@...ux-m68k.org>
Subject: Re: [PATCH] spi: mux: repair mux usage


On 25/05/20 10:43 pm, Peter Rosin wrote:
> It is not valid to cache/short out selection of the mux.
>
> mux_control_select() only locks the mux until mux_control_deselect()
> is called. mux_control_deselect() may put the mux in some low power
> state or some other user of the mux might select it for other purposes.
> These things are probably not happening in the original setting where
> this driver was developed, but it is said to be a generic SPI mux.
>
> Also, the mux framework will short out the actual low level muxing
> operation when/if that is possible.
>
> Fixes: e9e40543ad5b ("spi: Add generic SPI multiplexer")
> Signed-off-by: Peter Rosin <peda@...ntia.se>
> ---
>   drivers/spi/spi-mux.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/spi/spi-mux.c b/drivers/spi/spi-mux.c
> index 4f94c9127fc1..cc9ef371db14 100644
> --- a/drivers/spi/spi-mux.c
> +++ b/drivers/spi/spi-mux.c
> @@ -51,6 +51,10 @@ static int spi_mux_select(struct spi_device *spi)
>   	struct spi_mux_priv *priv = spi_controller_get_devdata(spi->controller);
>   	int ret;
>   
> +	ret = mux_control_select(priv->mux, spi->chip_select);
> +	if (ret)
> +		return ret;
> +
>   	if (priv->current_cs == spi->chip_select)
>   		return 0;
>   
> @@ -62,10 +66,6 @@ static int spi_mux_select(struct spi_device *spi)
>   	priv->spi->mode = spi->mode;
>   	priv->spi->bits_per_word = spi->bits_per_word;
>   
> -	ret = mux_control_select(priv->mux, spi->chip_select);
> -	if (ret)
> -		return ret;
> -
>   	priv->current_cs = spi->chip_select;
>   
>   	return 0;


I've tested this on the 2 hardware platforms I have with the multiplexed 
CS and both work fine with this change so

Tested-by: Chris Packham <chris.packham@...iedtelesis.co.nz>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ