currently pinctrl uses some hash tables that were supplied
by ovn-controller to prepare and send IPv6 RAs, those
hash tables are not updated properly when a port_bindings record
deleted and in this case, some port_bindings records remain in the
hash table where they should be removed.

This patch handles such changes and update those lists
to avoid invalid memory access.

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2052945
Signed-off-by: Mohammad Heib <[email protected]>
---
 controller/binding.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/controller/binding.c b/controller/binding.c
index 4d62b0858..36884b1ea 100644
--- a/controller/binding.c
+++ b/controller/binding.c
@@ -481,6 +481,20 @@ remove_related_lport(const struct sbrec_port_binding *pb,
     }
 }
 
+static void
+delete_active_pb_ras_pd(const struct sbrec_port_binding *pb,
+                        struct shash *map)
+{
+    struct shash_node *iter = shash_find(map, pb->logical_port);
+
+    if (iter) {
+        struct pb_ld_binding *ras_pd = iter->data;
+        shash_delete(map, iter);
+        free(ras_pd);
+        return;
+    }
+}
+
 static void
 update_active_pb_ras_pd(const struct sbrec_port_binding *pb,
                         struct hmap *local_datapaths,
@@ -2251,6 +2265,9 @@ binding_handle_port_binding_changes(struct binding_ctx_in 
*b_ctx_in,
             continue;
         }
 
+        delete_active_pb_ras_pd(pb, b_ctx_out->local_active_ports_ipv6_pd);
+        delete_active_pb_ras_pd(pb, b_ctx_out->local_active_ports_ras);
+
         enum en_lport_type lport_type = get_lport_type(pb);
 
         struct binding_lport *b_lport =
-- 
2.34.1

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

Reply via email to