[2/2] scsi: fcoe: memory leak fix in fcoe_sysfs_fcf_del().
diff mbox series

Message ID 20200729081824.30996-3-jhasan@marvell.com
State Accepted
Headers show
Series
  • qedf: Memory leak fixes for fcoe and libfc.
Related show

Commit Message

Javed Hasan July 29, 2020, 8:18 a.m. UTC
In fcoe_sysfs_fcf_del(), we first deleted the fcf from the list and
 free it if ctlr_dev is not NULL.
 This was causing the memory leak for fcf.

 This fix is just to free the fcf even if ctlr_dev is NULL or not.

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>
---
 drivers/scsi/fcoe/fcoe_ctlr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
index 1791a39..d2f5c6f 100644
--- a/drivers/scsi/fcoe/fcoe_ctlr.c
+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
@@ -255,9 +255,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);
 }
 
 /**