Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Nov 2011 20:11:19 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r227031 - projects/pseries/powerpc/ofw
Message-ID:  <201111022011.pA2KBJFu036417@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Wed Nov  2 20:11:19 2011
New Revision: 227031
URL: http://svn.freebsd.org/changeset/base/227031

Log:
  Use the phandle cross-reference tools here and avoid making requests with
  invalid phandles that could crash certain badly-written OF implementations.

Modified:
  projects/pseries/powerpc/ofw/ofw_pcibus.c

Modified: projects/pseries/powerpc/ofw/ofw_pcibus.c
==============================================================================
--- projects/pseries/powerpc/ofw/ofw_pcibus.c	Wed Nov  2 19:35:31 2011	(r227030)
+++ projects/pseries/powerpc/ofw/ofw_pcibus.c	Wed Nov  2 20:11:19 2011	(r227031)
@@ -213,11 +213,13 @@ ofw_pcibus_enum_devtree(device_t dev, u_
 				icells = 1;
 				OF_getprop(child, "interrupt-parent", &iparent,
 				    sizeof(iparent));
-				OF_getprop(iparent, "#interrupt-cells", &icells,
-				    sizeof(icells));
+				iparent = OF_xref_phandle(iparent);
 
-				if (iparent != 0)
+				if (iparent != 0) {
+					OF_getprop(iparent, "#interrupt-cells",
+					    &icells, sizeof(icells));
 					intr[0] = MAP_IRQ(iparent, intr[0]);
+				}
 
 				if (iparent != 0 && icells > 1) {
 					powerpc_config_intr(intr[0],
@@ -344,6 +346,8 @@ ofw_pcibus_assign_interrupt(device_t dev
 	iparent = -1;
 	if (OF_getprop(node, "interrupt-parent", &iparent, sizeof(iparent)) < 0)
 		iparent = -1;
+	else
+		iparent = OF_xref_phandle(iparent);
 	
 	/*
 	 * Any AAPL,interrupts property gets priority and is



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111022011.pA2KBJFu036417>