linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] SAS: use sas_rphy instead of sas_end_device to obtain address.
@ 2016-08-11  7:59 Johannes Thumshirn
  2016-08-11 15:09 ` James Bottomley
  0 siblings, 1 reply; 10+ messages in thread
From: Johannes Thumshirn @ 2016-08-11  7:59 UTC (permalink / raw)
  To: Martin K . Petersen, James Bottomley
  Cc: Hannes Reinecke, Linux SCSI Mailinglist,
	Linux Kernel Mailinglist, Johannes Thumshirn, stable, #, v4.5+

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@vger.kernel.org # v4.5+
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-08-12 14:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-11  7:59 [PATCH] SAS: use sas_rphy instead of sas_end_device to obtain address Johannes Thumshirn
2016-08-11 15:09 ` James Bottomley
2016-08-11 16:43   ` Johannes Thumshirn
2016-08-11 18:00     ` James Bottomley
2016-08-12 10:08       ` Johannes Thumshirn
2016-08-12 13:11         ` Johannes Thumshirn
2016-08-12 14:34           ` James Bottomley
2016-08-12 14:39             ` Hannes Reinecke
2016-08-12 14:54               ` James Bottomley
2016-08-12 14:56                 ` Johannes Thumshirn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).