linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] ARM: PL330: Don't call the callbacks if there isn't any active transfer
@ 2011-11-02 14:30 Javi Merino
  2011-11-02 14:30 ` [PATCH 2/4] ARM: PL330: Only register usable channels Javi Merino
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Javi Merino @ 2011-11-02 14:30 UTC (permalink / raw)
  To: linux-arm-kernel

If there are no transactions running it is not only wrong but
potentially dangerous to call the callbacks. There can be a stale
struct pl330_req pointer from a previous run, but the memory may be free
already. This patch fixes this, and the callbacks are only called if
there were active transfers when pl330_release_channel() is called.

Signed-off-by: Javi Merino <javi.merino@arm.com>
Cc: Jassi Brar <jassi.brar@samsung.com>
---
 arch/arm/common/pl330.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/common/pl330.c b/arch/arm/common/pl330.c
index 7129cfb..842bab0 100644
--- a/arch/arm/common/pl330.c
+++ b/arch/arm/common/pl330.c
@@ -1691,8 +1691,10 @@ void pl330_release_channel(void *ch_id)
 
 	_stop(thrd);
 
-	_callback(thrd->req[1 - thrd->lstenq].r, PL330_ERR_ABORT);
-	_callback(thrd->req[thrd->lstenq].r, PL330_ERR_ABORT);
+	if (!IS_FREE(&thrd->req[1 - thrd->lstenq]))
+		_callback(thrd->req[1 - thrd->lstenq].r, PL330_ERR_ABORT);
+	if (!IS_FREE(&thrd->req[thrd->lstenq]))
+		_callback(thrd->req[thrd->lstenq].r, PL330_ERR_ABORT);
 
 	pl330 = thrd->dmac;
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-11-23  9:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-02 14:30 [PATCH 1/4] ARM: PL330: Don't call the callbacks if there isn't any active transfer Javi Merino
2011-11-02 14:30 ` [PATCH 2/4] ARM: PL330: Only register usable channels Javi Merino
2011-11-15  8:48   ` Jassi Brar
2011-11-02 14:30 ` [PATCH 3/4] ARM: PL330: Fix the size of the dst_cache_ctrl field Javi Merino
2011-11-15  9:09   ` Jassi Brar
2011-11-02 14:30 ` [PATCH 4/4] ARM: PL330: Fix typo in _prepare_ccr() Javi Merino
2011-11-15  9:11   ` Jassi Brar
2011-11-15  7:51 ` [PATCH 1/4] ARM: PL330: Don't call the callbacks if there isn't any active transfer Jassi Brar
2011-11-15 15:51   ` Javi Merino
2011-11-15 17:00     ` Jassi Brar
2011-11-16  6:24       ` Jassi Brar
2011-11-22 17:16         ` Javi Merino
2011-11-23  9:46           ` Javi Merino

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).