kmemleak: Disable early logging when kmemleak is off by default
authorCatalin Marinas <catalin.marinas@arm.com>
Fri, 20 Jan 2012 10:42:40 +0000 (10:42 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 20 Jan 2012 16:57:05 +0000 (16:57 +0000)
Commit b6693005 (kmemleak: When the early log buffer is exceeded, report
the actual number) deferred the disabling of the early logging to
kmemleak_init(). However, when CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y, the
early logging was no longer disabled causing __init kmemleak functions
to be called even after the kernel freed the init memory. This patch
disables the early logging during kmemleak_init() if kmemleak is left
disabled.

Reported-by: Dirk Gouders <gouders@et.bocholt.fh-gelsenkirchen.de>
Tested-by: Dirk Gouders <gouders@et.bocholt.fh-gelsenkirchen.de>
Tested-by: Josh Boyer <jwboyer@gmail.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
mm/kmemleak.c

index f9f7310f0fdbe9872649545addaae530f37f1771..45eb6217bf38e764bfb65d90f29ae2bb46f77886 100644 (file)
@@ -1757,6 +1757,7 @@ void __init kmemleak_init(void)
 
 #ifdef CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF
        if (!kmemleak_skip_disable) {
+               atomic_set(&kmemleak_early_log, 0);
                kmemleak_disable();
                return;
        }