scsi: qla2xxx: fix a memleak in qla2x00_mem_alloc
Subsystems (2)
PATCH 1/1 scsi: qla2xxx: fix a memleak in qla2x00_mem_alloc
When the dsd allocated in the for loop by kzalloc fails, it should gc all the resources allocated before, instead of just return a -ENOMEM.
According to the error-handling behavior of ha->dif_bundl_pool, the dsd's failure should free every resources after fail_dif_bundl_dma_pool, together with ha->dif_bundl_pool itself. So the error-handling should goes to label fail_dma_pool.
Fixes 50b812755e97 ("scsi: qla2xxx: Fix DMA error when the DIF sg buffer crosses 4GB boundary")
Signed-off-by Zhipeng Lu <[email protected]>
--- drivers/scsi/qla2xxx/qla_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_os.c +1 -1
@@ -4252,7 +4252,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,ql_dbg_pci (ql_dbg_init, ha->pdev,0xe0ee ,"%s: failed alloc dsd\n" , __func__); -return -ENOMEM ; + goto fail_dma_pool; } ha->dif_bundle_kallocs++;
Signature · 1 line
2.34.1