Re: [PATCH] mm: dmapool: fix possible use after free in dmam_pool_destroy()

From: Rolf Eike Beer
Date: Thu Jun 02 2011 - 08:14:30 EST


Maxin B John wrote:
> "dma_pool_destroy(pool)" calls "kfree(pool)". The freed pointer "pool"
> is again passed as an argument to the function "devres_destroy()".
> This patch fixes the possible use after free.
>
> Please let me know your comments.

The pool itself is not used there, only the address where the pool has been.
This will only lead to any trouble if something else is allocated to the same
place and inserted into the devres list of the same device between the
dma_pool_destroy() and devres_destroy().

But I agree that this is bad style. But if you are going to change this please
also have a look at devm_iounmap() in lib/devres.c. Maybe also the devm_*irq*
functions need the same changes.

Eike

Attachment: signature.asc
Description: This is a digitally signed message part.