Skip to contentSkip to conversation

CVE-2022-50827: scsi: lpfc: Fix memory leak in lpfc_create_port()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Dec 30, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

scsi: lpfc: Fix memory leak in lpfc_create_port()

Commit 5e633302ace1 ("scsi: lpfc: vmid: Add support for VMID in mailbox command") introduced allocations for the VMID resources in lpfc_create_port() after the call to scsi_host_alloc(). Upon failure on the VMID allocations, the new code would branch to the 'out' label, which returns NULL without unwinding anything, thus skipping the call to scsi_host_put().

Fix the problem by creating a separate label 'out_free_vmid' to unwind the VMID resources and make the 'out_put_shost' label call only scsi_host_put(), as was done before the introduction of allocations for VMID.

The Linux kernel CVE team has assigned CVE-2022-50827 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.14 with commit 5e633302ace1f61f8ea5a3ce21e19a4d79126cca and fixed in 5.15.76 with commit 9749595feb33a1a2b848800192224ffeed5346b4
	Issue introduced in 5.14 with commit 5e633302ace1f61f8ea5a3ce21e19a4d79126cca and fixed in 6.0.6 with commit 5ea1f195f51c2bb5915ccfb2b2885ca81ce9262b
	Issue introduced in 5.14 with commit 5e633302ace1f61f8ea5a3ce21e19a4d79126cca and fixed in 6.1 with commit dc8e483f684a24cc06e1d5fa958b54db58855093

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-50827

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_init.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/9749595feb33a1a2b848800192224ffeed5346b4
	https://git.kernel.org/stable/c/5ea1f195f51c2bb5915ccfb2b2885ca81ce9262b
	https://git.kernel.org/stable/c/dc8e483f684a24cc06e1d5fa958b54db58855093