mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 08:19:28 +00:00
scsi: pm8001: Fix tag leaks on error
[ Upstream commit 4c8f04b190
]
In pm8001_chip_set_dev_state_req(), pm8001_chip_fw_flash_update_req(),
pm80xx_chip_phy_ctl_req() and pm8001_chip_reg_dev_req() add missing calls
to pm8001_tag_free() to free the allocated tag when pm8001_mpi_build_cmd()
fails.
Similarly, in pm8001_exec_internal_task_abort(), if the chip ->task_abort
method fails, the tag allocated for the abort request task must be
freed. Add the missing call to pm8001_tag_free().
Link: https://lore.kernel.org/r/20220220031810.738362-22-damien.lemoal@opensource.wdc.com
Reviewed-by: John Garry <john.garry@huawei.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>
This commit is contained in:
parent
34c79d16ee
commit
9cc72bcc1c
3 changed files with 17 additions and 3 deletions
|
@ -4465,6 +4465,9 @@ static int pm8001_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha,
|
||||||
SAS_ADDR_SIZE);
|
SAS_ADDR_SIZE);
|
||||||
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
|
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
|
||||||
sizeof(payload), 0);
|
sizeof(payload), 0);
|
||||||
|
if (rc)
|
||||||
|
pm8001_tag_free(pm8001_ha, tag);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4877,6 +4880,9 @@ pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha,
|
||||||
ccb->ccb_tag = tag;
|
ccb->ccb_tag = tag;
|
||||||
rc = pm8001_chip_fw_flash_update_build(pm8001_ha, &flash_update_info,
|
rc = pm8001_chip_fw_flash_update_build(pm8001_ha, &flash_update_info,
|
||||||
tag);
|
tag);
|
||||||
|
if (rc)
|
||||||
|
pm8001_tag_free(pm8001_ha, tag);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4981,6 +4987,9 @@ pm8001_chip_set_dev_state_req(struct pm8001_hba_info *pm8001_ha,
|
||||||
payload.nds = cpu_to_le32(state);
|
payload.nds = cpu_to_le32(state);
|
||||||
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
|
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
|
||||||
sizeof(payload), 0);
|
sizeof(payload), 0);
|
||||||
|
if (rc)
|
||||||
|
pm8001_tag_free(pm8001_ha, tag);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -847,10 +847,10 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha,
|
||||||
|
|
||||||
res = PM8001_CHIP_DISP->task_abort(pm8001_ha,
|
res = PM8001_CHIP_DISP->task_abort(pm8001_ha,
|
||||||
pm8001_dev, flag, task_tag, ccb_tag);
|
pm8001_dev, flag, task_tag, ccb_tag);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
del_timer(&task->slow_task->timer);
|
del_timer(&task->slow_task->timer);
|
||||||
pm8001_dbg(pm8001_ha, FAIL, "Executing internal task failed\n");
|
pm8001_dbg(pm8001_ha, FAIL, "Executing internal task failed\n");
|
||||||
|
pm8001_tag_free(pm8001_ha, ccb_tag);
|
||||||
goto ex_err;
|
goto ex_err;
|
||||||
}
|
}
|
||||||
wait_for_completion(&task->slow_task->completion);
|
wait_for_completion(&task->slow_task->completion);
|
||||||
|
|
|
@ -4920,8 +4920,13 @@ static int pm80xx_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,
|
||||||
payload.tag = cpu_to_le32(tag);
|
payload.tag = cpu_to_le32(tag);
|
||||||
payload.phyop_phyid =
|
payload.phyop_phyid =
|
||||||
cpu_to_le32(((phy_op & 0xFF) << 8) | (phyId & 0xFF));
|
cpu_to_le32(((phy_op & 0xFF) << 8) | (phyId & 0xFF));
|
||||||
return pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
|
|
||||||
sizeof(payload), 0);
|
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
|
||||||
|
sizeof(payload), 0);
|
||||||
|
if (rc)
|
||||||
|
pm8001_tag_free(pm8001_ha, tag);
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 pm80xx_chip_is_our_interrupt(struct pm8001_hba_info *pm8001_ha)
|
static u32 pm80xx_chip_is_our_interrupt(struct pm8001_hba_info *pm8001_ha)
|
||||||
|
|
Loading…
Reference in a new issue