Commit 7d1d865181185bdf1316d236b1b4bd02c9020729
Committed by
James Bottomley
1 parent
b202445925
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
[SCSI] libsas: fix false positive 'device attached' conditions
Normalize phy->attached_sas_addr to return a zero-address in the case when device-type == NO_DEVICE or the linkrate is invalid to handle expanders that put non-zero sas addresses in the discovery response: sas: ex 5001b4da000f903f phy02:U:0 attached: 0100000000000000 (no device) sas: ex 5001b4da000f903f phy01:U:0 attached: 0100000000000000 (no device) sas: ex 5001b4da000f903f phy03:U:0 attached: 0100000000000000 (no device) sas: ex 5001b4da000f903f phy00:U:0 attached: 0100000000000000 (no device) Reported-by: Andrzej Jakowski <andrzej.jakowski@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Cc: stable@vger.kernel.org Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Showing 1 changed file with 8 additions and 1 deletions Side-by-side Diff
drivers/scsi/libsas/sas_expander.c
... | ... | @@ -245,7 +245,14 @@ |
245 | 245 | phy->attached_sata_ps = dr->attached_sata_ps; |
246 | 246 | phy->attached_iproto = dr->iproto << 1; |
247 | 247 | phy->attached_tproto = dr->tproto << 1; |
248 | - memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE); | |
248 | + /* help some expanders that fail to zero sas_address in the 'no | |
249 | + * device' case | |
250 | + */ | |
251 | + if (phy->attached_dev_type == NO_DEVICE || | |
252 | + phy->linkrate < SAS_LINK_RATE_1_5_GBPS) | |
253 | + memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); | |
254 | + else | |
255 | + memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE); | |
249 | 256 | phy->attached_phy_id = dr->attached_phy_id; |
250 | 257 | phy->phy_change_count = dr->change_count; |
251 | 258 | phy->routing_attr = dr->routing_attr; |