public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jürgen E. Fischer" <fischer@linux-buechse.de>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: Andrew Morton <akpm@osdl.org>,
	bugme-daemon@bugzilla.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [Bugme-new] [Bug 6092] New: drivers/scsi/pcmcia/aha152x_stub.c: aha152x_resume(): variable used before set
Date: Sun, 19 Feb 2006 16:08:04 +0100	[thread overview]
Message-ID: <20060219150804.GA16578@linux-buechse.de> (raw)
In-Reply-To: <1140359237.3103.9.camel@mulgrave.il.steeleye.com>

Hi James,

On Sun, Feb 19, 2006 at 08:27:17 -0600, James Bottomley wrote:
> >         HOSTDATA(shpnt)->in_intr++;
> >  
> > +       if( HOSTDATA(shpnt)->service==0 )  {
> > +               DO_UNLOCK(flags);
> > +               return;
> > +       }
> 
> Looks a bit wrong.  If that ever triggered, you'd exit your task handler
> with in_intr raised, which would cause a panic the next time
> is_complete() was called.

ouch, but thanks for the understatement. ;)


> The driver still seems to have an awful lot of locking confusion between
> the host lock and its own internal lock (stored in the host structure).
> I think there are several races and other nasties that could be cleaned
> up simply by moving to using the host lock everywhere.

done.

patch:
- drop private lock and use host_lock instead.

Signed-off-by: Juergen E. Fischer <fischer@linux-buechse.de>

--- aha152x.c	2006-02-19 15:54:24.315291253 +0100
+++ linux-2.6/drivers/scsi/aha152x.c	2006-02-19 16:00:45.817015449 +0100
@@ -465,9 +465,6 @@
 	Scsi_Cmnd *done_SC;
 		/* command that was completed */
 
-	spinlock_t lock;
-		/* host lock */
-
 #if defined(AHA152X_DEBUG)
 	const char *locker;
 		/* which function has the lock */
@@ -563,7 +560,7 @@
 #define DONE_SC			(HOSTDATA(shpnt)->done_SC)
 #define ISSUE_SC		(HOSTDATA(shpnt)->issue_SC)
 #define DISCONNECTED_SC		(HOSTDATA(shpnt)->disconnected_SC)
-#define QLOCK			(HOSTDATA(shpnt)->lock)
+#define QLOCK			((shpnt)->host_lock)
 #define QLOCKER			(HOSTDATA(shpnt)->locker)
 #define QLOCKERL		(HOSTDATA(shpnt)->lockerl)
 
@@ -802,7 +799,6 @@
 		HOSTIOPORT1 = setup->io_port-0x10;
 	}
 
-	spin_lock_init(&QLOCK);
 	RECONNECT   = setup->reconnect;
 	SYNCHRONOUS = setup->synchronous;
 	PARITY      = setup->parity;
@@ -2539,6 +2535,13 @@
 
 	DO_LOCK(flags);
 
+	if( HOSTDATA(shpnt)->service==0 )  {
+		DO_UNLOCK(flags);
+		return;
+	}
+
+	HOSTDATA(shpnt)->service = 0;
+
 	if(HOSTDATA(shpnt)->in_intr) {
 		DO_UNLOCK(flags);
 		/* aha152x_error never returns.. */
@@ -2546,13 +2549,6 @@
 	}
 	HOSTDATA(shpnt)->in_intr++;
 
-	if (HOSTDATA(shpnt)->service == 0) {
-		DO_UNLOCK(flags);
-		return;
-	}
-
-	HOSTDATA(shpnt)->service = 0;
-
 
 	/*
 	 * loop while there are interrupt conditions pending


  reply	other threads:[~2006-02-19 15:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200602180209.k1I29meW030162@fire-2.osdl.org>
2006-02-18  5:10 ` [Bugme-new] [Bug 6092] New: drivers/scsi/pcmcia/aha152x_stub.c: aha152x_resume(): variable used before set Andrew Morton
2006-02-18 22:10   ` Jürgen E. Fischer
2006-02-18 22:14     ` Andrew Morton
2006-02-18 23:31       ` Jürgen E. Fischer
2006-02-18 23:46         ` Andrew Morton
2006-02-18 23:58           ` Jürgen E. Fischer
2006-02-19 14:27         ` James Bottomley
2006-02-19 15:08           ` Jürgen E. Fischer [this message]
2006-02-19 15:26             ` James Bottomley

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=20060219150804.GA16578@linux-buechse.de \
    --to=fischer@linux-buechse.de \
    --cc=James.Bottomley@SteelEye.com \
    --cc=akpm@osdl.org \
    --cc=bugme-daemon@bugzilla.kernel.org \
    --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