scsi: mvsas: Add spin_lock/unlock() to protect asd_sas_port->phy_list
phy_list_lock is not held when using asd_sas_port->phy_list in the mvsas driver. Add spin_lock/unlock in those places. Link: https://lore.kernel.org/r/1639999298-244569-7-git-send-email-chenxiang66@hisilicon.com Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
29e2bac874
commit
133b688b2d
@ -67,8 +67,10 @@ static struct mvs_info *mvs_find_dev_mvi(struct domain_device *dev)
|
||||
|
||||
while (sha->sas_port[i]) {
|
||||
if (sha->sas_port[i] == dev->port) {
|
||||
spin_lock(&sha->sas_port[i]->phy_list_lock);
|
||||
phy = container_of(sha->sas_port[i]->phy_list.next,
|
||||
struct asd_sas_phy, port_phy_el);
|
||||
spin_unlock(&sha->sas_port[i]->phy_list_lock);
|
||||
j = 0;
|
||||
while (sha->sas_phy[j]) {
|
||||
if (sha->sas_phy[j] == phy)
|
||||
@ -96,6 +98,8 @@ static int mvs_find_dev_phyno(struct domain_device *dev, int *phyno)
|
||||
while (sha->sas_port[i]) {
|
||||
if (sha->sas_port[i] == dev->port) {
|
||||
struct asd_sas_phy *phy;
|
||||
|
||||
spin_lock(&sha->sas_port[i]->phy_list_lock);
|
||||
list_for_each_entry(phy,
|
||||
&sha->sas_port[i]->phy_list, port_phy_el) {
|
||||
j = 0;
|
||||
@ -109,6 +113,7 @@ static int mvs_find_dev_phyno(struct domain_device *dev, int *phyno)
|
||||
num++;
|
||||
n++;
|
||||
}
|
||||
spin_unlock(&sha->sas_port[i]->phy_list_lock);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
|
Loading…
Reference in New Issue
Block a user