[PATCH -next] qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc()

Subsystems: networking drivers, qlogic ql4xxx ethernet driver, the rest

STALE3655d

4 messages, 3 authors, 2016-08-15 · open the first message on its own page

[PATCH -next] qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc()

From: Wei Yongjun <hidden>
Date: 2016-08-11 23:30:04

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

Fixes: a1d8d8a51e83 ("qed: Add dcbnl support.")
Signed-off-by: Wei Yongjun <redacted>
---
 drivers/net/ethernet/qlogic/qed/qed_dcbx.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
index 226cb08..b900dfb 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
@@ -1968,6 +1968,7 @@ static int qed_dcbnl_get_ieee_pfc(struct qed_dev *cdev,
 
 	if (!dcbx_info->operational.ieee) {
 		DP_INFO(hwfn, "DCBX is not enabled/operational in IEEE mode\n");
+		kfree(dcbx_info);
 		return -EINVAL;
 	}

RE: [PATCH -next] qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc()

From: Sudarsana Kalluru <Sudarsana.Kalluru@qlogic.com>
Date: 2016-08-12 12:33:53

Thanks for the patch.

Acked-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>

-----Original Message-----
From: Wei Yongjun [mailto:weiyj.lk@gmail.com] 
Sent: 12 August 2016 05:00
To: Yuval Mintz <redacted>; Ariel Elior <redacted>; Sudarsana Kalluru <Sudarsana.Kalluru@qlogic.com>
Cc: Wei Yongjun <redacted>; Dept-Eng Everest Linux L2 <redacted>; netdev <redacted>
Subject: [PATCH -next] qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc()

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

Fixes: a1d8d8a51e83 ("qed: Add dcbnl support.")
Signed-off-by: Wei Yongjun <redacted>
---
 drivers/net/ethernet/qlogic/qed/qed_dcbx.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
index 226cb08..b900dfb 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
@@ -1968,6 +1968,7 @@ static int qed_dcbnl_get_ieee_pfc(struct qed_dev *cdev,
 
 	if (!dcbx_info->operational.ieee) {
 		DP_INFO(hwfn, "DCBX is not enabled/operational in IEEE mode\n");
+		kfree(dcbx_info);
 		return -EINVAL;
 	}

Re: [PATCH -next] qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc()

From: David Miller <davem@davemloft.net>
Date: 2016-08-12 17:49:31

From: Sudarsana Kalluru <Sudarsana.Kalluru@qlogic.com>
Date: Fri, 12 Aug 2016 05:00:40 +0000
Thanks for the patch.

Acked-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Please do not quote patches like this, and top-post your Ack.

Please instead use canonical quoting, with some kind of delimiter
in the first column of the quoted material.

Unless you have specific comments for specific parts of the change
itself, do not quote the patch, just quoting the commit message itself
is sufficient.

And finally, put your ACK and any other part of your response, after
the quoted material rather than before.

The way you have ACK'd this patch, patchwork will not see it and
instead thinks this is a fresh new patch posting.  So your ACK will
get possibly lost, and I will definitely have more work to do weeding
out this extraneous patch entry in patchwork.

Thank you.

Re: [PATCH -next] qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc()

From: David Miller <davem@davemloft.net>
Date: 2016-08-15 04:21:55

From: Wei Yongjun <redacted>
Date: Thu, 11 Aug 2016 23:29:54 +0000
'dcbx_info is malloced in qed_dcbnl_get_ieee_pfc() and should be freed
before leaving from the error handling cases, otherwise it will cause
memory leak.

Fixes: a1d8d8a51e83 ("qed: Add dcbnl support.")
Signed-off-by: Wei Yongjun <redacted>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help