[PATCH 01/08] IB/srp: Don't send task management commands after target removal

From: Greg KH
Date: Fri Mar 24 2006 - 23:07:04 EST


From: Roland Dreier <rdreier@xxxxxxxxx>

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@xxxxxxxxx>
Signed-off-by: Chris Wright <chrisw@xxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---

This is upstream in Linus's tree as 1285b3a0b0aa2391ac6f6939e6737203c8220f68

drivers/infiniband/ulp/srp/ib_srp.c | 6 ++++++
1 file changed, 6 insertions(+)

--- linux-2.6.15.6.orig/drivers/infiniband/ulp/srp/ib_srp.c
+++ linux-2.6.15.6/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1154,6 +1154,12 @@ static int srp_send_tsk_mgmt(struct scsi

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;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/