public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] scsi: qedi: Fix possible memory leak in qedi_iscsi_update_conn()
@ 2017-02-07 14:52 Wei Yongjun
  2017-02-08  5:51 ` Rangankar, Manish
  2017-02-09 23:35 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2017-02-07 14:52 UTC (permalink / raw)
  To: James E . J . Bottomley, Martin K. Petersen, Manish Rangankar
  Cc: Wei Yongjun, QLogic-Storage-Upstream, linux-scsi

From: Wei Yongjun <weiyongjun1@huawei.com>

'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.")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/scsi/qedi/qedi_iscsi.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c
index d6a2054..eb64469 100644
--- a/drivers/scsi/qedi/qedi_iscsi.c
+++ b/drivers/scsi/qedi/qedi_iscsi.c
@@ -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;
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] scsi: qedi: Fix possible memory leak in qedi_iscsi_update_conn()
  2017-02-07 14:52 [PATCH -next] scsi: qedi: Fix possible memory leak in qedi_iscsi_update_conn() Wei Yongjun
@ 2017-02-08  5:51 ` Rangankar, Manish
  2017-02-09 23:35 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Rangankar, Manish @ 2017-02-08  5:51 UTC (permalink / raw)
  To: Wei Yongjun, James E . J . Bottomley, Martin K. Petersen
  Cc: Wei Yongjun, Dept-Eng QLogic Storage Upstream,
	linux-scsi@vger.kernel.org


On 07/02/17 8:22 PM, "Wei Yongjun" <weiyj.lk@gmail.com> wrote:

>From: Wei Yongjun <weiyongjun1@huawei.com>
>
>'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.")
>Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
>---
> drivers/scsi/qedi/qedi_iscsi.c | 4 ----
> 1 file changed, 4 deletions(-)
>
>diff --git a/drivers/scsi/qedi/qedi_iscsi.c
>b/drivers/scsi/qedi/qedi_iscsi.c
>index d6a2054..eb64469 100644
>--- a/drivers/scsi/qedi/qedi_iscsi.c
>+++ b/drivers/scsi/qedi/qedi_iscsi.c
>@@ -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: Manish Rangankar <Manish.Rangankar@cavium.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] scsi: qedi: Fix possible memory leak in qedi_iscsi_update_conn()
  2017-02-07 14:52 [PATCH -next] scsi: qedi: Fix possible memory leak in qedi_iscsi_update_conn() Wei Yongjun
  2017-02-08  5:51 ` Rangankar, Manish
@ 2017-02-09 23:35 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2017-02-09 23:35 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: James E . J . Bottomley, Martin K. Petersen, Manish Rangankar,
	Wei Yongjun, QLogic-Storage-Upstream, linux-scsi

>>>>> "Wei" == Wei Yongjun <weiyj.lk@gmail.com> 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.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-09 23:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-07 14:52 [PATCH -next] scsi: qedi: Fix possible memory leak in qedi_iscsi_update_conn() Wei Yongjun
2017-02-08  5:51 ` Rangankar, Manish
2017-02-09 23:35 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox