irqdomain: Add missing NULL pointer check in irq_domain_create_hierarchy()
authorJuergen Gross <jgross@suse.com>
Thu, 23 Feb 2023 08:38:00 +0000 (09:38 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 23 Feb 2023 14:52:28 +0000 (15:52 +0100)
commitad32ab9604f29827494024828f527228e84fbd2c
tree2c2b3e8cab12298572caed95571b1d067d2956a1
parent5931e4eb55f904a4a221b57ff7d24afc0e463957
irqdomain: Add missing NULL pointer check in irq_domain_create_hierarchy()

The recent switch to per-domain locking caused a NULL dereference in
irq_domain_create_hierarchy(), as Xen code is calling
msi_create_irq_domain() with a NULL parent pointer.

Fix that by testing parent to be set before dereferencing it. For a
non-existing parent the irqdomain's root will stay to point to
itself.

Fixes: 9dbb8e3452ab ("irqdomain: Switch to per-domain locking")
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20230223083800.31347-1-jgross@suse.com
kernel/irq/irqdomain.c