powerpc: Protect against NULL pointer deref in phyp-dump code

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Sunday, December 28, 2008 - 6:04 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7a2eab...
Commit:     7a2eab0d4e656341cc0f6481d722d410f0414f0b
Parent:     8168b5400b06353293f9844976435886eb2a8ff2
Author:     Tony Breeds <tony@bakeyournoodle.com>
AuthorDate: Mon Dec 15 18:17:48 2008 +0000
Committer:  Paul Mackerras <paulus@samba.org>
CommitDate: Sun Dec 21 14:21:14 2008 +1100

    powerpc: Protect against NULL pointer deref in phyp-dump code
    
    print_dump_header() will be called at least once with a NULL pointer in
    a normal boot sequence.  If DEBUG is defined then we will dereference
    the pointer and crash.  Add a quick fix to exit early in the NULL pointer
    case.
    
    Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
    Acked-by: Manish Ahuja <mahujam@gmail.com>
    Signed-off-by: Paul Mackerras <paulus@samba.org>
---
 arch/powerpc/platforms/pseries/phyp_dump.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c
index edbc012..16e659a 100644
--- a/arch/powerpc/platforms/pseries/phyp_dump.c
+++ b/arch/powerpc/platforms/pseries/phyp_dump.c
@@ -130,6 +130,9 @@ static unsigned long init_dump_header(struct phyp_dump_header *ph)
 static void print_dump_header(const struct phyp_dump_header *ph)
 {
 #ifdef DEBUG
+	if (ph == NULL)
+		return;
+
 	printk(KERN_INFO "dump header:\n");
 	/* setup some ph->sections required */
 	printk(KERN_INFO "version = %d\n", ph->version);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
powerpc: Protect against NULL pointer deref in phyp-dump code, Linux Kernel Mailing ..., (Sun Dec 28, 6:04 pm)