Skip to contentSkip to conversation

Protect against NULL pointer deref in phyp-dump code.

PATCH In review Tony Breeds 2 participants 2 messages Dec 16, 2008 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 get a deref, add a quick fix to exit early in the NULL pointer case.

---
 arch/powerpc/platforms/pseries/phyp_dump.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/powerpc/platforms/pseries/phyp_dump.c +3 -0
index edbc012..16e659a 100644
@@ -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);
Signature · 7 lines
1.6.0.4


Yours Tony

  linux.conf.au    http://www.marchsouth.org/
  Jan 19 - 24 2009 The Australian Linux Technical Conference!
Acked-by on v1 1/1
#1 lore raw
Quoted 23 lines · Tony Breeds

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 get a deref, add a quick fix to exit early in the NULL pointer case.

---
 arch/powerpc/platforms/pseries/phyp_dump.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/powerpc/platforms/pseries/phyp_dump.c +3 -0
index edbc012..16e659a 100644
@@ -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);
Signature · 6 lines
--
Manish Ahuja
Linux RAS Engineer.
IBM Linux Technology Center
[email protected]
512-838-1928, t/l 678-1928.