Message ID | 20170207145258.31429-1-weiyj.lk@gmail.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
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>
>>>>> "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.
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; }