[PATCH v2 0/4] irqdomain: Fix mapping-creation race

From: Johan Hovold
Date: Thu Sep 01 2022 - 10:29:07 EST


Parallel probing (e.g. due to asynchronous probing) of devices that
share interrupts can currently result in two mappings for the same
hardware interrupt to be created.

This series adds a serialising mapping mutex so that looking for an
existing mapping before creating a new one is done atomically.

Included are also some related clean ups that remove a redundant lookup
for existing mappings and make the domain-association locking more fine
grained.

Johan


Changes in v2
- split out redundant lookup cleanup (1/4)
- use a per-domain mutex to address mapping race (2/4)
- move kernel-doc to exported function (2/4)
- fix association race (3/4, new)
- use per-domain mutex for associations (4/4, new)


Johan Hovold (4):
irqdomain: Look for existing mapping only once
irqdomain: Fix mapping-creation race
irqdomain: Fix domain-association race
irqdomain: use per-domain mutex for associations

include/linux/irqdomain.h | 2 +
kernel/irq/irqdomain.c | 104 ++++++++++++++++++++++++--------------
2 files changed, 69 insertions(+), 37 deletions(-)

--
2.35.1