Skip to content

Commit

Permalink
controller/pinctrl: avoid accessing invalid memory
Browse files Browse the repository at this point in the history
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 <mheib@redhat.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
(cherry picked from commit 6bc6002)
  • Loading branch information
mohammadheib authored and numansiddique committed Apr 7, 2022
1 parent be49d51 commit 55a0ab5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions controller/binding.c
Expand Up @@ -481,6 +481,16 @@ remove_related_lport(const struct sbrec_port_binding *pb,
}
}

static void
delete_active_pb_ras_pd(const struct sbrec_port_binding *pb,
struct shash *ras_pd_map)
{
struct pb_ld_binding *ras_pd =
shash_find_and_delete(ras_pd_map, pb->logical_port);

free(ras_pd);
}

static void
update_active_pb_ras_pd(const struct sbrec_port_binding *pb,
struct hmap *local_datapaths,
Expand Down Expand Up @@ -2251,6 +2261,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 =
Expand Down

0 comments on commit 55a0ab5

Please sign in to comment.