Skip to contentSkip to conversation

SCSI: qla4xxx: fix double free bug

PATCH Applied Pan Bian 3 participants 3 messages Nov 5, 2019 – Nov 19, 2019

Subsystems (2)
lore
Share & tools
lore

Pan Bian

author
#0 lore raw

PATCH 1/1 SCSI: qla4xxx: fix double free bug

The variable init_fw_cb is released twice, resulting in a double free bug. The call to the function dma_free_coherent() before goto is removed to get rid of potential double free.

Fixes 2a49a78ed3c ("[SCSI] qla4xxx: added IPv6 support.")
---
 drivers/scsi/qla4xxx/ql4_mbx.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/scsi/qla4xxx/ql4_mbx.c +0 -3
index dac9a7013208..02636b4785c5 100644
@@ -640,9 +640,6 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)
 
 	if (qla4xxx_get_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma) !=
 	    QLA_SUCCESS) {
-		dma_free_coherent(&ha->pdev->dev,
-				  sizeof(struct addr_ctrl_blk),
-				  init_fw_cb, init_fw_cb_dma);
 		goto exit_init_fw_cb;
 	}
 
Signature · 1 line
2.7.4
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 30 lines

-----Original Message-----
From: [email protected] <linux-scsi- [email protected]> On Behalf Of Pan Bian
Sent: Tuesday, November 5, 2019 2:55 PM
To: [email protected]; James E.J. Bottomley <[email protected]>; Martin K. Petersen <[email protected]>
Cc: [email protected]; [email protected]; Pan Bian <[email protected]>
Subject: [PATCH] SCSI: qla4xxx: fix double free bug

The variable init_fw_cb is released twice, resulting in a double free bug. The call to the function dma_free_coherent() before goto is removed to get rid of potential double free.

Fixes 2a49a78ed3c ("[SCSI] qla4xxx: added IPv6 support.")
---
 drivers/scsi/qla4xxx/ql4_mbx.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/scsi/qla4xxx/ql4_mbx.c +0 -0
index dac9a7013208..02636b4785c5 100644
@@ -640,9 +640,6 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host *
 ha)
 
 	if (qla4xxx_get_ifcb(ha, &mbox_cmd[0], &mbox_sts[0],

init_fw_cb_dma) !=

drivers/scsi/qla4xxx/ql4_mbx.c int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha) · line 644

Quoted 6 lines
drivers/scsi/qla4xxx/ql4_mbx.c +0 -3
 	    QLA_SUCCESS) {
-		dma_free_coherent(&ha->pdev->dev,
-				  sizeof(struct addr_ctrl_blk),
-				  init_fw_cb, init_fw_cb_dma);
 		goto exit_init_fw_cb;
 	}

Thanks

#2 lore raw
In reply to Pan Bian

Pan,

Quoted 3 lines

The variable init_fw_cb is released twice, resulting in a double free bug. The call to the function dma_free_coherent() before goto is removed to get rid of potential double free.

Applied to 5.5/scsi-queue, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering