Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Jeff Skirvin and committed by
James Bottomley
b2311a28 4e646ddd

+6 -1
+6 -1
drivers/scsi/libsas/sas_expander.c
··· 2005 2005 u8 sas_addr[8]; 2006 2006 int res; 2007 2007 2008 + memset(sas_addr, 0, 8); 2008 2009 res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type); 2009 2010 switch (res) { 2010 2011 case SMP_RESP_NO_PHY: ··· 2018 2017 return res; 2019 2018 case SMP_RESP_FUNC_ACC: 2020 2019 break; 2020 + case -ECOMM: 2021 + break; 2022 + default: 2023 + return res; 2021 2024 } 2022 2025 2023 - if (SAS_ADDR(sas_addr) == 0) { 2026 + if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) { 2024 2027 phy->phy_state = PHY_EMPTY; 2025 2028 sas_unregister_devs_sas_addr(dev, phy_id, last); 2026 2029 return res;