]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: lpfc: Fix memory leak on lcb_context
authorColin Ian King <colin.king@canonical.com>
Wed, 18 Nov 2020 14:13:14 +0000 (14:13 +0000)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 20 Nov 2020 03:16:00 +0000 (22:16 -0500)
commit8f9e501f86e9cfc3ba909f2cf658b88758a59bd8
treeabaec277e14ca5d71da4ebcdf1e72eb22d2ab0a5
parentd599b04f763f9a60762c192dc0361fadf30c9584
scsi: lpfc: Fix memory leak on lcb_context

Currently there is an error return path that neglects to free the
allocation for lcb_context.  Fix this by adding a new error free exit path
that kfree's lcb_context before returning.  Use this new kfree exit path in
another exit error path that also kfree's the same object, allowing a line
of code to be removed.

Link: https://lore.kernel.org/r/20201118141314.462471-1-colin.king@canonical.com
Fixes: 881570427668 ("scsi: lpfc: Rework locations of ndlp reference taking")
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Addresses-Coverity: ("Resource leak")
drivers/scsi/lpfc/lpfc_els.c