Re: [PATCH 20/39] irqdomain: Protect the linear revmap with RCU

From: Thomas Gleixner
Date: Sat Jun 19 2021 - 07:37:40 EST


On Thu, May 20 2021 at 17:37, Marc Zyngier wrote:
> static void irq_domain_clear_mapping(struct irq_domain *domain,
> @@ -902,12 +901,12 @@ unsigned int irq_find_mapping(struct irq_domain *domain,
> return 0;
> }
>
> + rcu_read_lock();
> /* Check if the hwirq is in the linear revmap. */
> if (hwirq < domain->revmap_size)
> - return domain->revmap[hwirq]->irq;
> -
> - rcu_read_lock();
> - data = radix_tree_lookup(&domain->revmap_tree, hwirq);
> + data = rcu_dereference(domain->revmap[hwirq]);
> + else
> + data = radix_tree_lookup(&domain->revmap_tree, hwirq);
> rcu_read_unlock();
> return data ? data->irq : 0;

This is wrong and was wrong before. This wants to be:

irq = data ? data->irq : 0;
rcu_read_unlock();
return irq;

Thanks,

tglx