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: <20191027155836.2e3d8ebf@archlinux>
Date:   Sun, 27 Oct 2019 15:58:36 +0000
From:   Jonathan Cameron <jic23@...nel.org>
To:     Fabrice Gasnier <fabrice.gasnier@...com>
Cc:     <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <mcoquelin.stm32@...il.com>,
        <alexandre.torgue@...com>, <linux-iio@...r.kernel.org>,
        <lars@...afoo.de>, <knaack.h@....de>, <pmeerw@...erw.net>,
        <linux-stm32@...md-mailman.stormreply.com>
Subject: Re: [PATCH] iio: adc: stm32-adc: fix stopping dma

On Fri, 25 Oct 2019 17:04:20 +0200
Fabrice Gasnier <fabrice.gasnier@...com> wrote:

> There maybe a race when using dmaengine_terminate_all(). The predisable
> routine may call iio_triggered_buffer_predisable() prior to a pending DMA
> callback.
> Adopt dmaengine_terminate_sync() to ensure there's no pending DMA request
> before calling iio_triggered_buffer_predisable().
> 
> Fixes: 2763ea0585c9 ("iio: adc: stm32: add optional dma support")
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@...com>
Applied to the fixes-togreg branch of iio.git and marked for stable.
I'm guessing this is not something that has been observed in practice, but
seems like a safe fix anyway to backport.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/stm32-adc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
> index 663f8a5..73aee59 100644
> --- a/drivers/iio/adc/stm32-adc.c
> +++ b/drivers/iio/adc/stm32-adc.c
> @@ -1399,7 +1399,7 @@ static int stm32_adc_dma_start(struct iio_dev *indio_dev)
>  	cookie = dmaengine_submit(desc);
>  	ret = dma_submit_error(cookie);
>  	if (ret) {
> -		dmaengine_terminate_all(adc->dma_chan);
> +		dmaengine_terminate_sync(adc->dma_chan);
>  		return ret;
>  	}
>  
> @@ -1477,7 +1477,7 @@ static void __stm32_adc_buffer_predisable(struct iio_dev *indio_dev)
>  		stm32_adc_conv_irq_disable(adc);
>  
>  	if (adc->dma_chan)
> -		dmaengine_terminate_all(adc->dma_chan);
> +		dmaengine_terminate_sync(adc->dma_chan);
>  
>  	if (stm32_adc_set_trig(indio_dev, NULL))
>  		dev_err(&indio_dev->dev, "Can't clear trigger\n");

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ