@@ -3249,7 +3249,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
ql_log_pci(ql_log_fatal, pdev, 0x0031,
"Failed to allocate memory for adapter, aborting.\n");
- goto probe_hw_failed;
+ goto mem_alloc_failed;
}
req->max_q_depth = MAX_Q_DEPTH;
@@ -3660,6 +3660,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
probe_hw_failed:
qla2x00_mem_free(ha);
+
+mem_alloc_failed:
qla2x00_free_req_que(ha, req);
qla2x00_free_rsp_que(ha, rsp);
qla2x00_clear_drv_active(ha);
When qla2x00_mem_alloc() fails, it has cleaned up resources in its error paths. However, qla2x00_probe_one() calls qla2x00_mem_free() on failure of qla2x00_mem_alloc() and tries to free the resources again, which may casue a double-free. Fixes: d64d6c5671db ("scsi: qla2xxx: Fix NULL pointer crash due to probe failure") Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> --- drivers/scsi/qla2xxx/qla_os.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)