[6775] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

[PATCH] scsi_unregister_device: slab poison oops

daemon@ATHENA.MIT.EDU (Kurt Garloff)
Mon Jul 5 06:31:40 1999

Date:   Mon, 5 Jul 1999 12:13:56 +0200
From: Kurt Garloff <garloff@suse.de>
To: Linux SCSI list <linux-scsi@vger.rutgers.edu>, Alan Cox <alan@cymru.net>
Mail-Followup-To: Linux SCSI list <linux-scsi@vger.rutgers.edu>,
	Alan Cox <alan@cymru.net>


--E39vaYmALEf/7YXx
Content-Type: multipart/mixed; boundary=OXfL5xGRrasGEqWY


--OXfL5xGRrasGEqWY
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Alan,

your slab poisoning seems to trigger some bugs in various places.

Attached is a patch for linux/drivers/scsi/scsi.c. It's against 2.2.10-ac8
(with devfs and some other patches, but it should apply cleanly anyway.)

The bug was triggered on removing st, sg, sd, sr modules.

Regards,
--=20
Kurt Garloff  <garloff@suse.de>           SuSE GmbH, N=FCrnberg, FRG
Linux kernel development;    SCSI driver: DC390 (tmscsim/AM53C974)

--OXfL5xGRrasGEqWY
Content-Type: text/plain; charset=us-ascii
Content-Description: 2210ac8-scsi_unregdev.diff
Content-Disposition: attachment; filename="2210ac8-scsi_unregdev.diff"
Content-Transfer-Encoding: quoted-printable

--- linux/drivers/scsi/scsi.c.ORIG	Mon Jul  5 12:08:43 1999
+++ linux/drivers/scsi/scsi.c	Mon Jul  5 11:56:30 1999
@@ -3246,7 +3246,7 @@
 static int scsi_unregister_device(struct Scsi_Device_Template * tpnt)
 {
     Scsi_Device * SDpnt;
-    Scsi_Cmnd * SCpnt;
+    Scsi_Cmnd * SCpnt, * SCnext;
     struct Scsi_Host * shpnt;
     struct Scsi_Device_Template * spnt;
     struct Scsi_Device_Template * prev_spnt;
@@ -3274,11 +3274,13 @@
 	         * Nobody is using this device any more.  Free all of the
 	         * command structures.
 	         */
-	        for(SCpnt =3D SDpnt->device_queue; SCpnt;=20
-                    SCpnt =3D SCpnt->next)
+	        SCpnt =3D SDpnt->device_queue;
+	        if (SCpnt) SCnext =3D SCpnt->next;
+	        for(; SCpnt; SCpnt =3D SCnext)
 	        {
 		    if(SCpnt =3D=3D SDpnt->device_queue)
 			SDpnt->device_queue =3D SCpnt->next;
+		    SCnext =3D SCpnt->next;
 		    scsi_init_free((char *) SCpnt, sizeof(*SCpnt));
 	        }
 	        SDpnt->has_cmdblocks =3D 0;

--OXfL5xGRrasGEqWY--

--E39vaYmALEf/7YXx
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3in

iQCVAwUBN4CFYxaQN/7O/JIVAQG1lAQAiz1DdvYeFwUkBnFbnQE58TXMVT6UNqfg
AB2GP5VC5NfadZfQ+fWBNsqgQ2jZr5BLxJU1U9gGnO/T2VGLS6JtJ9HcMGE3WUx6
/F7WkAnata/dm3OCxKNaSwe365Ei4J3DfGP6jjmeg/Ts/w6IZTCg0IjzShxterhO
TWw7hnuPAt0=
=bJtN
-----END PGP SIGNATURE-----

--E39vaYmALEf/7YXx--

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu

home help back first fref pref prev next nref lref last post