[PATCH 10/11] android: staging: ram_console: fix crash in ram_console_late_init

From: John Stultz
Date: Wed Mar 07 2012 - 20:35:03 EST


From: Colin Cross <ccross@xxxxxxxxxxx>

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: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
CC: Android Kernel Team <kernel-team@xxxxxxxxxxx>
Signed-off-by: Colin Cross <ccross@xxxxxxxxxxx>
Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
---
drivers/staging/android/ram_console.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/android/ram_console.c b/drivers/staging/android/ram_console.c
index 29d347e..d956b84 100644
--- a/drivers/staging/android/ram_console.c
+++ b/drivers/staging/android/ram_console.c
@@ -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;

--
1.7.3.2.146.gca209

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/