From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: dan.j.williams@intel.com
Cc: vinod.koul@intel.com, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de
Subject: [[PATCH] 3/3] dma: imx-dma: fix callback path in tasklet
Date: Tue, 17 Sep 2013 15:56:08 +0200 [thread overview]
Message-ID: <1379426168-31989-4-git-send-email-m.grzeschik@pengutronix.de> (raw)
In-Reply-To: <1379426168-31989-1-git-send-email-m.grzeschik@pengutronix.de>
We need to free the ld_active list head before jumping into the callback
routine. Otherwise the callback could run into issue_pending and change
our ld_active list head we just going to free. This will run the channel
list into an currupted and undefined state.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
drivers/dma/imx-dma.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index 247aa7c..55852c0 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -627,13 +627,11 @@ static void imxdma_tasklet(unsigned long data)
if (list_empty(&imxdmac->ld_active)) {
/* Someone might have called terminate all */
- goto out;
+ spin_unlock_irqrestore(&imxdma->lock, flags);
+ return;
}
desc = list_first_entry(&imxdmac->ld_active, struct imxdma_desc, node);
- if (desc->desc.callback)
- desc->desc.callback(desc->desc.callback_param);
-
/* If we are dealing with a cyclic descriptor, keep it on ld_active
* and dont mark the descriptor as complete.
* Only in non-cyclic cases it would be marked as complete
@@ -661,6 +659,10 @@ static void imxdma_tasklet(unsigned long data)
}
out:
spin_unlock_irqrestore(&imxdma->lock, flags);
+
+ if (desc->desc.callback)
+ desc->desc.callback(desc->desc.callback_param);
+
}
static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
--
1.8.4.rc3
next prev parent reply other threads:[~2013-09-17 13:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-17 13:56 [[PATCH] 0/3] imx-dma: fixes Michael Grzeschik
2013-09-17 13:56 ` [[PATCH] 1/3] dma: imx-dma: fix slow path issue in prep_dma_cyclic Michael Grzeschik
2013-09-17 13:56 ` [[PATCH] 2/3] dma: imx-dma: fix lockdep issue between irqhandler and tasklet Michael Grzeschik
2013-09-17 13:56 ` Michael Grzeschik [this message]
2013-09-23 4:19 ` [[PATCH] 0/3] imx-dma: fixes Vinod Koul
2013-09-24 6:35 ` Christoph Fritz
2013-09-28 23:56 ` Michael Grzeschik
2013-10-03 15:06 ` Vinod Koul
2013-10-03 15:13 ` Vinod Koul
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=1379426168-31989-4-git-send-email-m.grzeschik@pengutronix.de \
--to=m.grzeschik@pengutronix.de \
--cc=dan.j.williams@intel.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®