Skip to contentSkip to conversation

dmaengine: Fix oops on dmatest module unload.

PATCH Superseded Thierry Reding 3 participants 6 messages Feb 10, 2009 – Mar 6, 2009 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: Fix oops on dmatest module unload.

This patch fixes an oops that happens when the dmatest module is unloaded. The dma_release_channel() function is called on channels that have already been cleaned up (and therefore freed) with dmatest_cleanup_channel().

---
 drivers/dma/dmatest.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/dmatest.c +1 -1
index 732fa1e..d12219c 100644
@@ -433,10 +433,10 @@ static void __exit dmatest_exit(void)
 
 	list_for_each_entry_safe(dtc, _dtc, &dmatest_channels, node) {
 		list_del(&dtc->node);
+		dma_release_channel(dtc->chan);
 		dmatest_cleanup_channel(dtc);
 		pr_debug("dmatest: dropped channel %s\n",
 			 dma_chan_name(dtc->chan));
-		dma_release_channel(dtc->chan);
 	}
 }
 module_exit(dmatest_exit);
Signature · 1 line
tg: (8e49215..) adx/dma (depends on: adx/master)
#1 lore raw
Quoted 3 lines · Thierry Reding

This patch fixes an oops that happens when the dmatest module is unloaded. The dma_release_channel() function is called on channels that have already been cleaned up (and therefore freed) with dmatest_cleanup_channel().

...

drivers/dma/dmatest.c static void __exit dmatest_exit(void) · line 441

Quoted 11 lines
drivers/dma/dmatest.c +1 -1
@@ -433,10 +433,10 @@ static void __exit dmatest_exit(void)
 
 	list_for_each_entry_safe(dtc, _dtc, &dmatest_channels, node) {
 		list_del(&dtc->node);
+		dma_release_channel(dtc->chan);
 		dmatest_cleanup_channel(dtc);
 		pr_debug("dmatest: dropped channel %s\n",
 			 dma_chan_name(dtc->chan));
-		dma_release_channel(dtc->chan);
 	}
 }

Good catch! Please move pr_debug() too.

---
Atsushi Nemoto

#2 lore raw

PATCH v2 1/1 dmaengine: Fix oops on dmatest module unload.

This patch fixes an oops that happens when the dmatest module is unloaded. The dma_release_channel() function is called on channels that have already been cleaned up (and therefore freed) with dmatest_cleanup_channel().

---
 drivers/dma/dmatest.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/dmatest.c +1 -1
index 732fa1e..0fb053e 100644
@@ -433,10 +433,10 @@ static void __exit dmatest_exit(void)
 
 	list_for_each_entry_safe(dtc, _dtc, &dmatest_channels, node) {
 		list_del(&dtc->node);
-		dmatest_cleanup_channel(dtc);
 		pr_debug("dmatest: dropped channel %s\n",
 			 dma_chan_name(dtc->chan));
 		dma_release_channel(dtc->chan);
+		dmatest_cleanup_channel(dtc);
 	}
 }
 module_exit(dmatest_exit);
Signature · 1 line
tg: (8e49215..) adx/dma (depends on: adx/master)
Applied
#3 lore raw
Quoted 5 lines · Thierry Reding

This patch fixes an oops that happens when the dmatest module is unloaded. The dma_release_channel() function is called on channels that have already been cleaned up (and therefore freed) with dmatest_cleanup_channel().

Thanks, applied with Atsushi's ack.

#4 lore raw
Quoted 10 lines · Dan Williams
Quoted 5 lines · Thierry Reding

This patch fixes an oops that happens when the dmatest module is unloaded. The dma_release_channel() function is called on channels that have already been cleaned up (and therefore freed) with dmatest_cleanup_channel().

Thanks, applied with Atsushi's ack.

...and now it is unapplied :-). The problem with this patch is that it releases the channel before dmatest is done with it. 'Cleanup' followed by 'release' is the right order, just need to save ->chan before it gets freed.

--
Dan

#5 lore raw
Quoted 4 lines · Dan Williams

...and now it is unapplied :-). The problem with this patch is that it releases the channel before dmatest is done with it. 'Cleanup' followed by 'release' is the right order, just need to save ->chan before it gets freed.

Oh that's right. I tested your fix in async_tx tree and it works fine. Thanks!

---
Atsushi Nemoto