linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@steeleye.com>
To: Andrew Morton <akpm@digeo.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Badari Pulavarty <pbadari@us.ibm.com>,
	"Martin J. Bligh" <Martin.Bligh@us.ibm.com>,
	Jens Axboe <axboe@suse.de>, Doug Ledford <dledford@redhat.com>
Subject: Re: possible use-after-free in 2.5.44 scsi changes
Date: Fri, 25 Oct 2002 13:34:02 -0500	[thread overview]
Message-ID: <200210251834.g9PIY2l03794@localhost.localdomain> (raw)
In-Reply-To: Message from James Bottomley <James.Bottomley@steeleye.com> of "Fri, 25 Oct 2002 09:16:58 CDT." <200210251416.g9PEGxv01952@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 597 bytes --]


James.Bottomley@steeleye.com said:
> This has all the hallmarks of the Qlogic double done bug:  Under
> certain high  stress/bad bus situations, the Qla driver will call done
> twice on a SCSI  command structure.  I take it this is the 6.1.0 qla
> driver, which qlogic has  assured me "really really" has this bug
> fixed?

> Is there any way to switch adapters to see if we can confirm this
> hypothesis? 

Actually, rather than switching adapters, could you try the attached patch.  
As long as the command isn't reused too fast after the scsi_done, it should 
pick up this problem.

James





[-- Attachment #2: tmp.diff --]
[-- Type: text/plain , Size: 818 bytes --]

===== drivers/scsi/scsi.c 1.50 vs edited =====
--- 1.50/drivers/scsi/scsi.c	Tue Oct 22 12:43:29 2002
+++ edited/drivers/scsi/scsi.c	Fri Oct 25 13:23:32 2002
@@ -1224,6 +1224,12 @@
 	SCSI_LOG_MLQUEUE(3, printk("Leaving scsi_do_cmd()\n"));
 }
 
+static void scsi_null_done_method(Scsi_Cmnd *SCp)
+{
+	printk(KERN_EMERG "Done called on already done command\n");
+        dump_stack();
+}
+
 /**
  * scsi_done - Mark this command as done
  * @SCpnt: The SCSI Command which we think we've completed.
@@ -1247,6 +1253,10 @@
 	unsigned long flags;
 	int cpu, tstatus;
 	struct softscsi_data *queue;
+
+        /* clear out the done method to produce an error for done on the
+         * same command */
+        SCpnt->scsi_done = scsi_null_done_method;
 
 	/*
 	 * We don't have to worry about this one timing out any more.

  reply	other threads:[~2002-10-25 18:34 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-25  1:39 possible use-after-free in 2.5.44 scsi changes Andrew Morton
2002-10-25  4:06 ` Doug Ledford
2002-10-25  4:40   ` Andrew Morton
2002-10-25 14:21     ` James Bottomley
2002-10-25  4:07 ` Patrick Mansfield
2002-10-25 14:16 ` James Bottomley
2002-10-25 18:34   ` James Bottomley [this message]
2002-10-25 18:49     ` Mike Anderson
2002-10-25 19:08     ` Patrick Mansfield
2002-10-25 19:41       ` Mike Anderson
2002-10-25 19:47         ` Jens Axboe
2002-10-25 22:14           ` James Bottomley
2002-10-25 22:18             ` Andrew Morton
2002-10-25 22:23     ` Badari Pulavarty
2002-10-26  0:13       ` James Bottomley
2002-10-26  0:18         ` Mike Anderson
2002-10-26  9:29         ` Jens Axboe
2002-10-27  0:50           ` James Bottomley
2002-10-27 21:20             ` Jens Axboe
2002-10-27 21:37               ` James Bottomley
2002-10-27 21:54                 ` Jens Axboe
2002-10-30 17:39                   ` Badari Pulavarty
2002-10-30 18:16                     ` Jens Axboe
2002-10-30 19:31                       ` Badari Pulavarty
2002-10-30 21:36                         ` merlin hughes
2002-10-30 22:19                           ` Badari Pulavarty
2002-10-31  2:17                             ` merlin
2002-10-31 13:18                               ` Jens Axboe
2002-10-31 14:41                                 ` merlin
2002-10-31 14:46                                   ` Jens Axboe
2002-10-31 15:04                             ` Jens Axboe
2002-10-31 15:12                               ` Jens Axboe
2002-10-31 17:41                                 ` merlin
2002-10-30 20:35                       ` David S. Miller
2002-10-30 22:03                         ` Badari Pulavarty
  -- strict thread matches above, loose matches on Subject: below --
2002-10-31 17:57 Badari Pulavarty
2002-10-31 18:46 ` Jens Axboe

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=200210251834.g9PIY2l03794@localhost.localdomain \
    --to=james.bottomley@steeleye.com \
    --cc=Martin.Bligh@us.ibm.com \
    --cc=akpm@digeo.com \
    --cc=axboe@suse.de \
    --cc=dledford@redhat.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=pbadari@us.ibm.com \
    /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).