net/bonding: fix memory leak on closing device
authorDapeng Yu <dapengx.yu@intel.com>
Wed, 15 Sep 2021 05:08:02 +0000 (13:08 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 21 Sep 2021 08:03:12 +0000 (10:03 +0200)
If the bond device was created by vdev mode, the kvlist was not free
after the bond device was closed.

This patch fixes it.

Fixes: 144dc4739975 ("net/bonding: fix leak on remove")
Cc: stable@dpdk.org
Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
drivers/net/bonding/rte_eth_bond_pmd.c

index 8ed9e03..54987d9 100644 (file)
@@ -2159,6 +2159,9 @@ bond_ethdev_close(struct rte_eth_dev *dev)
         */
        rte_mempool_free(internals->mode6.mempool);
 
+       if (internals->kvlist != NULL)
+               rte_kvargs_free(internals->kvlist);
+
        return 0;
 }
 
@@ -3471,8 +3474,6 @@ bond_remove(struct rte_vdev_device *dev)
                ret = bond_ethdev_stop(eth_dev);
                bond_ethdev_close(eth_dev);
        }
-       if (internals->kvlist != NULL)
-               rte_kvargs_free(internals->kvlist);
        rte_eth_dev_release_port(eth_dev);
 
        return ret;