[ovs-dev] [PATCH ovn] binding: Fix potential NULL dereference of lbinding.

Numan Siddique numans at ovn.org
Sat Mar 6 10:19:41 UTC 2021


On Sat, Mar 6, 2021 at 1:59 AM Dumitru Ceara <dceara at redhat.com> wrote:
>
> There is a valid code path that can lead to 'lbinding' being NULL in
> handle_deleted_vif_lport().  Make sure we check for it.
>
> Found by code inspection.
>
> Fixes: 68cf9fdceba8 ("binding: Fix container port removal from local bindings.")
> Signed-off-by: Dumitru Ceara <dceara at redhat.com>

Thanks for the fix. I applied this patch to master and backported upto
20.06 branch.

Numan

> ---
>  controller/binding.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/controller/binding.c b/controller/binding.c
> index 2b19fd0..4e6c756 100644
> --- a/controller/binding.c
> +++ b/controller/binding.c
> @@ -2153,10 +2153,12 @@ handle_deleted_vif_lport(const struct sbrec_port_binding *pb,
>          /* If the container port is removed we should also remove it from
>           * its parent's children set.
>           */
> -        if (lbinding->parent) {
> -            local_binding_delete_child(lbinding->parent, lbinding);
> +        if (lbinding) {
> +            if (lbinding->parent) {
> +                local_binding_delete_child(lbinding->parent, lbinding);
> +            }
> +            local_binding_destroy(lbinding);
>          }
> -        local_binding_destroy(lbinding);
>      }
>
>      handle_deleted_lport(pb, b_ctx_in, b_ctx_out);
> --
> 1.8.3.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>


More information about the dev mailing list