When a DPDK port with an active egress QoS configuration is
destroyed, common_destruct() frees the ingress policer and
sw_stats but never calls qos_conf->ops->qos_destruct() on
the egress QoS configuration.  For the trtcm-policer
implementation, qos_destruct() also frees an hmap of queues,
so this leaks memory.

Add the missing qos_destruct() call in common_destruct().

Fixes: 0bf765f753fd ("netdev_dpdk.c: Add QoS functionality.")
Signed-off-by: Eelco Chaudron <[email protected]>
---
 lib/netdev-dpdk.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 6ff878107..a9d182627 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1707,12 +1707,19 @@ common_destruct(struct netdev_dpdk *dev)
     OVS_REQUIRES(dpdk_mutex)
     OVS_EXCLUDED(dev->mutex)
 {
+    struct qos_conf *qos_conf;
+
     rte_free(dev->tx_q);
     dpdk_mp_put(dev->dpdk_mp);
 
     ovs_list_remove(&dev->list_node);
     free(ovsrcu_get_protected(struct ingress_policer *,
                               &dev->ingress_policer));
+    qos_conf = ovsrcu_get_protected(struct qos_conf *,
+                                    &dev->qos_conf);
+    if (qos_conf) {
+        qos_conf->ops->qos_destruct(qos_conf);
+    }
     free(dev->sw_stats);
     ovs_mutex_destroy(&dev->mutex);
 }
-- 
2.56.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to