Commit 04d210c9 authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: Fix memory leak in abnormal exit path from lpfc_eq_create

eq create is leaking mailbox memory if it encounters an error.

rework error path to free the memory.
Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent c15e0704
...@@ -14641,8 +14641,10 @@ lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax) ...@@ -14641,8 +14641,10 @@ lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax)
lpfc_printf_log(phba, KERN_ERR, LOG_SLI, lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
"0360 Unsupported EQ count. (%d)\n", "0360 Unsupported EQ count. (%d)\n",
eq->entry_count); eq->entry_count);
if (eq->entry_count < 256) if (eq->entry_count < 256) {
return -EINVAL; status = -EINVAL;
goto out;
}
/* fall through - otherwise default to smallest count */ /* fall through - otherwise default to smallest count */
case 256: case 256:
bf_set(lpfc_eq_context_count, &eq_create->u.request.context, bf_set(lpfc_eq_context_count, &eq_create->u.request.context,
...@@ -14694,7 +14696,7 @@ lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax) ...@@ -14694,7 +14696,7 @@ lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax)
eq->host_index = 0; eq->host_index = 0;
eq->notify_interval = LPFC_EQ_NOTIFY_INTRVL; eq->notify_interval = LPFC_EQ_NOTIFY_INTRVL;
eq->max_proc_limit = LPFC_EQ_MAX_PROC_LIMIT; eq->max_proc_limit = LPFC_EQ_MAX_PROC_LIMIT;
out:
mempool_free(mbox, phba->mbox_mem_pool); mempool_free(mbox, phba->mbox_mem_pool);
return status; return status;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment