Thread (2 messages) flat view 2 messages, 2 authors, 7d ago

Re: [PATCHv2] ata: sata_dwc_460ex: fix data race on hsdev->sactive_issued in interrupt handler

From: Niklas Cassel <cassel@kernel.org>
Date: 2026-09-09 10:26:56
Also in: lkml

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help