diff options
author | Damien Le Moal <damien.lemoal@opensource.wdc.com> | 2022-02-20 12:18:01 +0900 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2022-02-22 21:31:20 -0500 |
commit | f792a3629f4c4aa4c3703d66b43ce1edcc3ec09a (patch) | |
tree | 1f789835f77d978cb753db0aaa63ccbf1e449782 | |
parent | 4c8f04b1905cd4b776d0b720463c091545478ef7 (diff) | |
download | linux-f792a3629f4c4aa4c3703d66b43ce1edcc3ec09a.tar.bz2 |
scsi: pm8001: Fix memory leak in pm8001_chip_fw_flash_update_req()
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>
-rw-r--r-- | drivers/scsi/pm8001/pm8001_hwi.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index ba7cefb803c3..14bc4f88c6e6 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -4873,8 +4873,10 @@ pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha, ccb->ccb_tag = tag; rc = pm8001_chip_fw_flash_update_build(pm8001_ha, &flash_update_info, tag); - if (rc) + if (rc) { + kfree(fw_control_context); pm8001_tag_free(pm8001_ha, tag); + } return rc; } |