]> git.baikalelectronics.ru Git - kernel.git/commitdiff
fs/file_table: fix adding missing kmemleak_not_leak()
authorLuis Chamberlain <mcgrof@kernel.org>
Tue, 15 Feb 2022 02:08:28 +0000 (18:08 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 17 Feb 2022 18:23:19 +0000 (10:23 -0800)
Commit bd6ea65287c7 ("Fix regression due to "fs: move binfmt_misc sysctl
to its own file") fixed a regression, however it failed to add a
kmemleak_not_leak().

Fixes: bd6ea65287c7 ("Fix regression due to "fs: move binfmt_misc sysctl to its own file")
Reported-by: Tong Zhang <ztong0001@gmail.com>
Cc: Tong Zhang <ztong0001@gmail.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/file_table.c

index 4969021fa6764b3872016a63bac195ff46e6a9d5..7d2e692b66a94fcfc609747802517e27489b8a0c 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/task_work.h>
 #include <linux/ima.h>
 #include <linux/swap.h>
+#include <linux/kmemleak.h>
 
 #include <linux/atomic.h>
 
@@ -119,8 +120,11 @@ static struct ctl_table fs_stat_sysctls[] = {
 static int __init init_fs_stat_sysctls(void)
 {
        register_sysctl_init("fs", fs_stat_sysctls);
-       if (IS_ENABLED(CONFIG_BINFMT_MISC))
-               register_sysctl_mount_point("fs/binfmt_misc");
+       if (IS_ENABLED(CONFIG_BINFMT_MISC)) {
+               struct ctl_table_header *hdr;
+               hdr = register_sysctl_mount_point("fs/binfmt_misc");
+               kmemleak_not_leak(hdr);
+       }
        return 0;
 }
 fs_initcall(init_fs_stat_sysctls);