Re: [tip: irq/urgent] irqchip/gic-v3-its: Fix potential race condition in its_vlpi_prop_update()

From: Markus Elfring
Date: Mon Jun 03 2024 - 10:41:21 EST



> [ tglx: Use guard() instead of goto ]

> +++ b/drivers/irqchip/irq-gic-v3-its.c

> @@ -1992,6 +1970,8 @@ static int its_irq_set_vcpu_affinity(struct irq_data *d, void *vcpu_info)
> if (!is_v4(its_dev->its))
> return -EINVAL;
>
> + guard(raw_spinlock_irq, &its_dev->event_map.vlpi_lock);
> +
> /* Unmap request? */
> if (!info)
> return its_vlpi_unmap(d);

I found a similar guard() call in the implementation of the function “task_state_match”.
https://elixir.bootlin.com/linux/v6.10-rc2/source/kernel/sched/core.c#L2264

A slightly different combination of parentheses is applied there.
How do you think about to apply the following code variant accordingly?

+ guard(raw_spinlock_irq)(&its_dev->event_map.vlpi_lock);


Regards,
Markus