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]
Message-ID: <565457AE.3050309@ti.com>
Date:	Tue, 24 Nov 2015 17:57:26 +0530
From:	Sekhar Nori <nsekhar@...com>
To:	Mark Brown <broonie@...nel.org>
CC:	<linux-kernel@...r.kernel.org>,
	Linux ARM Mailing List <linux-arm-kernel@...ts.infradead.org>,
	<linux-spi@...r.kernel.org>,
	Grygorii Strashko <grygorii.strashko@...com>
Subject: Re: [PATCH] spi: davinci: fix spurious i/o error

On Tuesday 24 November 2015 04:04 PM, Sekhar Nori wrote:
> davinci_spi_bufs() uses wait_for_completion_interruptible()
> without bothering to handle -ERESTARTSYS. Due to this,
> sometime, it returns prematurely when a signal is received.
> Since the return value is never checked, userspace eventually
> receives a spurious -EIO.
> 
> To fix this, use un-interruptible wait_for_completion_timeout().
> 
> Signed-off-by: Sekhar Nori <nsekhar@...com>
> ---
>  drivers/spi/spi-davinci.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
> index 7d3af3eacf57..38026aa1afd7 100644
> --- a/drivers/spi/spi-davinci.c
> +++ b/drivers/spi/spi-davinci.c
> @@ -703,7 +703,10 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
>  
>  	/* Wait for the transfer to complete */
>  	if (spicfg->io_type != SPI_IO_TYPE_POLL) {
> -		wait_for_completion_interruptible(&(dspi->done));
> +		if (wait_for_completion_timeout(&dspi->done, HZ) == 0) {
> +			dev_err(&spi->dev, "spi transfer timeout\n");
> +			return -ETIMEDOUT;

Grygorii pointed out offline that this does not recover correctly in DMA
case. I will fix and send a v2.

Thanks,
Sekhar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ