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,
-- 
Kurt Garloff  <[EMAIL PROTECTED]>           SuSE GmbH, N�rnberg, FRG
Linux kernel development;    SCSI driver: DC390 (tmscsim/AM53C974)
--- 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 = SDpnt->device_queue; SCpnt; 
-                    SCpnt = SCpnt->next)
+               SCpnt = SDpnt->device_queue;
+               if (SCpnt) SCnext = SCpnt->next;
+               for(; SCpnt; SCpnt = SCnext)
                {
                    if(SCpnt == SDpnt->device_queue)
                        SDpnt->device_queue = SCpnt->next;
+                   SCnext = SCpnt->next;
                    scsi_init_free((char *) SCpnt, sizeof(*SCpnt));
                }
                SDpnt->has_cmdblocks = 0;

PGP signature

Reply via email to