scsi: fcoe: Memory leak fix in fcoe_sysfs_fcf_del()
authorJaved Hasan <jhasan@marvell.com>
Wed, 29 Jul 2020 08:18:24 +0000 (01:18 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:21:18 +0000 (11:21 +0200)
commit1b3fb46bf309aff3db96d79b7e3db328f489eab5
treef7b8735a9d70b4d4873b334d5e1de2f873405485
parentae1924d8be9959dda021e9d7dd90ab7171db1664
scsi: fcoe: Memory leak fix in fcoe_sysfs_fcf_del()

[ Upstream commit e95b4789ff4380733006836d28e554dc296b2298 ]

In fcoe_sysfs_fcf_del(), we first deleted the fcf from the list and then
freed it if ctlr_dev was not NULL. This was causing a memory leak.

Free the fcf even if ctlr_dev is NULL.

Link: https://lore.kernel.org/r/20200729081824.30996-3-jhasan@marvell.com
Reviewed-by: Girish Basrur <gbasrur@marvell.com>
Reviewed-by: Santosh Vernekar <svernekar@marvell.com>
Reviewed-by: Saurav Kashyap <skashyap@marvell.com>
Reviewed-by: Shyam Sundar <ssundar@marvell.com>
Signed-off-by: Javed Hasan <jhasan@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/fcoe/fcoe_ctlr.c