Skip to content

Commit e95b478

Browse files
javed-hmartinkpetersen
authored andcommitted
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]>
1 parent a8ac783 commit e95b478

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/fcoe/fcoe_ctlr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new)
256256
WARN_ON(!fcf_dev);
257257
new->fcf_dev = NULL;
258258
fcoe_fcf_device_delete(fcf_dev);
259-
kfree(new);
260259
mutex_unlock(&cdev->lock);
261260
}
261+
kfree(new);
262262
}
263263

264264
/**

0 commit comments

Comments
 (0)