On Thu, Mar 13, 2025 at 5:27 PM <num...@ovn.org> wrote:

> From: Numan Siddique <num...@ovn.org>
>
> lport_is_local() after calling lport_lookup_by_name() is not
> checking if the returned port_binding is NULL or not. Its
> better to check for NULL before accessing it.
>
> Fixes: 712fca55b3b1 ("controller: Prioritize host routes.")
> Signed-off-by: Numan Siddique <num...@ovn.org>
> ---
>  controller/lport.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/controller/lport.c b/controller/lport.c
> index f522b654b4..178fbb6a95 100644
> --- a/controller/lport.c
> +++ b/controller/lport.c
> @@ -99,6 +99,10 @@ lport_is_local(struct ovsdb_idl_index
> *sbrec_port_binding_by_name,
>      const struct sbrec_port_binding *pb = lport_lookup_by_name(
>          sbrec_port_binding_by_name, port_name);
>
> +    if (!pb) {
> +        return false;
> +    }
> +
>      if (lport_pb_is_chassis_resident(chassis, active_tunnels, pb)) {
>          return true;
>      }
> --
> 2.48.1
>
> _______________________________________________
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>
Nice catch!

Acked-by: Ales Musil <amu...@redhat.com>
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to