[PATCH] SAS: use sas_rphy instead of sas_end_device to obtain address.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since commit 3f8d6f2a0 ('ses: fix discovery of SATA devices in SAS
enclosures') ses_match_to_enclosure() is calling sas_get_address(),
which is coming from commit bcf508c13385 ('scsi_transport_sas: add
function to get SAS endpoint address'). sas_get_address() itself calls
sas_sdev_to_rdev() which BUG_ON()s if a given scsi_device's rphy is
not a SAS_END_DEVICE.

As SAS Enclosure is a SAS expander device, we really shouldn't tie the
lookup of a SAS address to the SAS End Device but the sas_rphy, which
holds the address information.

Fixes: 3f8d6f2a0 ('ses: fix discovery of SATA devices in SAS enclosures')
Cc: stable@xxxxxxxxxxxxxxx # v4.5+
Signed-off-by: Johannes Thumshirn <jthumshirn@xxxxxxx>
---
 drivers/scsi/scsi_transport_sas.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 3f0ff07..6b6d7b0 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -390,9 +390,9 @@ EXPORT_SYMBOL(sas_remove_host);
  */
 u64 sas_get_address(struct scsi_device *sdev)
 {
-	struct sas_end_device *rdev = sas_sdev_to_rdev(sdev);
+	struct sas_rphy *rphy = target_to_rphy(sdev->sdev_target);
 
-	return rdev->rphy.identify.sas_address;
+	return rphy->identify.sas_address;
 }
 EXPORT_SYMBOL(sas_get_address);
 
-- 
1.8.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux