Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Hannes Reinecke and committed by
James Bottomley
8041708e 16b8528d

+4 -2
+4 -2
drivers/scsi/am53c974.c
··· 476 476 goto fail_unmap_regs; 477 477 } 478 478 479 + pci_set_drvdata(pdev, pep); 480 + 479 481 err = request_irq(pdev->irq, scsi_esp_intr, IRQF_SHARED, 480 482 DRV_MODULE_NAME, esp); 481 483 if (err < 0) { ··· 498 496 /* Assume 40MHz clock */ 499 497 esp->cfreq = 40000000; 500 498 501 - pci_set_drvdata(pdev, pep); 502 - 503 499 err = scsi_esp_register(esp, &pdev->dev); 504 500 if (err) 505 501 goto fail_free_irq; ··· 507 507 fail_free_irq: 508 508 free_irq(pdev->irq, esp); 509 509 fail_unmap_command_block: 510 + pci_set_drvdata(pdev, NULL); 510 511 pci_free_consistent(pdev, 16, esp->command_block, 511 512 esp->command_block_dma); 512 513 fail_unmap_regs: ··· 531 530 532 531 scsi_esp_unregister(esp); 533 532 free_irq(pdev->irq, esp); 533 + pci_set_drvdata(pdev, NULL); 534 534 pci_free_consistent(pdev, 16, esp->command_block, 535 535 esp->command_block_dma); 536 536 pci_iounmap(pdev, esp->regs);