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)
        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;
                                num++;
                                n++;
                        }
+                       spin_unlock(&sha->sas_port[i]->phy_list_lock);
                        break;
                }
                i++;