The patch titled Subject: dmapool: make DMAPOOL_DEBUG detect corruption of free marker has been added to the -mm tree. Its filename is dmapool-make-dmapool_debug-detect-corruption-of-free-marker.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Matthieu CASTET <matthieu.castet@xxxxxxxxxx> Subject: dmapool: make DMAPOOL_DEBUG detect corruption of free marker This can help to catch the case where hardware is writing after dma free. Signed-off-by: Matthieu Castet <matthieu.castet@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/dmapool.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff -puN mm/dmapool.c~dmapool-make-dmapool_debug-detect-corruption-of-free-marker mm/dmapool.c --- a/mm/dmapool.c~dmapool-make-dmapool_debug-detect-corruption-of-free-marker +++ a/mm/dmapool.c @@ -346,6 +346,29 @@ void *dma_pool_alloc(struct dma_pool *po retval = offset + page->vaddr; *handle = offset + page->dma; #ifdef DMAPOOL_DEBUG + { + int i; + u8 *data = retval; + /* page->offset is stored in first 4 bytes */ + for (i = sizeof(int); i < pool->size; i++) { + if (data[i] != POOL_POISON_FREED) { + if (pool->dev) + dev_err(pool->dev, + "dma_pool_alloc %s, %p (corruped)\n", + pool->name, retval); + else + printk(KERN_ERR + "dma_pool_alloc %s, %p (corruped)\n", + pool->name, retval); + + /* we dump the first 4 bytes even if there are not + POOL_POISON_FREED */ + print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 16, 1, + data, pool->size, 1); + break; + } + } + } memset(retval, POOL_POISON_ALLOCATED, pool->size); #endif done: _ Patches currently in -mm which might be from matthieu.castet@xxxxxxxxxx are linux-next.patch dmapool-make-dmapool_debug-detect-corruption-of-free-marker.patch dmapool-make-dmapool_debug-detect-corruption-of-free-marker-fix.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html