On Tue, Apr 5, 2022 at 10:21 AM Mark Michelson <[email protected]> wrote:
>
> Thanks for the update Mohammad. I like this version much better.
>
> Acked-by: Mark Michelson <[email protected]>

Thanks for the fix.

I applied this patch to the main and backported upto branch-21.09 with
the below changes as it would reduce the code.

-------------------------------------------------------------------------------------------
diff --git a/controller/binding.c b/controller/binding.c
index 36884b1eae..1259e6b3bd 100644
--- a/controller/binding.c
+++ b/controller/binding.c
@@ -483,16 +483,12 @@ 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 *ras_pd_map)
 {
-    struct shash_node *iter = shash_find(map, pb->logical_port);
+    struct pb_ld_binding *ras_pd =
+        shash_find_and_delete(ras_pd_map, pb->logical_port);

-    if (iter) {
-        struct pb_ld_binding *ras_pd = iter->data;
-        shash_delete(map, iter);
-        free(ras_pd);
-        return;
-    }
+    free(ras_pd);
 }

 static void
-------------------------------------------------------------------------------------------


Numan

>
> On 4/3/22 07:26, Mohammad Heib wrote:
> > 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 =
> >
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to