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

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).