Re: [PATCH] gpio: mpsse: fix race when arming the IRQ poll worker
From: Fan Wu
Date: Wed Sep 23 2026 - 06:35:54 EST
> On Sep 23, 2026, at 16:15, Bartosz Golaszewski <brgl@xxxxxxxxxx> wrote:
>
> I probably wouldn't have noticed but Sashiko found an issue on PREEMPT_RT
> kernels[1].
>
> Bart
>
> [1] https://sashiko.dev/#/patchset/20260923030855.410109-1-fanwu01%40zju.edu.cn?part=1
Hi Bart,
You're right, thank you for catching this.
The new kfree() is called while holding priv->irq_spin. More importantly,
moving it just after that scoped guard would not be sufficient: irq_enable()
is invoked with the IRQ descriptor raw spinlock held by the IRQ core.
Thus, a normal kfree() cannot be used on this path on PREEMPT_RT. The
worker must instead be disposed of from a safe context, while keeping its
list publication and schedule_work() together under irq_spin so that the
disconnect race is not reintroduced.
I will rework the cleanup path accordingly and also recheck the pre-existing
GFP_NOWAIT allocation in this irqchip callback for PREEMPT_RT constraints.
Thanks,
Fan