[SCSI] mptbase: fix use-after-free's
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 e78d5b8f1e
and spotted by the
Coverity checker.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
committed by
James Bottomley
parent
3b0f208a58
commit
ad008d42bc
@@ -1481,15 +1481,15 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||||||
|
|
||||||
ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM);
|
ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM);
|
||||||
if (pci_enable_device_mem(pdev)) {
|
if (pci_enable_device_mem(pdev)) {
|
||||||
kfree(ioc);
|
|
||||||
printk(MYIOC_s_ERR_FMT "pci_enable_device_mem() "
|
printk(MYIOC_s_ERR_FMT "pci_enable_device_mem() "
|
||||||
"failed\n", ioc->name);
|
"failed\n", ioc->name);
|
||||||
|
kfree(ioc);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) {
|
if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) {
|
||||||
kfree(ioc);
|
|
||||||
printk(MYIOC_s_ERR_FMT "pci_request_selected_regions() with "
|
printk(MYIOC_s_ERR_FMT "pci_request_selected_regions() with "
|
||||||
"MEM failed\n", ioc->name);
|
"MEM failed\n", ioc->name);
|
||||||
|
kfree(ioc);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user