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

Commit d580c613 authored by James Smart's avatar James Smart Committed by Martin K. Petersen
Browse files

scsi: lpfc: Fix panic if driver unloaded when port is offline



System crashes when the lpfc module is unloaded after making the port
offline

The nvme queue pointers were freed during port offline, but were later
accessed in pci remove path.

Validate the pointers in pci remove path before accessing them.

Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 5cc167dd
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -2970,7 +2970,7 @@ lpfc_nvme_wait_for_io_drain(struct lpfc_hba *phba)
	struct lpfc_sli_ring  *pring;
	struct lpfc_sli_ring  *pring;
	u32 i, wait_cnt = 0;
	u32 i, wait_cnt = 0;


	if (phba->sli_rev < LPFC_SLI_REV4)
	if (phba->sli_rev < LPFC_SLI_REV4 || !phba->sli4_hba.nvme_wq)
		return;
		return;


	/* Cycle through all NVME rings and make sure all outstanding
	/* Cycle through all NVME rings and make sure all outstanding
@@ -2979,6 +2979,9 @@ lpfc_nvme_wait_for_io_drain(struct lpfc_hba *phba)
	for (i = 0; i < phba->cfg_nvme_io_channel; i++) {
	for (i = 0; i < phba->cfg_nvme_io_channel; i++) {
		pring = phba->sli4_hba.nvme_wq[i]->pring;
		pring = phba->sli4_hba.nvme_wq[i]->pring;


		if (!pring)
			continue;

		/* Retrieve everything on the txcmplq */
		/* Retrieve everything on the txcmplq */
		while (!list_empty(&pring->txcmplq)) {
		while (!list_empty(&pring->txcmplq)) {
			msleep(LPFC_XRI_EXCH_BUSY_WAIT_T1);
			msleep(LPFC_XRI_EXCH_BUSY_WAIT_T1);