Skip to contentSkip to conversation

scsi: qedi: Fix possible memory leak in qedi_iscsi_update_conn()

PATCH Applied Wei Yongjun 3 participants 3 messages Feb 7, 2017 – Feb 9, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: qedi: Fix possible memory leak in qedi_iscsi_update_conn()

From: Wei Yongjun <[email protected]>

'conn_info' is malloced in qedi_iscsi_update_conn() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak.

Fixes ace7f46ba5fd ("scsi: qedi: Add QLogic FastLinQ offload iSCSI

driver framework.")

---
 drivers/scsi/qedi/qedi_iscsi.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/scsi/qedi/qedi_iscsi.c +0 -4
index d6a2054..eb64469 100644
@@ -453,13 +453,9 @@ static int qedi_iscsi_update_conn(struct qedi_ctx *qedi,
 	if (rval) {
 		rval = -ENXIO;
 		QEDI_ERR(&qedi->dbg_ctx, "Could not update connection\n");
-		goto update_conn_err;
 	}
 
 	kfree(conn_info);
-	rval = 0;
-
-update_conn_err:
 	return rval;
 }
Acked-by on v1 1/1
#1 lore raw
Quoted 23 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

'conn_info' is malloced in qedi_iscsi_update_conn() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak.

Fixes ace7f46ba5fd ("scsi: qedi: Add QLogic FastLinQ offload iSCSI

driver framework.")

---
drivers/scsi/qedi/qedi_iscsi.c | 4 ----

1 file changed, 4 deletions(-)
drivers/scsi/qedi/qedi_iscsi.c +0 -0
index d6a2054..eb64469 100644
@@ -453,13 +453,9 @@ static int qedi_iscsi_update_conn(struct qedi_ctx
 *qedi,
 	if (rval) {
 		rval = -ENXIO;

drivers/scsi/qedi/qedi_iscsi.c static int qedi_iscsi_update_conn(struct qedi_ctx · line 461

Quoted 10 lines
drivers/scsi/qedi/qedi_iscsi.c +0 -4
 		QEDI_ERR(&qedi->dbg_ctx, "Could not update connection\n");
-		goto update_conn_err;
 	}
 
 	kfree(conn_info);
-	rval = 0;
-
-update_conn_err:
 	return rval;
 }
#2 lore raw
In reply to Wei Yongjun
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Wei" == Wei Yongjun <[email protected]> writes:

Wei> 'conn_info' is malloced in qedi_iscsi_update_conn() and should be Wei> freed before leaving from the error handling cases, otherwise it Wei> will cause memory leak.

Applied to 4.11/scsi-queue.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering