]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup()
authorWenchao Hao <haowenchao2@huawei.com>
Wed, 11 Oct 2023 13:03:50 +0000 (21:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2023 16:45:43 +0000 (16:45 +0000)
commit930f0aaba4820d6362de4e6ed569eaf444f1ea4e
tree2114d3d037b2f57cc2578e3a56c77369463b636f
parentfe6771fce053e3acca37a419750c07d45f3ff91e
scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup()

[ Upstream commit 4df105f0ce9f6f30cda4e99f577150d23f0c9c5f ]

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.

Signed-off-by: Wenchao Hao <haowenchao2@huawei.com>
Link: https://lore.kernel.org/r/20231011130350.819571-1-haowenchao2@huawei.com
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/libfc/fc_lport.c