[SCSI] aha152x: Close narrow race in release
authorMatthew Wilcox <matthew@wil.cx>
Wed, 15 Aug 2007 18:56:57 +0000 (12:56 -0600)
committerJames Bottomley <jejb@mulgrave.localdomain>
Fri, 12 Oct 2007 18:51:22 +0000 (14:51 -0400)
We were releasing the IRQ before removing the host, so commands could
still be coming in which would never be seen by the interrupt handler.
Just remove the host before releasing the IRQ to close this race.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/aha152x.c

index d30a307..f08e71e 100644 (file)
@@ -907,9 +907,10 @@ out_host_put:
 
 void aha152x_release(struct Scsi_Host *shpnt)
 {
-       if(!shpnt)
+       if (!shpnt)
                return;
 
+       scsi_remove_host(shpnt);
        if (shpnt->irq)
                free_irq(shpnt->irq, shpnt);
 
@@ -923,7 +924,6 @@ void aha152x_release(struct Scsi_Host *shpnt)
                pnp_device_detach(HOSTDATA(shpnt)->pnpdev);
 #endif
 
-       scsi_remove_host(shpnt);
        list_del(&HOSTDATA(shpnt)->host_list);
        scsi_host_put(shpnt);
 }