]> git.baikalelectronics.ru Git - kernel.git/commit
irqdomain: Fix association race
authorJohan Hovold <johan+linaro@kernel.org>
Mon, 13 Feb 2023 10:42:43 +0000 (11:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 15:44:02 +0000 (16:44 +0100)
commitd6678bf655ca0a488108a0061bd3aa06c48b5183
treeeb4945d8e88f897e766b43266ea84cfae825f4a4
parent4869103ea4ef49076269b67457100e3231300dfc
irqdomain: Fix association race

commit b06730a571a9ff1ba5bd6b20bf9e50e5a12f1ec6 upstream.

The sanity check for an already mapped virq is done outside of the
irq_domain_mutex-protected section which means that an (unlikely) racing
association may not be detected.

Fix this by factoring out the association implementation, which will
also be used in a follow-on change to fix a shared-interrupt mapping
race.

Fixes: 6b5224a9c711 ("irqdomain: Refactor irq_domain_associate_many()")
Cc: stable@vger.kernel.org # 3.11
Tested-by: Hsin-Yi Wang <hsinyi@chromium.org>
Tested-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230213104302.17307-2-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/irq/irqdomain.c