Skip to content

Commit e5ecdb0

Browse files
Damien Le Moalgregkh
authored andcommitted
scsi: pm8001: Fix memory leak in pm8001_chip_fw_flash_update_req()
[ Upstream commit f792a36 ] In pm8001_chip_fw_flash_update_build(), if pm8001_chip_fw_flash_update_build() fails, the struct fw_control_ex allocated must be freed. Link: https://lore.kernel.org/r/20220220031810.738362-23-damien.lemoal@opensource.wdc.com Reviewed-by: Jack Wang <jinpu.wang@ionos.com> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 43c617e commit e5ecdb0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/scsi/pm8001/pm8001_hwi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4903,8 +4903,10 @@ pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha,
49034903
ccb->ccb_tag = tag;
49044904
rc = pm8001_chip_fw_flash_update_build(pm8001_ha, &flash_update_info,
49054905
tag);
4906-
if (rc)
4906+
if (rc) {
4907+
kfree(fw_control_context);
49074908
pm8001_tag_free(pm8001_ha, tag);
4909+
}
49084910

49094911
return rc;
49104912
}

0 commit comments

Comments
 (0)