]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: hisi_sas: Fix memory ordering in hisi_sas_task_deliver()
authorJohn Garry <john.garry@huawei.com>
Tue, 17 May 2022 08:04:21 +0000 (16:04 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 20 May 2022 00:16:26 +0000 (20:16 -0400)
commit1f6b95b90d7511151e3c39864e12af2984a74ed7
tree28fc4dca36f45be30dc008ba376cd93f3e5be83e
parent08739c3b83afd933b373cc4474f1ce16eb506d07
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 f588a2adbfa4 ("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: f588a2adbfa4 ("scsi: libsas: Drop SAS_TASK_AT_INITIATOR")
Reported-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas_main.c