Skip to content

Commit

Permalink
irqdomain: Add missing NULL pointer check in irq_domain_create_hierar…
Browse files Browse the repository at this point in the history
…chy()

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: 9dbb8e3 ("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
  • Loading branch information
Juergen Gross authored and Thomas Gleixner committed Feb 23, 2023
1 parent 5931e4e commit ad32ab9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/irq/irqdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,8 @@ struct irq_domain *irq_domain_create_hierarchy(struct irq_domain *parent,
domain = __irq_domain_create(fwnode, 0, ~0, 0, ops, host_data);

if (domain) {
domain->root = parent->root;
if (parent)
domain->root = parent->root;
domain->parent = parent;
domain->flags |= flags;

Expand Down

0 comments on commit ad32ab9

Please sign in to comment.