From: H Hartley Sweeten <hartleys@visionengravers.com>
To: Mika Westerberg <mika.westerberg@iki.fi>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "vinod.koul@intel.com" <vinod.koul@intel.com>,
"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
"rmallon@gmail.com" <rmallon@gmail.com>,
Rafal Prylowski <prylowski@metasoft.pl>
Subject: RE: [PATCH 2/2] dma/ep93xx_dma: prevent ep93xx_dma_tasklet() to access empty list
Date: Tue, 22 Nov 2011 14:26:52 -0600 [thread overview]
Message-ID: <ADE657CA350FB648AAC2C43247A983F001F3E96DA6B7@AUSP01VMBX24.collaborationhost.net> (raw)
In-Reply-To: <707c0a5c61bd597ceed3871fc3528f687ac0fcff.1321990466.git.mika.westerberg@iki.fi>
On Tuesday, November 22, 2011 12:46 PM, Mika Westerberg wrote:
> From: Rafal Prylowski <prylowski@metasoft.pl>
>
> If dma_terminate_all() is called before the ep93xx_dma_tasklet() gets to run,
> it tries to access an empty ->active list causing following OOPS:
[snip]
> As we expect that the ->active list is never empty when the ep93xx_dma_tasklet()
> is called, we fix this by adding a new flag per channel EP93XX_DMA_IS_RUNNING
> which determines whether the channel is running or not.
>
> We also add BUG_ON() to ep93xx_dma_get_active() to make sure that similar
> problems will be caught early.
>
> Signed-off-by: Rafal Prylowski <prylowski@metasoft.pl>
> [added a flag instead of just checking for empty list]
> Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>
> ---
> drivers/dma/ep93xx_dma.c | 25 ++++++++++++++++---------
> 1 files changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c
> index 6181811..cc3a302 100644
> --- a/drivers/dma/ep93xx_dma.c
> +++ b/drivers/dma/ep93xx_dma.c
> @@ -155,6 +155,8 @@ struct ep93xx_dma_chan {
> unsigned long flags;
> /* Channel is configured for cyclic transfers */
> #define EP93XX_DMA_IS_CYCLIC 0
> +/* Channel is enabled */
> +#define EP93XX_DMA_IS_RUNNING 1
>
> int buffer;
> dma_cookie_t last_completed;
> @@ -246,6 +248,7 @@ static void ep93xx_dma_set_active(struct ep93xx_dma_chan *edmac,
> static struct ep93xx_dma_desc *
> ep93xx_dma_get_active(struct ep93xx_dma_chan *edmac)
> {
> + BUG_ON(list_empty(&edmac->active));
> return list_first_entry(&edmac->active, struct ep93xx_dma_desc, node);
Mika,
Thanks for looking into this.
I still don't like the BUG_ON here. Is it even possible to get here with
an empty list now that your catching it in the tasklet?
But, ep93xx_dma_set_active() also has a BUG_ON test so...
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
next prev parent reply other threads:[~2011-11-22 20:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-22 19:45 [PATCH 1/2] dma/ep93xx_dma: fix initialization of M2M control register Mika Westerberg
2011-11-22 19:45 ` [PATCH 2/2] dma/ep93xx_dma: prevent ep93xx_dma_tasklet() to access empty list Mika Westerberg
2011-11-22 20:26 ` H Hartley Sweeten [this message]
2011-11-23 5:12 ` Mika Westerberg
2011-11-23 11:00 ` Vinod Koul
2011-11-24 5:47 ` Mika Westerberg
2011-11-22 20:16 ` [PATCH 1/2] dma/ep93xx_dma: fix initialization of M2M control register H Hartley Sweeten
2011-11-23 9:05 ` Rafal Prylowski
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=ADE657CA350FB648AAC2C43247A983F001F3E96DA6B7@AUSP01VMBX24.collaborationhost.net \
--to=hartleys@visionengravers.com \
--cc=dan.j.williams@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@iki.fi \
--cc=prylowski@metasoft.pl \
--cc=rmallon@gmail.com \
--cc=vinod.koul@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).