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

Configure Feed

Select the types of activity you want to include in your feed.

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.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>

authored by

Damien Le Moal and committed by
Martin K. Petersen
f90a7489 7fb23a78

+6 -3
+6 -3
drivers/scsi/pm8001/pm8001_hwi.c
··· 1764 1764 } 1765 1765 1766 1766 task = sas_alloc_slow_task(GFP_ATOMIC); 1767 - 1768 1767 if (!task) { 1769 1768 pm8001_dbg(pm8001_ha, FAIL, "cannot allocate task\n"); 1770 1769 return; ··· 1772 1773 task->task_done = pm8001_task_done; 1773 1774 1774 1775 res = pm8001_tag_alloc(pm8001_ha, &ccb_tag); 1775 - if (res) 1776 + if (res) { 1777 + sas_free_task(task); 1776 1778 return; 1779 + } 1777 1780 1778 1781 ccb = &pm8001_ha->ccb_info[ccb_tag]; 1779 1782 ccb->device = pm8001_ha_dev; ··· 1792 1791 1793 1792 ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort, 1794 1793 sizeof(task_abort), 0); 1795 - if (ret) 1794 + if (ret) { 1795 + sas_free_task(task); 1796 1796 pm8001_tag_free(pm8001_ha, ccb_tag); 1797 + } 1797 1798 1798 1799 } 1799 1800