aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Dreier <rdreier@cisco.com>2006-03-06 20:23:33 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-27 23:00:21 -0800
commit2c07f6fae4b06515944c167e8aeb86217c797c03 (patch)
tree1161b1ceaf1314418828fcaf68ece923464bfb1e
parentf0ad886be1b6b2288cfa100c317dc6e5ceb93fd9 (diff)
[PATCH] IB/srp: Don't send task management commands after target removal
Just fail abort and reset requests that come in after we've already decided to remove a target. This fixes a nasty crash if a storage target goes away. Signed-off-by: Roland Dreier <rolandd@cisco.com> Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index ee9fe226ae9..4eec4d71f0c 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1154,6 +1154,12 @@ static int srp_send_tsk_mgmt(struct scsi_cmnd *scmnd, u8 func)
spin_lock_irq(target->scsi_host->host_lock);
+ if (target->state == SRP_TARGET_DEAD ||
+ target->state == SRP_TARGET_REMOVED) {
+ scmnd->result = DID_BAD_TARGET << 16;
+ goto out;
+ }
+
if (scmnd->host_scribble == (void *) -1L)
goto out;