public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: torvalds@linux-foundation.org
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] Don't crash on IOMMU overflow in A100U2W driver
Date: Tue, 15 Jul 2008 17:19:55 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0807151718410.4356@devserv.devel.redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0807151014180.24544@devserv.devel.redhat.com>

Handle IOMMU overflow correctly, by retrying. IOMMU errors can happen and 
drivers must deal with them.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
---
 drivers/scsi/a100u2w.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Index: linux-2.6.26-fast/drivers/scsi/a100u2w.c
===================================================================
--- linux-2.6.26-fast.orig/drivers/scsi/a100u2w.c	2008-07-15 15:49:39.000000000 +0200
+++ linux-2.6.26-fast/drivers/scsi/a100u2w.c	2008-07-15 16:04:50.000000000 +0200
@@ -840,7 +840,7 @@ static irqreturn_t orc_interrupt(struct 
  *	Build a host adapter control block from the SCSI mid layer command
  */
 
-static void inia100_build_scb(struct orc_host * host, struct orc_scb * scb, struct scsi_cmnd * cmd)
+static int inia100_build_scb(struct orc_host * host, struct orc_scb * scb, struct scsi_cmnd * cmd)
 {				/* Create corresponding SCB     */
 	struct scatterlist *sg;
 	struct orc_sgent *sgent;		/* Pointer to SG list           */
@@ -865,7 +865,8 @@ static void inia100_build_scb(struct orc
 	sgent = (struct orc_sgent *) & escb->sglist[0];
 
 	count_sg = scsi_dma_map(cmd);
-	BUG_ON(count_sg < 0);
+	if (count_sg < 0)
+		return count_sg;
 	BUG_ON(count_sg > TOTAL_SG_ENTRY);
 
 	/* Build the scatter gather lists */
@@ -898,6 +899,7 @@ static void inia100_build_scb(struct orc
 		scb->tag_msg = 0;	/* No tag support               */
 	}
 	memcpy(scb->cdb, cmd->cmnd, scb->cdb_len);
+	return 0;
 }
 
 /**
@@ -921,7 +923,10 @@ static int inia100_queue(struct scsi_cmn
 	if ((scb = orc_alloc_scb(host)) == NULL)
 		return SCSI_MLQUEUE_HOST_BUSY;
 
-	inia100_build_scb(host, scb, cmd);
+	if (inia100_build_scb(host, scb, cmd)) {
+		orc_release_scb(host, scb);
+		return SCSI_MLQUEUE_HOST_BUSY;
+	}
 	orc_exec_scb(host, scb);	/* Start execute SCB            */
 	return 0;
 }

  reply	other threads:[~2008-07-15 21:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-15 14:11 [PATCH 1/4] Fix endianity in A100U2W SCSI driver Mikulas Patocka
2008-07-15 14:12 ` [PATCH 2/4] Add udelay to " Mikulas Patocka
2008-07-15 14:14   ` [PATCH 3/4] BUG_ON on kernel misbehavior on A100U2W driver Mikulas Patocka
2008-07-15 14:15     ` [PATCH 4/4] Don't crash on IOMMU overflow in " Mikulas Patocka
2008-07-15 21:19       ` Mikulas Patocka [this message]
2008-07-15 15:17     ` [PATCH 3/4] BUG_ON on kernel misbehavior on " James Bottomley
2008-07-15 21:18     ` Mikulas Patocka
2008-07-15 21:16   ` [PATCH 2/4] Add udelay to A100U2W SCSI driver Mikulas Patocka
2008-07-15 17:23 ` [PATCH 1/4] Fix endianity in " Linus Torvalds
2008-07-15 21:15   ` Mikulas Patocka

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=Pine.LNX.4.64.0807151718410.4356@devserv.devel.redhat.com \
    --to=mpatocka@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=torvalds@linux-foundation.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