]> git.baikalelectronics.ru Git - kernel.git/commit
dma-debug: fix memory leak in debug_dma_alloc_coherent
authorMiles Chen <miles.chen@mediatek.com>
Thu, 22 Feb 2018 11:22:20 +0000 (19:22 +0800)
committerChristoph Hellwig <hch@lst.de>
Thu, 22 Feb 2018 23:02:33 +0000 (15:02 -0800)
commite180e96805c9cd088c17fbd13ee638411f6557db
treeed3a996f8f9dce16a0ba24b015a1e16bea5920c1
parent57c361ccfc527277bba0c5348d82d2d689b467a3
dma-debug: fix memory leak in debug_dma_alloc_coherent

Marty reported a memory leakage introduced by commit 843c9d90ae64
("lib/dma-debug.c: fix incorrect pfn calculation"). Fix it
by checking the virtual address before allocating the entry.

This patch also use virt_addr_valid() instead of virt_to_page()
to check if a virtual address is linear.

Fixes: 843c9d90 ("lib/dma-debug.c: fix incorrect pfn calculation")
Reported-by: Marty Faltesek <mfaltesek@google.com>
Signed-off-by: Miles Chen <miles.chen@mediatek.com>
Acked-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
lib/dma-debug.c