summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@us.ibm.com>2007-07-24 09:33:49 -0700
committerJames Bottomley <jejb@mulgrave.localdomain>2007-07-24 13:02:26 -0400
commit2cd614c8732172524c36cd5245620338928062b6 (patch)
tree82cf3eae2515f6ebe7a2fae8b51d06d034d990ed
parentbbf17d6483a7feb4c1eeef9fd553976d4f394e4c (diff)
downloadlinux-2cd614c8732172524c36cd5245620338928062b6.tar.gz
linux-2cd614c8732172524c36cd5245620338928062b6.tar.bz2
linux-2cd614c8732172524c36cd5245620338928062b6.zip
[SCSI] libsas: SMP request handler shouldn't crash when rphy is NULL
sas_smp_handler crashes when smp utils are used with an aic94xx host because certain devices (the sas_host itself, specifically) lack rphy structures. No rphy means no SMP target support, but we shouldn't crash here. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/scsi/libsas/sas_expander.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index b500f0c1449c..8603ae65213d 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -1879,7 +1879,7 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
struct request *req)
{
struct domain_device *dev;
- int ret, type = rphy->identify.device_type;
+ int ret, type;
struct request *rsp = req->next_rq;
if (!rsp) {
@@ -1888,12 +1888,13 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
return -EINVAL;
}
- /* seems aic94xx doesn't support */
+ /* no rphy means no smp target support (ie aic94xx host) */
if (!rphy) {
printk("%s: can we send a smp request to a host?\n",
__FUNCTION__);
return -EINVAL;
}
+ type = rphy->identify.device_type;
if (type != SAS_EDGE_EXPANDER_DEVICE &&
type != SAS_FANOUT_EXPANDER_DEVICE) {