提交 f90a7489 编写于 作者: D Damien Le Moal 提交者: Martin K. Petersen

scsi: pm8001: Fix task leak in pm8001_send_abort_all()

In pm8001_send_abort_all(), make sure to free the allocated sas task
if pm8001_tag_alloc() or pm8001_mpi_build_cmd() fail.

Link: https://lore.kernel.org/r/20220220031810.738362-21-damien.lemoal@opensource.wdc.comReviewed-by: NJohn Garry <john.garry@huawei.com>
Signed-off-by: NDamien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 7fb23a78
...@@ -1764,7 +1764,6 @@ static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha, ...@@ -1764,7 +1764,6 @@ static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha,
} }
task = sas_alloc_slow_task(GFP_ATOMIC); task = sas_alloc_slow_task(GFP_ATOMIC);
if (!task) { if (!task) {
pm8001_dbg(pm8001_ha, FAIL, "cannot allocate task\n"); pm8001_dbg(pm8001_ha, FAIL, "cannot allocate task\n");
return; return;
...@@ -1773,8 +1772,10 @@ static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha, ...@@ -1773,8 +1772,10 @@ static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha,
task->task_done = pm8001_task_done; task->task_done = pm8001_task_done;
res = pm8001_tag_alloc(pm8001_ha, &ccb_tag); res = pm8001_tag_alloc(pm8001_ha, &ccb_tag);
if (res) if (res) {
sas_free_task(task);
return; return;
}
ccb = &pm8001_ha->ccb_info[ccb_tag]; ccb = &pm8001_ha->ccb_info[ccb_tag];
ccb->device = pm8001_ha_dev; ccb->device = pm8001_ha_dev;
...@@ -1791,8 +1792,10 @@ static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha, ...@@ -1791,8 +1792,10 @@ static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha,
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort, ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort,
sizeof(task_abort), 0); sizeof(task_abort), 0);
if (ret) if (ret) {
sas_free_task(task);
pm8001_tag_free(pm8001_ha, ccb_tag); pm8001_tag_free(pm8001_ha, ccb_tag);
}
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册