Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Damien Le Moal and committed by
Martin K. Petersen
f792a362 4c8f04b1

+3 -1
+3 -1
drivers/scsi/pm8001/pm8001_hwi.c
··· 4873 4873 ccb->ccb_tag = tag; 4874 4874 rc = pm8001_chip_fw_flash_update_build(pm8001_ha, &flash_update_info, 4875 4875 tag); 4876 - if (rc) 4876 + if (rc) { 4877 + kfree(fw_control_context); 4877 4878 pm8001_tag_free(pm8001_ha, tag); 4879 + } 4878 4880 4879 4881 return rc; 4880 4882 }