Skip to content

Commit

Permalink
[SCSI] mptbase: fix use-after-free's
Browse files Browse the repository at this point in the history
ioc->name is used in the printk's after ioc has been freed.  Free
after prinks to fix this.

This patch fixes two use-after-free's introduced by
commit e78d5b8 and spotted by the
Coverity checker.

Signed-off-by: Adrian Bunk <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
  • Loading branch information
AdrianBunk authored and James Bottomley committed Feb 22, 2008
1 parent 3b0f208 commit ad008d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/message/fusion/mptbase.c
Original file line number Diff line number Diff line change
Expand Up @@ -1481,15 +1481,15 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)

ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM);
if (pci_enable_device_mem(pdev)) {
kfree(ioc);
printk(MYIOC_s_ERR_FMT "pci_enable_device_mem() "
"failed\n", ioc->name);
kfree(ioc);
return r;
}
if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) {
kfree(ioc);
printk(MYIOC_s_ERR_FMT "pci_request_selected_regions() with "
"MEM failed\n", ioc->name);
kfree(ioc);
return r;
}

Expand Down

0 comments on commit ad008d4

Please sign in to comment.