]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
[PATCH] IB/srp: Don't send task management commands after target removal
authorRoland Dreier <rdreier@cisco.com>
Tue, 7 Mar 2006 04:23:33 +0000 (20:23 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 28 Mar 2006 07:00:21 +0000 (23:00 -0800)
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>
drivers/infiniband/ulp/srp/ib_srp.c

index ee9fe226ae994408f50b1180632c8c4b9ba7d7db..4eec4d71f0cca7c6d575536a4dca36f32a87ce9c 100644 (file)
@@ -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;