[PATCH] aic7xxx leaves timer running on init failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



aic79xx leaves timers inserted when ahd_init() (which inserts
two timers at its very end) succeeds but ahd_pci_map_int()
fails. In this case ahd->init_level gets incremented to 5 only
when that function succeeds, but ahd_free() calls ahd_shutdown()
only when ahd->init_level == 5, and ahd_shutdown() is where the
timers get removed. Since the freeing of the IRQ is not controlled
by ahd->init_level, we should increment init_level prior to
calling ahd_pci_map_int().

Reported-by: Jan Beulich <jbeulich@xxxxxxxxxx>
Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
---
 drivers/scsi/aic7xxx/aic79xx_pci.c |    6 ++----
 drivers/scsi/aic7xxx/aic7xxx_pci.c |    8 ++------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c
index a734d77..b8423c4 100644
--- a/drivers/scsi/aic7xxx/aic79xx_pci.c
+++ b/drivers/scsi/aic7xxx/aic79xx_pci.c
@@ -377,14 +377,12 @@ ahd_pci_config(struct ahd_softc *ahd, const struct ahd_pci_identity *entry)
 	error = ahd_init(ahd);
 	if (error != 0)
 		return (error);
+	ahd->init_level++;
 
 	/*
 	 * Allow interrupts now that we are completely setup.
 	 */
-	error = ahd_pci_map_int(ahd);
-	if (!error)
-		ahd->init_level++;
-	return error;
+	return ahd_pci_map_int(ahd);
 }
 
 #ifdef CONFIG_PM
diff --git a/drivers/scsi/aic7xxx/aic7xxx_pci.c b/drivers/scsi/aic7xxx/aic7xxx_pci.c
index c07cb6e..4347c8d 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_pci.c
@@ -960,16 +960,12 @@ ahc_pci_config(struct ahc_softc *ahc, const struct ahc_pci_identity *entry)
 	error = ahc_init(ahc);
 	if (error != 0)
 		return (error);
+	ahc->init_level++;
 
 	/*
 	 * Allow interrupts now that we are completely setup.
 	 */
-	error = ahc_pci_map_int(ahc);
-	if (error != 0)
-		return (error);
-
-	ahc->init_level++;
-	return (0);
+	return ahc_pci_map_int(ahc);
 }
 
 /*
-- 
1.5.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux