]> www.infradead.org Git - users/jedix/linux-maple.git/commit
scsi: lpfc: Check kzalloc() in lpfc_sli4_cgn_params_read()
authorJustin Tee <justin.tee@broadcom.com>
Tue, 28 Feb 2023 04:43:36 +0000 (20:43 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Mar 2023 10:49:18 +0000 (12:49 +0200)
commit4829a1e1171536978b240a1438789c2e4d5c9715
treee11fee368e4bdd30fa00488ac7ca54f7d87ffc75
parent476d8ca83e6c611f499d327777e688e8b76ac657
scsi: lpfc: Check kzalloc() in lpfc_sli4_cgn_params_read()

[ Upstream commit 312320b0e0ec21249a17645683fe5304d796aec1 ]

If kzalloc() fails in lpfc_sli4_cgn_params_read(), then we rely on
lpfc_read_object()'s routine to NULL check pdata.

Currently, an early return error is thrown from lpfc_read_object() to
protect us from NULL ptr dereference, but the errno code is -ENODEV.

Change the errno code to a more appropriate -ENOMEM.

Reported-by: Kang Chen <void0red@gmail.com>
Link: https://lore.kernel.org/all/20230226102338.3362585-1-void0red@gmail.com
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20230228044336.5195-1-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_sli.c