Commit e95b4789 authored by Javed Hasan's avatar Javed Hasan Committed by Martin K. Petersen

scsi: fcoe: Memory leak fix in fcoe_sysfs_fcf_del()

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.comReviewed-by: default avatarGirish Basrur <gbasrur@marvell.com>
Reviewed-by: default avatarSantosh Vernekar <svernekar@marvell.com>
Reviewed-by: default avatarSaurav Kashyap <skashyap@marvell.com>
Reviewed-by: default avatarShyam Sundar <ssundar@marvell.com>
Signed-off-by: default avatarJaved Hasan <jhasan@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a8ac7835
...@@ -256,9 +256,9 @@ static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new) ...@@ -256,9 +256,9 @@ static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new)
WARN_ON(!fcf_dev); WARN_ON(!fcf_dev);
new->fcf_dev = NULL; new->fcf_dev = NULL;
fcoe_fcf_device_delete(fcf_dev); fcoe_fcf_device_delete(fcf_dev);
kfree(new);
mutex_unlock(&cdev->lock); mutex_unlock(&cdev->lock);
} }
kfree(new);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment