All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	tony@atomide.com, balbi@ti.com, gregkh@linuxfoundation.org
Subject: Re: [PATCH 09/13] dmaengine: edma: check for echan->edesc => NULL in edma_dma_pause()
Date: Wed, 15 Oct 2014 20:57:00 +0530	[thread overview]
Message-ID: <20141015152700.GY1638@intel.com> (raw)
In-Reply-To: <1412014009-13315-10-git-send-email-bigeasy@linutronix.de>

On Mon, Sep 29, 2014 at 08:06:45PM +0200, Sebastian Andrzej Siewior wrote:
> I added book keeping of whether or not the 8250-dma driver has an RX
> transfer pending or not so we don't BUG here if it calls
> dmaengine_pause() on a channel which has not a pending transfer. Guess
> what, this is not enough.
> The following can be triggered with a busy RX channel and hackbench in
> background:
> - DMA transfer completes. The callback is delayed via
>   vchan_cookie_complete() into a tasklet so it das not happen asap.
> - hackbench keeps the system busy so the tasklet does not run "soon".
> - the UART collected enough data and generates an "timeout"-interrupt.
>   Since 8250-dma *thinks* the DMA-transfer is still pending it tries to
>   cancel it via invoking dmaengine_pause() first. This causes the segfault
>   because echan->edesc is NULL now that the transfer completed (however
>   the callback did not run yet).
> 
> With this patch we don't BUG in the scenario described.

Applied thanks

-- 
~Vinod
> 
> Cc: vinod.koul@intel.com
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/dma/edma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
> index 7b65633f495e..123f578d6dd3 100644
> --- a/drivers/dma/edma.c
> +++ b/drivers/dma/edma.c
> @@ -288,7 +288,7 @@ static int edma_slave_config(struct edma_chan *echan,
>  static int edma_dma_pause(struct edma_chan *echan)
>  {
>  	/* Pause/Resume only allowed with cyclic mode */
> -	if (!echan->edesc->cyclic)
> +	if (!echan->edesc || !echan->edesc->cyclic)
>  		return -EINVAL;
>  
>  	edma_pause(echan->ch_num);
> -- 
> 2.1.0
> 

-- 

WARNING: multiple messages have this Message-ID (diff)
From: vinod.koul@intel.com (Vinod Koul)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 09/13] dmaengine: edma: check for echan->edesc => NULL in edma_dma_pause()
Date: Wed, 15 Oct 2014 20:57:00 +0530	[thread overview]
Message-ID: <20141015152700.GY1638@intel.com> (raw)
In-Reply-To: <1412014009-13315-10-git-send-email-bigeasy@linutronix.de>

On Mon, Sep 29, 2014 at 08:06:45PM +0200, Sebastian Andrzej Siewior wrote:
> I added book keeping of whether or not the 8250-dma driver has an RX
> transfer pending or not so we don't BUG here if it calls
> dmaengine_pause() on a channel which has not a pending transfer. Guess
> what, this is not enough.
> The following can be triggered with a busy RX channel and hackbench in
> background:
> - DMA transfer completes. The callback is delayed via
>   vchan_cookie_complete() into a tasklet so it das not happen asap.
> - hackbench keeps the system busy so the tasklet does not run "soon".
> - the UART collected enough data and generates an "timeout"-interrupt.
>   Since 8250-dma *thinks* the DMA-transfer is still pending it tries to
>   cancel it via invoking dmaengine_pause() first. This causes the segfault
>   because echan->edesc is NULL now that the transfer completed (however
>   the callback did not run yet).
> 
> With this patch we don't BUG in the scenario described.

Applied thanks

-- 
~Vinod
> 
> Cc: vinod.koul at intel.com
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/dma/edma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
> index 7b65633f495e..123f578d6dd3 100644
> --- a/drivers/dma/edma.c
> +++ b/drivers/dma/edma.c
> @@ -288,7 +288,7 @@ static int edma_slave_config(struct edma_chan *echan,
>  static int edma_dma_pause(struct edma_chan *echan)
>  {
>  	/* Pause/Resume only allowed with cyclic mode */
> -	if (!echan->edesc->cyclic)
> +	if (!echan->edesc || !echan->edesc->cyclic)
>  		return -EINVAL;
>  
>  	edma_pause(echan->ch_num);
> -- 
> 2.1.0
> 

-- 

  parent reply	other threads:[~2014-10-15 15:27 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-29 18:06 [PATCH 00/13 v10] omap 8250 based UART + DMA Sebastian Andrzej Siewior
2014-09-29 18:06 ` Sebastian Andrzej Siewior
2014-09-29 18:06 ` Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 01/13] tty: serial: 8250: Fix wording in runtime-PM comments Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 02/13] tty: serial: 8250: make serial8250_console_setup() non _init Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-30 20:27   ` Peter Hurley
2014-09-30 20:27     ` Peter Hurley
2014-09-30 20:27     ` Peter Hurley
2014-09-29 18:06 ` [PATCH 03/13] tty: serial: Add 8250-core based omap driver Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 04/13] tty: serial: 8250_dma: handle error on TX submit Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 05/13] tty: serial: 8250_dma: keep own book keeping about RX transfers Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 06/13] tty: serial: 8250: allow to use custom DMA implementation Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 07/13] tty: serial: 8250_omap: add custom DMA-TX callback Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 08/13] tty: serial: 8250_omap: add custom DMA-RX callback Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 09/13] dmaengine: edma: check for echan->edesc => NULL in edma_dma_pause() Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-10-01 12:00   ` Peter Ujfalusi
2014-10-01 12:00     ` Peter Ujfalusi
2014-10-01 12:00     ` Peter Ujfalusi
2014-10-15 15:27   ` Vinod Koul [this message]
2014-10-15 15:27     ` Vinod Koul
2014-10-15 15:28   ` Vinod Koul
2014-10-15 15:28     ` Vinod Koul
2014-09-29 18:06 ` [PATCH 10/13] arm: dts: am33xx: add DMA properties for UART Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 11/13] arm: dts: dra7: " Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-11-04 17:02   ` Lennart Sorensen
2014-11-04 17:02     ` Lennart Sorensen
2014-11-04 17:06     ` Sebastian Andrzej Siewior
2014-11-04 17:06       ` Sebastian Andrzej Siewior
2014-11-04 17:21       ` Lennart Sorensen
2014-11-04 17:21         ` Lennart Sorensen
2014-11-04 18:32         ` Javier Martinez Canillas
2014-11-04 18:32           ` Javier Martinez Canillas
2014-11-04 18:48           ` Nishanth Menon
2014-11-04 18:48             ` Nishanth Menon
2014-11-04 18:48             ` Nishanth Menon
     [not found]           ` <CABxcv=kT+M70Xoyf_z4eQQyM0Oo9S5Y0YeX2R6PbAqxK-JTLLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-04 19:00             ` Lennart Sorensen
2014-11-04 19:00               ` Lennart Sorensen
2014-11-04 19:00               ` Lennart Sorensen
2014-11-04 18:33         ` Lennart Sorensen
2014-11-04 18:33           ` Lennart Sorensen
2014-11-04 21:03           ` Lennart Sorensen
2014-11-04 21:03             ` Lennart Sorensen
     [not found]             ` <20141104210315.GF24112-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys@public.gmane.org>
2014-11-05  1:15               ` Lennart Sorensen
2014-11-05  1:15                 ` Lennart Sorensen
2014-11-05  1:15                 ` Lennart Sorensen
     [not found]                 ` <20141105011506.GG24112-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys@public.gmane.org>
2014-11-05  8:11                   ` Sebastian Andrzej Siewior
2014-11-05  8:11                     ` Sebastian Andrzej Siewior
2014-11-05  8:11                     ` Sebastian Andrzej Siewior
2014-11-05 15:33                     ` Lennart Sorensen
2014-11-05 15:33                       ` Lennart Sorensen
2014-11-05 16:20                       ` Lennart Sorensen
2014-11-05 16:20                         ` Lennart Sorensen
2014-11-05 16:30                         ` Sebastian Andrzej Siewior
2014-11-05 16:30                           ` Sebastian Andrzej Siewior
2014-11-05 19:43                           ` Lennart Sorensen
2014-11-05 19:43                             ` Lennart Sorensen
     [not found]                             ` <20141105194323.GI24112-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys@public.gmane.org>
2014-11-13 18:34                               ` Sebastian Andrzej Siewior
2014-11-13 18:34                                 ` Sebastian Andrzej Siewior
2014-11-13 18:34                                 ` Sebastian Andrzej Siewior
2014-11-13 22:08                                 ` Lennart Sorensen
2014-11-13 22:08                                   ` Lennart Sorensen
2014-09-29 18:06 ` [PATCH 12/13] tty: serial: 8250: omap: add custom irq handling Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-10-09 13:19   ` Heikki Krogerus
2014-10-09 13:19     ` Heikki Krogerus
2014-09-29 18:06 ` [PATCH 13/13] tty: serial: 8250: omap: add dma support Sebastian Andrzej Siewior
2014-09-29 18:06   ` Sebastian Andrzej Siewior
2014-10-02 16:43 ` [PATCH 00/13 v10] omap 8250 based UART + DMA Tony Lindgren
2014-10-02 16:43   ` Tony Lindgren
2014-10-02 16:43   ` Tony Lindgren
2014-10-02 23:19   ` Sebastian Andrzej Siewior
2014-10-02 23:19     ` Sebastian Andrzej Siewior
2014-10-03 13:08 ` Peter Hurley
2014-10-03 13:08   ` Peter Hurley
2014-10-03 13:08   ` Peter Hurley
2014-11-06  3:14 ` Greg KH
2014-11-06  3:14   ` Greg KH
2014-11-06  3:14   ` Greg KH
2014-11-06 10:27   ` Sebastian Andrzej Siewior
2014-11-06 10:27     ` Sebastian Andrzej Siewior
2014-11-10 17:24     ` Tony Lindgren
2014-11-10 17:24       ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141015152700.GY1638@intel.com \
    --to=vinod.koul@intel.com \
    --cc=balbi@ti.com \
    --cc=bigeasy@linutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.