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@xxxxxxxxxxx> Reviewed-by: Santosh Vernekar <svernekar@xxxxxxxxxxx> Reviewed-by: Saurav Kashyap <skashyap@xxxxxxxxxxx> Reviewed-by: Shyam Sundar <ssundar@xxxxxxxxxxx> Signed-off-by: Javed Hasan <jhasan@xxxxxxxxxxx> --- drivers/scsi/fcoe/fcoe_ctlr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } /** -- 1.8.3.1