Message ID | 20231203181342.3289136-1-alexious@zju.edu.cn |
---|---|
State | New |
Headers | show |
Series | scsi: qla2xxx: fix a memleak in qla2x00_mem_alloc | expand |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 50db08265c51..bdd66f9e8850 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -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++;
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 <alexious@zju.edu.cn> --- drivers/scsi/qla2xxx/qla_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)