* [PATCH 3/7] sym53c8xx: fix bogus free_irq() on error path
@ 2009-01-08 17:54 Tony Battersby
0 siblings, 0 replies; only message in thread
From: Tony Battersby @ 2009-01-08 17:54 UTC (permalink / raw)
To: James Bottomley; +Cc: Matthew Wilcox, linux-scsi
If sym_attach() gets an error at or before request_irq(), then
sym_free_resources() will call free_irq() for an unregistered
interrupt handler.
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
---
--- linux-2.6.28/drivers/scsi/sym53c8xx_2/sym_glue.c.orig 2009-01-07 17:32:33.000000000 -0500
+++ linux-2.6.28/drivers/scsi/sym53c8xx_2/sym_glue.c 2009-01-07 17:35:27.000000000 -0500
@@ -1238,12 +1238,13 @@ static int sym53c8xx_proc_info(struct Sc
/*
* Free controller resources.
*/
-static void sym_free_resources(struct sym_hcb *np, struct pci_dev *pdev)
+static void sym_free_resources(struct sym_hcb *np, struct pci_dev *pdev,
+ int do_free_irq)
{
/*
* Free O/S specific resources.
*/
- if (pdev->irq)
+ if (do_free_irq)
free_irq(pdev->irq, np->s.host);
if (np->s.ioaddr)
pci_iounmap(pdev, np->s.ioaddr);
@@ -1275,6 +1276,7 @@ static struct Scsi_Host * __devinit sym_
struct pci_dev *pdev = dev->pdev;
unsigned long flags;
struct sym_fw *fw;
+ int do_free_irq = 0;
printk(KERN_INFO "sym%d: <%s> rev 0x%x at pci %s irq %u\n",
unit, dev->chip.name, pdev->revision, pci_name(pdev),
@@ -1364,6 +1366,7 @@ static struct Scsi_Host * __devinit sym_
sym_name(np), pdev->irq);
goto attach_failed;
}
+ do_free_irq = 1;
/*
* After SCSI devices have been opened, we cannot
@@ -1420,7 +1423,7 @@ static struct Scsi_Host * __devinit sym_
return NULL;
printf_info("sym%d: giving up ...\n", unit);
if (np)
- sym_free_resources(np, pdev);
+ sym_free_resources(np, pdev, do_free_irq);
scsi_host_put(shost);
return NULL;
@@ -1659,7 +1662,7 @@ static int sym_detach(struct Scsi_Host *
udelay(10);
OUTB(np, nc_istat, 0);
- sym_free_resources(np, pdev);
+ sym_free_resources(np, pdev, 1);
scsi_host_put(shost);
return 1;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-01-08 17:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-08 17:54 [PATCH 3/7] sym53c8xx: fix bogus free_irq() on error path Tony Battersby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).