Release DMA Memory

Chetan Nanda chetannanda at gmail.com
Mon Mar 10 23:00:25 EDT 2014


On Mar 11, 2014 7:57 AM, "Matt Davis" <mattdavis9 at gmail.com> wrote:
>
> I have a kernel module that communicates to a PCI device via DMA.  The
> module allocates the shared memory using dma_alloc_coherent().  When
> the module is unloaded, a call to dma_free_coherent() is executed.
>
> My question is, since the DMA memory is not explicitly zeroed before
> deallocation, is there a chance that the PCI device could still read
> (non-zeroed data) and act upon the DMA memory after the module unloads
> and calls dma_free_coherent()?
>
Ideally you should stop the device before freeing the memory.
If device is allowed to run and access the memory after memory is free this
may leads to memory coruption that would be hard to debug.

> Thanks!
>
> -Matt
>
>
-Chetan _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140311/9e53e113/attachment.html 


More information about the Kernelnewbies mailing list