[v4,01/19] irqdomain: Drop bogus fwspec-mapping error handling

Message ID 20230116135044.14998-2-johan+linaro@kernel.org
State New
Headers
Series irqdomain: fix mapping race and clean up locking |

Commit Message

Johan Hovold Jan. 16, 2023, 1:50 p.m. UTC
  In case a newly allocated IRQ ever ends up not having any associated
struct irq_data it would not even be possible to dispose the mapping.

Replace the bogus disposal with a WARN_ON().

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>
---
 kernel/irq/irqdomain.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
  

Comments

Thomas Gleixner Jan. 17, 2023, 9:17 p.m. UTC | #1
On Mon, Jan 16 2023 at 14:50, Johan Hovold wrote:
> In case a newly allocated IRQ ever ends up not having any associated
> struct irq_data it would not even be possible to dispose the mapping.
>
> Replace the bogus disposal with a WARN_ON().
>

This lacks a Fixes tag especially because this ends up in the dependency
chain of the race fixes.

Fixes: 1e2a7d78499e ("irqdomain: Don't set type when mapping an IRQ")

is not completely precise but close enough.

Thanks,

        tglx
  

Patch

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 8fe1da9614ee..bf67de1733ee 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -833,13 +833,8 @@  unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
 	}
 
 	irq_data = irq_get_irq_data(virq);
-	if (!irq_data) {
-		if (irq_domain_is_hierarchy(domain))
-			irq_domain_free_irqs(virq, 1);
-		else
-			irq_dispose_mapping(virq);
+	if (WARN_ON(!irq_data))
 		return 0;
-	}
 
 	/* Store trigger type */
 	irqd_set_trigger_type(irq_data, type);