Commit b1aad682 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'dma-mapping-4.16-3' of git://git.infradead.org/users/hch/dma-mapping

Pull dma-mapping fix from Christoph Hellwig:
 "A single fix for a memory leak regression in the dma-debug code"

* tag 'dma-mapping-4.16-3' of git://git.infradead.org/users/hch/dma-mapping:
  dma-debug: fix memory leak in debug_dma_alloc_coherent
parents e04d368f af1da686
...@@ -1491,12 +1491,12 @@ void debug_dma_alloc_coherent(struct device *dev, size_t size, ...@@ -1491,12 +1491,12 @@ void debug_dma_alloc_coherent(struct device *dev, size_t size,
if (unlikely(virt == NULL)) if (unlikely(virt == NULL))
return; return;
entry = dma_entry_alloc(); /* handle vmalloc and linear addresses */
if (!entry) if (!is_vmalloc_addr(virt) && !virt_addr_valid(virt))
return; return;
/* handle vmalloc and linear addresses */ entry = dma_entry_alloc();
if (!is_vmalloc_addr(virt) && !virt_to_page(virt)) if (!entry)
return; return;
entry->type = dma_debug_coherent; entry->type = dma_debug_coherent;
...@@ -1528,7 +1528,7 @@ void debug_dma_free_coherent(struct device *dev, size_t size, ...@@ -1528,7 +1528,7 @@ void debug_dma_free_coherent(struct device *dev, size_t size,
}; };
/* handle vmalloc and linear addresses */ /* handle vmalloc and linear addresses */
if (!is_vmalloc_addr(virt) && !virt_to_page(virt)) if (!is_vmalloc_addr(virt) && !virt_addr_valid(virt))
return; return;
if (is_vmalloc_addr(virt)) if (is_vmalloc_addr(virt))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment