diff options
author | Hannes Reinecke <hare@suse.de> | 2015-03-27 09:31:12 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Odin.com> | 2015-04-17 13:13:56 -0400 |
commit | 8041708ed4d993c5466c20926210598afa97194e (patch) | |
tree | d217c200e75c8acbc09765159038a000d7c2307c /drivers/scsi/am53c974.c | |
parent | 16b8528d20607925899b1df93bfd8fbab98d267c (diff) |
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: Andreas Brogle <anbro@ok.de>
Tested-by: Andreas Brogle <anbro@ok.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Diffstat (limited to 'drivers/scsi/am53c974.c')
-rw-r--r-- | drivers/scsi/am53c974.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/scsi/am53c974.c b/drivers/scsi/am53c974.c index a6f5ee80fadc..beea30e5a34a 100644 --- a/drivers/scsi/am53c974.c +++ b/drivers/scsi/am53c974.c | |||
@@ -476,6 +476,8 @@ static int pci_esp_probe_one(struct pci_dev *pdev, | |||
476 | goto fail_unmap_regs; | 476 | goto fail_unmap_regs; |
477 | } | 477 | } |
478 | 478 | ||
479 | pci_set_drvdata(pdev, pep); | ||
480 | |||
479 | err = request_irq(pdev->irq, scsi_esp_intr, IRQF_SHARED, | 481 | err = request_irq(pdev->irq, scsi_esp_intr, IRQF_SHARED, |
480 | DRV_MODULE_NAME, esp); | 482 | DRV_MODULE_NAME, esp); |
481 | if (err < 0) { | 483 | if (err < 0) { |
@@ -496,8 +498,6 @@ static int pci_esp_probe_one(struct pci_dev *pdev, | |||
496 | /* Assume 40MHz clock */ | 498 | /* Assume 40MHz clock */ |
497 | esp->cfreq = 40000000; | 499 | esp->cfreq = 40000000; |
498 | 500 | ||
499 | pci_set_drvdata(pdev, pep); | ||
500 | |||
501 | err = scsi_esp_register(esp, &pdev->dev); | 501 | err = scsi_esp_register(esp, &pdev->dev); |
502 | if (err) | 502 | if (err) |
503 | goto fail_free_irq; | 503 | goto fail_free_irq; |
@@ -507,6 +507,7 @@ static int pci_esp_probe_one(struct pci_dev *pdev, | |||
507 | fail_free_irq: | 507 | fail_free_irq: |
508 | free_irq(pdev->irq, esp); | 508 | free_irq(pdev->irq, esp); |
509 | fail_unmap_command_block: | 509 | fail_unmap_command_block: |
510 | pci_set_drvdata(pdev, NULL); | ||
510 | pci_free_consistent(pdev, 16, esp->command_block, | 511 | pci_free_consistent(pdev, 16, esp->command_block, |
511 | esp->command_block_dma); | 512 | esp->command_block_dma); |
512 | fail_unmap_regs: | 513 | fail_unmap_regs: |
@@ -530,6 +531,7 @@ static void pci_esp_remove_one(struct pci_dev *pdev) | |||
530 | 531 | ||
531 | scsi_esp_unregister(esp); | 532 | scsi_esp_unregister(esp); |
532 | free_irq(pdev->irq, esp); | 533 | free_irq(pdev->irq, esp); |
534 | pci_set_drvdata(pdev, NULL); | ||
533 | pci_free_consistent(pdev, 16, esp->command_block, | 535 | pci_free_consistent(pdev, 16, esp->command_block, |
534 | esp->command_block_dma); | 536 | esp->command_block_dma); |
535 | pci_iounmap(pdev, esp->regs); | 537 | pci_iounmap(pdev, esp->regs); |