aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2021-10-03 11:22:03 +1000
committerVasant Hegde <hegdevasant@linux.vnet.ibm.com>2021-10-19 12:08:19 +0530
commit1f8cc710c830f8642d74f09392dbe106377fa1b1 (patch)
treeb9a02d8661f8fee6e3026137e9e2463eb9847ae9 /core
parentebef02621dedc111c9c75c98971fcb869b492052 (diff)
downloadskiboot-1f8cc710c830f8642d74f09392dbe106377fa1b1.zip
skiboot-1f8cc710c830f8642d74f09392dbe106377fa1b1.tar.gz
skiboot-1f8cc710c830f8642d74f09392dbe106377fa1b1.tar.bz2
interrupts: add_opal_interrupts avoid NULL dereference on P10 mambo
On P10, get_ics_phandle() calls xive2_get_phandle() directly. This results in a NULL dereference on mambo when xive2 is not set up. This was caught with the virtual memory boot patch on P10 mambo. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Diffstat (limited to 'core')
-rw-r--r--core/interrupts.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/interrupts.c b/core/interrupts.c
index 5d2d04d..c39c280 100644
--- a/core/interrupts.c
+++ b/core/interrupts.c
@@ -204,10 +204,15 @@ void add_opal_interrupts(void)
{
struct irq_source *is;
unsigned int i, ns, tns = 0, count = 0;
+ uint32_t parent;
uint32_t isn;
__be32 *irqs = NULL;
char *names = NULL;
+ parent = get_ics_phandle();
+ if (!parent)
+ return;
+
lock(&irq_lock);
list_for_each(&irq_sources, is, link) {
/*
@@ -251,7 +256,7 @@ void add_opal_interrupts(void)
/* First create the standard "interrupts" property and the
* corresponding names property
*/
- dt_add_property_cells(opal_node, "interrupt-parent", get_ics_phandle());
+ dt_add_property_cells(opal_node, "interrupt-parent", parent);
dt_add_property(opal_node, "interrupts", irqs, count * 8);
dt_add_property(opal_node, "opal-interrupts-names", names, tns);
dt_add_property(opal_node, "interrupt-names", names, tns);