Skip to content

Commit

Permalink
northd.c: Validate port type to avoid unexpected behavior.
Browse files Browse the repository at this point in the history
In ovn_igmp_group_get_ports(), it accesses a union member that should
exist only if the port is a LSP: port->peer->od->mcast_info.rtr.relay.
But in theory it is possible that the "port" is in fact a LRP, because
it is a result of ovn_port_find() with the port name coming from a SB DB
entry. So it is better to validate that first.

Signed-off-by: Han Zhou <hzhou@ovn.org>
Acked-by: Dumitru Ceara <dceara@redhat.com>
(cherry picked from commit e71873b)
  • Loading branch information
hzhou8 committed Feb 2, 2023
1 parent 3c71361 commit 57b6598
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion northd/northd.c
Expand Up @@ -4570,7 +4570,7 @@ ovn_igmp_group_get_ports(const struct sbrec_igmp_group *sb_igmp_group,
struct ovn_port *port =
ovn_port_find(ovn_ports, sb_igmp_group->ports[i]->logical_port);

if (!port) {
if (!port || !port->nbsp) {
continue;
}

Expand Down

0 comments on commit 57b6598

Please sign in to comment.