summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiam Mark <lmark@codeaurora.org>2017-02-15 13:52:48 -0800
committerLiam Mark <lmark@codeaurora.org>2017-02-15 14:21:04 -0800
commit6bc22eceecb6629335a5442cbec769a2629428eb (patch)
treeb409817f017e30b18d400d919b3b20442345b699
parent3a7e752617514960c5cecdf84e12b13dc63c04c7 (diff)
drivers: dma-removed: page align size on free
Fix removed ops memory leak which occurs when non-page aligned memory is freed. On free we need to page align the amount of memory being freed otherwise we risk rounding down the size of the allocation to the page boundary which would leak one page. Change-Id: Idabce39cad526eeaf073748edb227b2edd76f40e Signed-off-by: Liam Mark <lmark@codeaurora.org>
-rw-r--r--drivers/base/dma-removed.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/base/dma-removed.c b/drivers/base/dma-removed.c
index 87c743995a50..5fa3c6bdeea0 100644
--- a/drivers/base/dma-removed.c
+++ b/drivers/base/dma-removed.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
* Copyright (C) 2000-2004 Russell King
*
* This program is free software; you can redistribute it and/or modify
@@ -296,6 +296,7 @@ void removed_free(struct device *dev, size_t size, void *cpu_addr,
attrs);
struct removed_region *dma_mem = dev->removed_mem;
+ size = PAGE_ALIGN(size);
if (!no_kernel_mapping)
iounmap(cpu_addr);
mutex_lock(&dma_mem->lock);