linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: dillowda-1Heg1YXhbW8@public.gmane.org,
	roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org
Subject: [PATCH 05/15] ib_srp: Avoid that SCSI error handling triggers a crash
Date: Sun, 25 Mar 2012 14:53:23 +0000	[thread overview]
Message-ID: <4903375.rt8yAAnAoX@asus> (raw)
In-Reply-To: <5207288.nSt5MkVMpO@asus>

Sending any data over a queue pair associated with a closed
connection is wrong. The HCA will send the data anyway and such
data may be sent to another system to a queue pair that is in use.
The data will get processed and a response will be sent back. That
can result in ib_srp complaining about "Null scmnd for RSP ..."
followed by a kernel oops.

Signed-off-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
Cc: David Dillow <dillowda-1Heg1YXhbW8@public.gmane.org>
Cc: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
---
 drivers/infiniband/ulp/srp/ib_srp.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index c88dde3..2c265ae 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1296,7 +1296,8 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
 	int len;
 
 	if (target->state == SRP_TARGET_DEAD ||
-	    target->state == SRP_TARGET_REMOVED) {
+	    target->state == SRP_TARGET_REMOVED ||
+	    !target->connected) {
 		scmnd->result = DID_BAD_TARGET << 16;
 		scmnd->scsi_done(scmnd);
 		return 0;
@@ -1647,7 +1648,8 @@ static int srp_send_tsk_mgmt(struct srp_target_port *target,
 	struct srp_tsk_mgmt *tsk_mgmt;
 
 	if (target->state == SRP_TARGET_DEAD ||
-	    target->state == SRP_TARGET_REMOVED)
+	    target->state == SRP_TARGET_REMOVED ||
+	    !target->connected)
 		return -1;
 
 	init_completion(&target->tsk_mgmt_done);
-- 
1.7.7


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2012-03-25 14:53 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-25 14:45 [PATCH 00/15, v3] Make ib_srp better suited for H.A. purposes Bart Van Assche
2012-03-25 14:47 ` [PATCH 01/15] ib_srp: Enlarge block layer timeout Bart Van Assche
2012-03-29 16:59   ` Dave Dillow
     [not found]     ` <20120329165931.GA19700-1Heg1YXhbW8@public.gmane.org>
2012-04-22 16:01       ` Bart Van Assche
     [not found]         ` <4F942B74.4040106-HInyCGIudOg@public.gmane.org>
2012-04-30 15:11           ` David Dillow
     [not found]             ` <1335798691.441.2.camel-zHLflQxYYDO4Hhoo1DtQwJ9G+ZOsUmrO@public.gmane.org>
2012-05-19 10:50               ` Bart Van Assche
     [not found]                 ` <4FB77AEE.7030100-HInyCGIudOg@public.gmane.org>
2012-05-30  4:56                   ` David Dillow
2012-03-25 14:48 ` [PATCH 02/15] ib_srp: Introduce srp_handle_qp_err() Bart Van Assche
2012-03-25 14:50 ` [PATCH 03/15] ib_srp: Micro-optimize srp_queuecommand() Bart Van Assche
2012-03-25 14:52 ` [PATCH 04/15] ib_srp: Suppress superfluous error messages Bart Van Assche
2012-03-25 14:53 ` Bart Van Assche [this message]
2012-03-25 14:54 ` [PATCH 06/15] ib_srp: Introduce the helper function srp_remove_target() Bart Van Assche
2012-03-25 14:55 ` [PATCH 07/15] ib_srp: Eliminate state SRP_TARGET_DEAD Bart Van Assche
2012-03-25 14:56 ` [PATCH 08/15] ib_srp: Make srp_disconnect_target() wait for IB completions Bart Van Assche
2012-03-25 14:57 ` [PATCH 09/15] srp_transport: Fix atttribute registration Bart Van Assche
2012-03-25 14:58 ` [PATCH 10/15] srp_transport: Simplify attribute initialization code Bart Van Assche
2012-03-25 14:59 ` [PATCH 11/15] srp_transport: Document sysfs attributes Bart Van Assche
2012-03-25 15:00 ` [PATCH 12/15] ib_srp: " Bart Van Assche
2012-03-25 15:01 ` [PATCH 13/15] ib_srp: Allow SRP disconnect through sysfs Bart Van Assche
2012-07-16 22:20   ` Mike Christie
     [not found]     ` <500493B4.4010303-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
2012-07-17 12:55       ` bart-LmZ/31Jx5xYUl6sPKNhdgg
2012-03-25 15:02 ` [PATCH 14/15] ib_srp: Introduce a temporary variable in srp_remove_target() Bart Van Assche
2012-03-25 15:03 ` [PATCH 15/15] ib_srp: Maintain a single connection per I_T nexus Bart Van Assche
2012-03-25 15:18 ` [PATCH 00/15, v3] Make ib_srp better suited for H.A. purposes Bart Van Assche
2012-03-27 16:37   ` Dave Dillow

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=4903375.rt8yAAnAoX@asus \
    --to=bvanassche-hinycgiudog@public.gmane.org \
    --cc=dillowda-1Heg1YXhbW8@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.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;
as well as URLs for NNTP newsgroup(s).