]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - mm/cma.h
debugfs: make sure we can remove u32_array files cleanly
authorJakub Kicinski <kuba@kernel.org>
Fri, 10 Jul 2020 00:42:44 +0000 (17:42 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 10 Jul 2020 20:54:00 +0000 (13:54 -0700)
commita2b992c828f7651db369ba8f0eb0818d70232636
treef66e1c6eeb40d7acf38ad802e80df4efdde2e2f3
parent8fb49c0109f47e4a25e8ba36abd8381afbfa7a08
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>
Documentation/filesystems/debugfs.rst
fs/debugfs/file.c
include/linux/debugfs.h
mm/cma.h
mm/cma_debug.c