Skip to content

Commit 29d28f2

Browse files
SinkFindermartinkpetersen
authored andcommitted
scsi: bnx2i: fix potential use after free
The member hba->pcidev may be used after its reference is dropped. Move the put function to where it is never used to avoid potential use after free issues. Fixes: a771718 ("[SCSI] bnx2i: Removed the reference to the netdev->base_addr") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Pan Bian <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 5a993e5 commit 29d28f2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/bnx2i/bnx2i_iscsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,12 +915,12 @@ void bnx2i_free_hba(struct bnx2i_hba *hba)
915915
INIT_LIST_HEAD(&hba->ep_ofld_list);
916916
INIT_LIST_HEAD(&hba->ep_active_list);
917917
INIT_LIST_HEAD(&hba->ep_destroy_list);
918-
pci_dev_put(hba->pcidev);
919918

920919
if (hba->regview) {
921920
pci_iounmap(hba->pcidev, hba->regview);
922921
hba->regview = NULL;
923922
}
923+
pci_dev_put(hba->pcidev);
924924
bnx2i_free_mp_bdt(hba);
925925
bnx2i_release_free_cid_que(hba);
926926
iscsi_host_free(shost);

0 commit comments

Comments
 (0)