diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-28 14:13:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-28 14:13:08 -0500 |
commit | b1aad6824a9b7a1c747cfd97bbf195030456f708 (patch) | |
tree | ee3282fa75cdf67c45ef8dcb8c5135b15faa48f9 | |
parent | e04d368f47d1ae84a498f659a13720ee83e9f2f9 (diff) | |
parent | af1da686843750809738c01e153320106e890804 (diff) |
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
-rw-r--r-- | lib/dma-debug.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 1b34d210452c..7f5cdc1e6b29 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -1491,12 +1491,12 @@ void debug_dma_alloc_coherent(struct device *dev, size_t size, | |||
1491 | if (unlikely(virt == NULL)) | 1491 | if (unlikely(virt == NULL)) |
1492 | return; | 1492 | return; |
1493 | 1493 | ||
1494 | entry = dma_entry_alloc(); | 1494 | /* handle vmalloc and linear addresses */ |
1495 | if (!entry) | 1495 | if (!is_vmalloc_addr(virt) && !virt_addr_valid(virt)) |
1496 | return; | 1496 | return; |
1497 | 1497 | ||
1498 | /* handle vmalloc and linear addresses */ | 1498 | entry = dma_entry_alloc(); |
1499 | if (!is_vmalloc_addr(virt) && !virt_to_page(virt)) | 1499 | if (!entry) |
1500 | return; | 1500 | return; |
1501 | 1501 | ||
1502 | entry->type = dma_debug_coherent; | 1502 | entry->type = dma_debug_coherent; |
@@ -1528,7 +1528,7 @@ void debug_dma_free_coherent(struct device *dev, size_t size, | |||
1528 | }; | 1528 | }; |
1529 | 1529 | ||
1530 | /* handle vmalloc and linear addresses */ | 1530 | /* handle vmalloc and linear addresses */ |
1531 | if (!is_vmalloc_addr(virt) && !virt_to_page(virt)) | 1531 | if (!is_vmalloc_addr(virt) && !virt_addr_valid(virt)) |
1532 | return; | 1532 | return; |
1533 | 1533 | ||
1534 | if (is_vmalloc_addr(virt)) | 1534 | if (is_vmalloc_addr(virt)) |