aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaved Hasan <[email protected]>2020-07-29 01:18:24 -0700
committerMartin K. Petersen <[email protected]>2020-08-04 20:56:56 -0400
commite95b4789ff4380733006836d28e554dc296b2298 (patch)
tree055493c6a9797f80129039559bb1156b55a6b21f
parenta8ac78357d9b71a5608c609094ad3b114a46ccd4 (diff)
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/[email protected] Reviewed-by: Girish Basrur <[email protected]> Reviewed-by: Santosh Vernekar <[email protected]> Reviewed-by: Saurav Kashyap <[email protected]> Reviewed-by: Shyam Sundar <[email protected]> Signed-off-by: Javed Hasan <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
-rw-r--r--drivers/scsi/fcoe/fcoe_ctlr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
index 85c7959961cc..1409c7687853 100644
--- a/drivers/scsi/fcoe/fcoe_ctlr.c
+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
@@ -256,9 +256,9 @@ static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new)
WARN_ON(!fcf_dev);
new->fcf_dev = NULL;
fcoe_fcf_device_delete(fcf_dev);
- kfree(new);
mutex_unlock(&cdev->lock);
}
+ kfree(new);
}
/**