[PATCH] coresight: tpda: fix race between refcnt check and register access

Suzuki K Poulose suzuki.poulose at arm.com
Mon Nov 9 03:23:53 PST 2026


On Wed, 08 Apr 2026 21:23:44 +0800, Jie Gan wrote:
> Several sysfs show/store handlers check csdev->refcnt before acquiring
> the spinlock, then access hardware registers inside the lock.  This is
> a race: between the check and the lock acquisition, the following can
> occur on another CPU:
> 
>   CPU 0 (sysfs reader)              CPU 1 (disable path)
>   ─────────────────────────────     ──────────────────────────────────
>   refcnt == 1, check passes
>   [waiting for spinlock]            tpda_disable(): refcnt → 0
>                                     debug clock disabled
>   spinlock acquired
>   readl_relaxed()  ← FAULT/hang
> 
> [...]

Applied, thanks!

[1/1] coresight: tpda: fix race between refcnt check and register access
      https://git.kernel.org/coresight/c/4f5f1e5ae120

Best regards,
-- 
Suzuki K Poulose <suzuki.poulose at arm.com>



More information about the linux-arm-kernel mailing list