diff options
author | Jeff Skirvin <jeffrey.d.skirvin@intel.com> | 2012-06-22 02:36:10 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-07-20 03:58:52 -0400 |
commit | b2311a287553af4dffaef224cdd6e3ddf6783312 (patch) | |
tree | 406014158dd9f511e3f59de053f8ac4fe2e93394 /drivers/scsi/libsas | |
parent | 4e646ddd5faf707602dcb4b491412b72180da3b3 (diff) |
[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: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/libsas')
-rw-r--r-- | drivers/scsi/libsas/sas_expander.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index caa0525d2523..af659cc8308c 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -2005,6 +2005,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) | |||
2005 | u8 sas_addr[8]; | 2005 | u8 sas_addr[8]; |
2006 | int res; | 2006 | int res; |
2007 | 2007 | ||
2008 | memset(sas_addr, 0, 8); | ||
2008 | res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type); | 2009 | res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type); |
2009 | switch (res) { | 2010 | switch (res) { |
2010 | case SMP_RESP_NO_PHY: | 2011 | case SMP_RESP_NO_PHY: |
@@ -2017,9 +2018,13 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) | |||
2017 | return res; | 2018 | return res; |
2018 | case SMP_RESP_FUNC_ACC: | 2019 | case SMP_RESP_FUNC_ACC: |
2019 | break; | 2020 | break; |
2021 | case -ECOMM: | ||
2022 | break; | ||
2023 | default: | ||
2024 | return res; | ||
2020 | } | 2025 | } |
2021 | 2026 | ||
2022 | if (SAS_ADDR(sas_addr) == 0) { | 2027 | if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) { |
2023 | phy->phy_state = PHY_EMPTY; | 2028 | phy->phy_state = PHY_EMPTY; |
2024 | sas_unregister_devs_sas_addr(dev, phy_id, last); | 2029 | sas_unregister_devs_sas_addr(dev, phy_id, last); |
2025 | return res; | 2030 | return res; |