Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 295a863b authored by Pan Bian's avatar Pan Bian Committed by Greg Kroah-Hartman
Browse files

scsi: bnx2i: fix potential use after free

commit 29d28f2b8d3736ac61c28ef7e20fda63795b74d9 upstream.

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: a7717180 ("[SCSI] bnx2i: Removed the reference to the netdev->base_addr")
Link: https://lore.kernel.org/r/1573043541-19126-1-git-send-email-bianpan2016@163.com


Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e3c9310b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -915,12 +915,12 @@ void bnx2i_free_hba(struct bnx2i_hba *hba)
	INIT_LIST_HEAD(&hba->ep_ofld_list);
	INIT_LIST_HEAD(&hba->ep_active_list);
	INIT_LIST_HEAD(&hba->ep_destroy_list);
	pci_dev_put(hba->pcidev);

	if (hba->regview) {
		pci_iounmap(hba->pcidev, hba->regview);
		hba->regview = NULL;
	}
	pci_dev_put(hba->pcidev);
	bnx2i_free_mp_bdt(hba);
	bnx2i_release_free_cid_que(hba);
	iscsi_host_free(shost);