]> git.baikalelectronics.ru Git - kernel.git/commitdiff
octeontx2-pf: mcs: fix possible memory leak in otx2_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Mon, 10 Oct 2022 03:39:45 +0000 (11:39 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Oct 2022 07:39:39 +0000 (08:39 +0100)
In error path after calling cn10k_mcs_init(), cn10k_mcs_free() need
be called to avoid memory leak.

Fixes: a500032f7534 ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c

index 5803d7f9137cac8de75c83aa0ecb2f589426dc7a..892ca88e0cf43be6cb590b1925a8f5b065ce9575 100644 (file)
@@ -2810,7 +2810,7 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        err = register_netdev(netdev);
        if (err) {
                dev_err(dev, "Failed to register netdevice\n");
-               goto err_del_mcam_entries;
+               goto err_mcs_free;
        }
 
        err = otx2_wq_init(pf);
@@ -2849,6 +2849,8 @@ err_mcam_flow_del:
        otx2_mcam_flow_del(pf);
 err_unreg_netdev:
        unregister_netdev(netdev);
+err_mcs_free:
+       cn10k_mcs_free(pf);
 err_del_mcam_entries:
        otx2_mcam_flow_del(pf);
 err_ptp_destroy: