Re: [PATCHv2] ata: sata_dwc_460ex: fix data race on hsdev->sactive_issued in interrupt handler
From: Niklas Cassel
Date: Wed Sep 09 2026 - 06:34:32 EST
On Tue, Sep 08, 2026 at 02:42:12PM -0700, Rosen Penev wrote:
> hsdev->sactive_issued is written locklessly in sata_dwc_isr() before
> acquiring host->lock, while sata_dwc_qc_complete() performs a
> read-modify-write on the same field under the lock. This creates a
> data race that can corrupt NCQ tag tracking state.
>
> Move the zero assignment inside the critical section so all accesses
> to sactive_issued are serialized by host->lock.
>
> Fixes: 2d20da00c324b ("ata: sata_dwc_460ex: get rid of global data")
Fixes tag seems wrong.
Commit in fixes did:
- host_pvt.sata_dwc_sactive_issued = 0;
+ hsdev->sactive_issued = 0;
spin_lock_irqsave(&host->lock, flags);
ie. it simply did a rename, so sactive_issued was assigned to zero before
taking the lock, both before and after the commit in Fixes:.
Kind regards,
Niklas