netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc()
@ 2016-08-11 23:29 Wei Yongjun
  2016-08-12  5:00 ` Sudarsana Kalluru
  2016-08-15  4:21 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Wei Yongjun @ 2016-08-11 23:29 UTC (permalink / raw)
  To: Yuval Mintz, Ariel Elior, Sudarsana Reddy Kalluru
  Cc: Wei Yongjun, everest-linux-l2, netdev

'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 <weiyj.lk@gmail.com>
---
 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;
 	}

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

* RE: [PATCH -next] qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc()
  2016-08-11 23:29 [PATCH -next] qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc() Wei Yongjun
@ 2016-08-12  5:00 ` Sudarsana Kalluru
  2016-08-12 17:49   ` David Miller
  2016-08-15  4:21 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Sudarsana Kalluru @ 2016-08-12  5:00 UTC (permalink / raw)
  To: Wei Yongjun, Yuval Mintz, Ariel Elior; +Cc: Dept-Eng Everest Linux L2, netdev

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 <Yuval.Mintz@qlogic.com>; Ariel Elior <Ariel.Elior@qlogic.com>; Sudarsana Kalluru <Sudarsana.Kalluru@qlogic.com>
Cc: Wei Yongjun <weiyj.lk@gmail.com>; Dept-Eng Everest Linux L2 <Dept-EngEverestLinuxL2@qlogic.com>; netdev <netdev@vger.kernel.org>
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 <weiyj.lk@gmail.com>
---
 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;
 	}

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

* Re: [PATCH -next] qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc()
  2016-08-12  5:00 ` Sudarsana Kalluru
@ 2016-08-12 17:49   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-08-12 17:49 UTC (permalink / raw)
  To: Sudarsana.Kalluru
  Cc: weiyj.lk, Yuval.Mintz, Ariel.Elior, Dept-EngEverestLinuxL2,
	netdev

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.

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

* Re: [PATCH -next] qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc()
  2016-08-11 23:29 [PATCH -next] qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc() Wei Yongjun
  2016-08-12  5:00 ` Sudarsana Kalluru
@ 2016-08-15  4:21 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2016-08-15  4:21 UTC (permalink / raw)
  To: weiyj.lk
  Cc: Yuval.Mintz, Ariel.Elior, sudarsana.kalluru, everest-linux-l2,
	netdev

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

Applied.

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

end of thread, other threads:[~2016-08-15  4:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-11 23:29 [PATCH -next] qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc() Wei Yongjun
2016-08-12  5:00 ` Sudarsana Kalluru
2016-08-12 17:49   ` David Miller
2016-08-15  4:21 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).