scsi: hisi_sas: Fix some issues related to asd_sas_port->phy_list
authorXiang Chen <chenxiang66@hisilicon.com>
Mon, 20 Dec 2021 11:21:28 +0000 (19:21 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 23 Dec 2021 04:38:29 +0000 (23:38 -0500)
commit29e2bac87421c613782ccb510c76c5efbecac0cf
tree0fa6ec11ca12251c3c10aa2ec4395b00ac02b32e
parent42159d3c8d879e8d5fc225733f0cedc8baf19002
scsi: hisi_sas: Fix some issues related to asd_sas_port->phy_list

Most places that use asd_sas_port->phy_list are protected by spinlock
asd_sas_port->phy_list_lock, however there are still some places which miss
grabbing the lock. Add it in function hisi_sas_refresh_port_id() when
accessing asd_sas_port->phy_list. This carries a risk that list mutates
while at the same time dropping the lock in function
hisi_sas_send_ata_reset_each_phy(). Read asd_sas_port->phy_mask instead of
accessing asd_sas_port->phy_list to avoid this risk.

Link: https://lore.kernel.org/r/1639999298-244569-6-git-send-email-chenxiang66@hisilicon.com
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas_main.c