]> err.no Git - linux-2.6/commit
dmaengine: fix broken device refcounting
authorHaavard Skinnemoen <hskinnemoen@atmel.com>
Thu, 15 Nov 2007 00:59:27 +0000 (16:59 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 15 Nov 2007 02:45:39 +0000 (18:45 -0800)
commit348badf1e825323c419dd118f65783db0f7d2ec8
tree126cddb26c14233eaff8ddd6a240fe4ac69204ee
parent90d8dabf74179e6615bd4688a118e12ec29ab7aa
dmaengine: fix broken device refcounting

When a DMA device is unregistered, its reference count is decremented twice
for each channel: Once dma_class_dev_release() and once in
dma_chan_cleanup().  This may result in the DMA device driver's remove()
function completing before all channels have been cleaned up, causing lots
of use-after-free fun.

Fix it by incrementing the device's reference count twice for each
channel during registration.

[dan.j.williams@intel.com: kill unnecessary client refcounting]
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/dma/dmaengine.c