staging: android: ram_console: fix crash in ram_console_late_init
authorColin Cross <ccross@android.com>
Thu, 8 Mar 2012 01:34:37 +0000 (17:34 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Mar 2012 17:37:09 +0000 (09:37 -0800)
If the persistent ram buffer is not available, ram_console_late_init
would crash when dereferencing ram_console_zone.  Return early if
ram console was not initialized.

CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ram_console.c

index 29d347e802ed8c78638f87eeaeb42bddbb65de07..d956b8441442ada2d00c9a78eb1cf14dce0b5449 100644 (file)
@@ -150,6 +150,9 @@ static int __init ram_console_late_init(void)
        struct proc_dir_entry *entry;
        struct persistent_ram_zone *prz = ram_console_zone;
 
+       if (!prz)
+               return 0;
+
        if (persistent_ram_old_size(prz) == 0)
                return 0;