CVE-2022-49534: scsi: lpfc: Protect memory leak for NPIV ports sending PLOGI_RJT
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
scsi: lpfc: Protect memory leak for NPIV ports sending PLOGI_RJT
There is a potential memory leak in lpfc_ignore_els_cmpl() and lpfc_els_rsp_reject() that was allocated from NPIV PLOGI_RJT (lpfc_rcv_plogi()'s login_mbox).
Check if cmdiocb->context_un.mbox was allocated in lpfc_ignore_els_cmpl(), and then free it back to phba->mbox_mem_pool along with mbox->ctx_buf for service parameters.
For lpfc_els_rsp_reject() failure, free both the ctx_buf for service parameters and the login_mbox.
The Linux kernel CVE team has assigned CVE-2022-49534 to this issue.
Affected and fixed versions
===========================
Fixed in 5.18.3 with commit c00df0f34a6d5e14da379f96ea67e501ce67b002 Fixed in 5.19 with commit 672d1cb40551ea9c95efad43ab6d45e4ab4e015f
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2022-49534
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
drivers/scsi/lpfc/lpfc_nportdisc.c
drivers/scsi/lpfc/lpfc_sli.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/c00df0f34a6d5e14da379f96ea67e501ce67b002 https://git.kernel.org/stable/c/672d1cb40551ea9c95efad43ab6d45e4ab4e015f