qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc()
authorWei Yongjun <weiyj.lk@gmail.com>
Thu, 11 Aug 2016 23:29:54 +0000 (23:29 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Aug 2016 04:21:37 +0000 (21:21 -0700)
'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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_dcbx.c

index d0dc28f93c0e2b0426349d45f5ca7cb2615783ac..d2f202eae6b298d450f98537d244f3c04dc62b92 100644 (file)
@@ -1855,6 +1855,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;
        }