Commit 6c6ac8b7 authored by John Garry's avatar John Garry Committed by Martin K. Petersen

scsi: hisi_sas: Fix memory ordering in hisi_sas_task_deliver()

The memories for the slot should be observed to be written prior to
observing the slot as ready.

Prior to commit 26fc0ea7 ("scsi: libsas: Drop SAS_TASK_AT_INITIATOR"),
we had a spin_lock() + spin_unlock() immediately before marking the slot as
ready. The spin_unlock() - with release semantics - caused the slot memory
to be observed to be written.

Now that the spin_lock() + spin_unlock() is gone, use a smp_wmb().

Link: https://lore.kernel.org/r/1652774661-12935-1-git-send-email-john.garry@huawei.com
Fixes: 26fc0ea7 ("scsi: libsas: Drop SAS_TASK_AT_INITIATOR")
Reported-by: default avatarYihang Li <liyihang6@hisilicon.com>
Tested-by: default avatarYihang Li <liyihang6@hisilicon.com>
Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b559b99a
......@@ -446,6 +446,8 @@ void hisi_sas_task_deliver(struct hisi_hba *hisi_hba,
return;
}
/* Make slot memories observable before marking as ready */
smp_wmb();
WRITE_ONCE(slot->ready, 1);
spin_lock(&dq->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment