]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
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)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 6 Mar 2017 04:59:31 +0000 (20:59 -0800)
Orabug: 25477939

'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>
(cherry picked from commit 02ee9b18dedf1d72afa0fbfb0d7c15f6b4904a07)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/net/ethernet/qlogic/qed/qed_dcbx.c

index 226cb08cc055fc21c6ea4ab414dfd798d883db8a..b900dfbb57ff04615f895d410e40715dcff9ad51 100644 (file)
@@ -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;
        }