2022-07-28 09:34:27

by Johan Hovold

[permalink] [raw]
Subject: Re: [PATCH] irqdomain: Fix mapping-creation race

On Thu, Jul 28, 2022 at 11:27:10AM +0200, Johan Hovold wrote:
> 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.
>
> Add a serialising mapping mutex so that looking for an existing mapping
> before creating a new one is done atomically.
>
> Note that serialising the lookup and creation in
> irq_create_mapping_affinity() would have been enough to prevent the
> duplicate mapping, but that could instead cause
> irq_create_fwspec_mapping() to fail when there is a race.
>
> Fixes: 765230b5f084 ("driver-core: add asynchronous probing support for drivers")
> Fixes: b62b2cf5759b ("irqdomain: Fix handling of type settings for existing mappings")
> Cc: Dmitry Torokhov <[email protected]>
> Cc: Jon Hunter <[email protected]>
> Signed-off-by: Johan Hovold <[email protected]>

Here's some more background on how I ran into this:

Link: https://lore.kernel.org/r/[email protected]

Johan