public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: "Ewan D. Milne" <emilne@redhat.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: Avoid crashing if device uses DIX but adapter does not support it
Date: Wed, 14 Jan 2015 20:18:29 -0500	[thread overview]
Message-ID: <yq1fvbcvo2i.fsf@sermon.lab.mkp.net> (raw)
In-Reply-To: <1421270017-14103-1-git-send-email-emilne@redhat.com> (Ewan D. Milne's message of "Wed, 14 Jan 2015 16:13:37 -0500")

>>>>> "Ewan" == Ewan D Milne <emilne@redhat.com> writes:

Ewan> This can happen if a multipathed device uses DIX and another path
Ewan> is added via an adapter that does not support it.  Multipath
Ewan> should not allow this path to be added,

No it shouldn't :)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 6d5c0b8..4f14f4a 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1143,7 +1143,17 @@ int scsi_init_io(struct scsi_cmnd *cmd)
 		struct scsi_data_buffer *prot_sdb = cmd->prot_sdb;
 		int ivecs, count;
 
-		BUG_ON(prot_sdb == NULL);
+		if (prot_sdb == NULL) {
+			/*
+			 * This can happen if someone (e.g. multipath)
+			 * queues a command to a device on an adapter
+			 * that does not support T10 PI.

s/T10 PI/DIX/

+			 */
+			WARN_ON_ONCE(1);
+			error = BLKPREP_KILL;
+			goto err_exit;
+		}
+
 		ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio);
 
 		if (scsi_alloc_sgtable(prot_sdb, ivecs, is_mq)) {

Failing more gracefully is OK with me.

Acked-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

  reply	other threads:[~2015-01-15  1:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 21:13 [PATCH] scsi: Avoid crashing if device uses DIX but adapter does not support it Ewan D. Milne
2015-01-15  1:18 ` Martin K. Petersen [this message]
2015-01-15 13:32   ` Ewan Milne

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=yq1fvbcvo2i.fsf@sermon.lab.mkp.net \
    --to=martin.petersen@oracle.com \
    --cc=emilne@redhat.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