Commit 8041708e authored by Hannes Reinecke's avatar Hannes Reinecke Committed by James Bottomley

am53c974: Fix crash during modprobe

On systems with shared interrupts the interrupt routine might
be called as soon as the interrupt is enabled.
As this might happen before pci_set_drvdata() is called the
system would crash.
Reported-by: default avatarAndreas Brogle <anbro@ok.de>
Tested-by: default avatarAndreas Brogle <anbro@ok.de>
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
parent 16b8528d
...@@ -476,6 +476,8 @@ static int pci_esp_probe_one(struct pci_dev *pdev, ...@@ -476,6 +476,8 @@ static int pci_esp_probe_one(struct pci_dev *pdev,
goto fail_unmap_regs; goto fail_unmap_regs;
} }
pci_set_drvdata(pdev, pep);
err = request_irq(pdev->irq, scsi_esp_intr, IRQF_SHARED, err = request_irq(pdev->irq, scsi_esp_intr, IRQF_SHARED,
DRV_MODULE_NAME, esp); DRV_MODULE_NAME, esp);
if (err < 0) { if (err < 0) {
...@@ -496,8 +498,6 @@ static int pci_esp_probe_one(struct pci_dev *pdev, ...@@ -496,8 +498,6 @@ static int pci_esp_probe_one(struct pci_dev *pdev,
/* Assume 40MHz clock */ /* Assume 40MHz clock */
esp->cfreq = 40000000; esp->cfreq = 40000000;
pci_set_drvdata(pdev, pep);
err = scsi_esp_register(esp, &pdev->dev); err = scsi_esp_register(esp, &pdev->dev);
if (err) if (err)
goto fail_free_irq; goto fail_free_irq;
...@@ -507,6 +507,7 @@ static int pci_esp_probe_one(struct pci_dev *pdev, ...@@ -507,6 +507,7 @@ static int pci_esp_probe_one(struct pci_dev *pdev,
fail_free_irq: fail_free_irq:
free_irq(pdev->irq, esp); free_irq(pdev->irq, esp);
fail_unmap_command_block: fail_unmap_command_block:
pci_set_drvdata(pdev, NULL);
pci_free_consistent(pdev, 16, esp->command_block, pci_free_consistent(pdev, 16, esp->command_block,
esp->command_block_dma); esp->command_block_dma);
fail_unmap_regs: fail_unmap_regs:
...@@ -530,6 +531,7 @@ static void pci_esp_remove_one(struct pci_dev *pdev) ...@@ -530,6 +531,7 @@ static void pci_esp_remove_one(struct pci_dev *pdev)
scsi_esp_unregister(esp); scsi_esp_unregister(esp);
free_irq(pdev->irq, esp); free_irq(pdev->irq, esp);
pci_set_drvdata(pdev, NULL);
pci_free_consistent(pdev, 16, esp->command_block, pci_free_consistent(pdev, 16, esp->command_block,
esp->command_block_dma); esp->command_block_dma);
pci_iounmap(pdev, esp->regs); pci_iounmap(pdev, esp->regs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment