summaryrefslogtreecommitdiff
path: root/mm/cma.h
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2020-07-10 03:42:44 +0300
committerDavid S. Miller <davem@davemloft.net>2020-07-10 23:54:00 +0300
commita2b992c828f7651db369ba8f0eb0818d70232636 (patch)
treef66e1c6eeb40d7acf38ad802e80df4efdde2e2f3 /mm/cma.h
parent8fb49c0109f47e4a25e8ba36abd8381afbfa7a08 (diff)
downloadlinux-a2b992c828f7651db369ba8f0eb0818d70232636.tar.xz
debugfs: make sure we can remove u32_array files cleanly
debugfs_create_u32_array() allocates a small structure to wrap the data and size information about the array. If users ever try to remove the file this leads to a leak since nothing ever frees this wrapper. That said there are no upstream users of debugfs_create_u32_array() that'd remove a u32 array file (we only have one u32 array user in CMA), so there is no real bug here. Make callers pass a wrapper they allocated. This way the lifetime management of the wrapper is on the caller, and we can avoid the potential leak in debugfs. CC: Chucheng Luo <luochucheng@vivo.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'mm/cma.h')
-rw-r--r--mm/cma.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/cma.h b/mm/cma.h
index 33c0b517733c..6698fa63279b 100644
--- a/mm/cma.h
+++ b/mm/cma.h
@@ -2,6 +2,8 @@
#ifndef __MM_CMA_H__
#define __MM_CMA_H__
+#include <linux/debugfs.h>
+
struct cma {
unsigned long base_pfn;
unsigned long count;
@@ -11,6 +13,7 @@ struct cma {
#ifdef CONFIG_CMA_DEBUGFS
struct hlist_head mem_head;
spinlock_t mem_head_lock;
+ struct debugfs_u32_array dfs_bitmap;
#endif
const char *name;
};