All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-kernel@vger.kernel.org, Dan Williams <djbw@fb.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] dma: ste_dma40: don't dereference free:d descriptor
Date: Mon, 17 Feb 2014 14:07:17 +0530	[thread overview]
Message-ID: <20140217083717.GX10628@intel.com> (raw)
In-Reply-To: <1392284341-11482-1-git-send-email-linus.walleij@linaro.org>

On Thu, Feb 13, 2014 at 10:39:01AM +0100, Linus Walleij wrote:
> It appears that in the DMA40 driver the DMA tasklet will very
> often dereference memory for a descriptor just free:d from the
> DMA40 slab. Nothing happens because no other part of the driver
> has yet had a chance to claim this memory, but it's really
> nasty to dereference free:d memory, so let's check the flag
> before the descriptor is free and store it in a bool variable.
> 
> Cc: stable@vger.kernel.org
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Applied, thanks

-- 
~Vinod
> ---
>  drivers/dma/ste_dma40.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
> index 00a2de957b23..bf18c786ed40 100644
> --- a/drivers/dma/ste_dma40.c
> +++ b/drivers/dma/ste_dma40.c
> @@ -1641,6 +1641,7 @@ static void dma_tasklet(unsigned long data)
>  	struct d40_chan *d40c = (struct d40_chan *) data;
>  	struct d40_desc *d40d;
>  	unsigned long flags;
> +	bool callback_active;
>  	dma_async_tx_callback callback;
>  	void *callback_param;
>  
> @@ -1668,6 +1669,7 @@ static void dma_tasklet(unsigned long data)
>  	}
>  
>  	/* Callback to client */
> +	callback_active = !!(d40d->txd.flags & DMA_PREP_INTERRUPT);
>  	callback = d40d->txd.callback;
>  	callback_param = d40d->txd.callback_param;
>  
> @@ -1690,7 +1692,7 @@ static void dma_tasklet(unsigned long data)
>  
>  	spin_unlock_irqrestore(&d40c->lock, flags);
>  
> -	if (callback && (d40d->txd.flags & DMA_PREP_INTERRUPT))
> +	if (callback_active && callback)
>  		callback(callback_param);
>  
>  	return;
> -- 
> 1.8.5.3
> 

-- 

      reply	other threads:[~2014-02-17  8:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13  9:39 [PATCH] dma: ste_dma40: don't dereference free:d descriptor Linus Walleij
2014-02-17  8:37 ` Vinod Koul [this message]

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=20140217083717.GX10628@intel.com \
    --to=vinod.koul@intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=djbw@fb.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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.