Subject: CVE-2023-52809: scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup()

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

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

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

scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup()

fc_lport_ptp_setup() did not check the return value of fc_rport_create()
which can return NULL and would cause a NULL pointer dereference. Address
this issue by checking return value of fc_rport_create() and log error
message on fc_rport_create() failed.

The Linux kernel CVE team has assigned CVE-2023-52809 to this issue.

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

	Fixed in 4.14.331 with commit 930f0aaba482
	Fixed in 4.19.300 with commit 77072ec41d6a
	Fixed in 5.4.262 with commit b549acf99982
	Fixed in 5.10.202 with commit bb83f79f90e9
	Fixed in 5.15.140 with commit 56d78b5495eb
	Fixed in 6.1.64 with commit 442fd24d7b6b
	Fixed in 6.5.13 with commit f6fe7261b92b
	Fixed in 6.6.3 with commit 6b9ecf4e1032
	Fixed in 6.7 with commit 4df105f0ce9f

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-2023-52809
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/libfc/fc_lport.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/930f0aaba4820d6362de4e6ed569eaf444f1ea4e
	https://git.kernel.org/stable/c/77072ec41d6ab3718c3fc639bc149b8037caedfa
	https://git.kernel.org/stable/c/b549acf999824d4f751ca57965700372f2f3ad00
	https://git.kernel.org/stable/c/bb83f79f90e92f46466adcfd4fd264a7ae0f0f01
	https://git.kernel.org/stable/c/56d78b5495ebecbb9395101f3be177cd0a52450b
	https://git.kernel.org/stable/c/442fd24d7b6b29e4a9cd9225afba4142d5f522ba
	https://git.kernel.org/stable/c/f6fe7261b92b21109678747f36df9fdab1e30c34
	https://git.kernel.org/stable/c/6b9ecf4e1032e645873933e5b43cbb84cac19106
	https://git.kernel.org/stable/c/4df105f0ce9f6f30cda4e99f577150d23f0c9c5f