From: Dan Williams <dan.j.williams@intel.com>
To: linux-scsi@vger.kernel.org
Cc: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Subject: [set3 PATCH 1/6] libsas: sas_rediscover_dev did not look at the SMP exec status.
Date: Thu, 21 Jun 2012 23:36:10 -0700 [thread overview]
Message-ID: <20120622063609.21332.17560.stgit@dwillia2-linux.jf.intel.com> (raw)
In-Reply-To: <20120622063604.21332.39275.stgit@dwillia2-linux.jf.intel.com>
From: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
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>
[djbw: todo sanitize smp_execute_task return values (see: residue)]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
drivers/scsi/libsas/sas_expander.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index caa0525..af659cc 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -2005,6 +2005,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)
u8 sas_addr[8];
int res;
+ memset(sas_addr, 0, 8);
res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type);
switch (res) {
case SMP_RESP_NO_PHY:
@@ -2017,9 +2018,13 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)
return res;
case SMP_RESP_FUNC_ACC:
break;
+ case -ECOMM:
+ break;
+ default:
+ return res;
}
- if (SAS_ADDR(sas_addr) == 0) {
+ if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) {
phy->phy_state = PHY_EMPTY;
sas_unregister_devs_sas_addr(dev, phy_id, last);
return res;
next prev parent reply other threads:[~2012-06-22 6:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-22 6:36 [set3 PATCH 0/6] libsas: domain discovery fixes + misc cleanups Dan Williams
2012-06-22 6:36 ` Dan Williams [this message]
2012-06-22 6:36 ` [set3 PATCH 2/6] libsas: continue revalidation Dan Williams
2012-06-22 6:36 ` [set3 PATCH 3/6] libsas: fix sas_discover_devices return code handling Dan Williams
2012-06-22 7:03 ` Jack Wang
2012-06-22 6:36 ` [set3 PATCH 4/6] libsas: drop sata port multiplier infrastructure Dan Williams
2012-06-22 6:36 ` [set3 PATCH 5/6] libsas: trim sas_task of slow path infrastructure Dan Williams
2012-06-22 6:36 ` [set3 PATCH 6/6] mvsas: remove unused variable in mvs_task_exec() Dan Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120622063609.21332.17560.stgit@dwillia2-linux.jf.intel.com \
--to=dan.j.williams@intel.com \
--cc=jeffrey.d.skirvin@intel.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox