Subject: CVE-2024-35930: scsi: lpfc: Fix possible memory leak in lpfc_rcv_padisc()

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

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

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

scsi: lpfc: Fix possible memory leak in lpfc_rcv_padisc()

The call to lpfc_sli4_resume_rpi() in lpfc_rcv_padisc() may return an
unsuccessful status.  In such cases, the elsiocb is not issued, the
completion is not called, and thus the elsiocb resource is leaked.

Check return value after calling lpfc_sli4_resume_rpi() and conditionally
release the elsiocb resource.

The Linux kernel CVE team has assigned CVE-2024-35930 to this issue.

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

	Fixed in 4.19.312 with commit edf82aa7e9eb
	Fixed in 5.4.274 with commit e2cd32435b1d
	Fixed in 5.10.215 with commit c473288f27d1
	Fixed in 5.15.155 with commit 7849e6f8410d
	Fixed in 6.1.86 with commit ee0b5f96b6d6
	Fixed in 6.6.27 with commit 07a2aa674fca
	Fixed in 6.8.6 with commit 3320126ed3af
	Fixed in 6.9 with commit 2ae917d4bcab

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-2024-35930
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

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/edf82aa7e9eb864a09229392054d131b34a5c9e8
	https://git.kernel.org/stable/c/e2cd32435b1dff3d63759476a3abc878e02fb6c8
	https://git.kernel.org/stable/c/c473288f27d15014447de5a891bdf22a0695847a
	https://git.kernel.org/stable/c/7849e6f8410da96384e3d1f6b6d730f095142dc7
	https://git.kernel.org/stable/c/ee0b5f96b6d66a1e6698228dcb41df11ec7f352f
	https://git.kernel.org/stable/c/07a2aa674fca679316b8ac51440adb895b53a7cf
	https://git.kernel.org/stable/c/3320126ed3afbc11934502319b340f91a4d61c8f
	https://git.kernel.org/stable/c/2ae917d4bcab80ab304b774d492e2fcd6c52c06b