diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-03-04 16:06:03 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-03-04 16:06:03 -0700 |
commit | 7cbd4877e5b167b56a3d6033b926a9f925186e12 (patch) | |
tree | 03dbe000fa5086d07df0fcae8d9ac1534bd3d239 /drivers/dma/dmatest.c | |
parent | c74ef1f867d18171c8617519ee5fe40b02903934 (diff) |
dmatest: fix use after free in dmatest_exit
dmatest_cleanup_chanel will free dtc, so grab ->chan before it goes away
and use it to do the release.
Reported-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/dmatest.c')
-rw-r--r-- | drivers/dma/dmatest.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index 732fa1ec36ab..e190d8b30700 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -430,13 +430,15 @@ late_initcall(dmatest_init); static void __exit dmatest_exit(void) { struct dmatest_chan *dtc, *_dtc; + struct dma_chan *chan; list_for_each_entry_safe(dtc, _dtc, &dmatest_channels, node) { list_del(&dtc->node); + chan = dtc->chan; dmatest_cleanup_channel(dtc); pr_debug("dmatest: dropped channel %s\n", - dma_chan_name(dtc->chan)); - dma_release_channel(dtc->chan); + dma_chan_name(chan)); + dma_release_channel(chan); } } module_exit(dmatest_exit); |