Commit b2311a28 authored by Jeff Skirvin's avatar Jeff Skirvin Committed by James Bottomley

[SCSI] libsas: sas_rediscover_dev did not look at the SMP exec status.

The discovery function "sas_rediscover_dev" had two bugs: 1) it did
not pay attention to the return status from the SMP task execution;
2) the stack variable used for the returned SAS address was compared
against 0 without being initialized.
Signed-off-by: default avatarJeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 4e646ddd
...@@ -2005,6 +2005,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) ...@@ -2005,6 +2005,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)
u8 sas_addr[8]; u8 sas_addr[8];
int res; int res;
memset(sas_addr, 0, 8);
res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type); res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type);
switch (res) { switch (res) {
case SMP_RESP_NO_PHY: case SMP_RESP_NO_PHY:
...@@ -2017,9 +2018,13 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) ...@@ -2017,9 +2018,13 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)
return res; return res;
case SMP_RESP_FUNC_ACC: case SMP_RESP_FUNC_ACC:
break; break;
case -ECOMM:
break;
default:
return res;
} }
if (SAS_ADDR(sas_addr) == 0) { if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) {
phy->phy_state = PHY_EMPTY; phy->phy_state = PHY_EMPTY;
sas_unregister_devs_sas_addr(dev, phy_id, last); sas_unregister_devs_sas_addr(dev, phy_id, last);
return res; return res;
......
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