On Fri, Nov 7, 2014 at 5:51 PM, Alex Wang <[email protected]> wrote:
> There is a portion of the 'struct dp_netdev_port' initialization
> that is placed after the reload of pmd threads.  This means in
> theory, there could be a race where pmd threads access half-
> initialized struct.  Although such race has not been seen, it
> makes sense to fully initialize the struct before use.
>
> Found by code inspection.
>
> Signed-off-by: Alex Wang <[email protected]>

Looks good.
Acked-by: Pravin B Shelar <[email protected]>

> ---
>  lib/dpif-netdev.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index ad2febc..9d1319f 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -871,13 +871,13 @@ do_add_port(struct dp_netdev *dp, const char *devname, 
> const char *type,
>      }
>      port->sf = sf;
>
> +    ovs_refcount_init(&port->ref_cnt);
> +    cmap_insert(&dp->ports, &port->node, hash_port_no(port_no));
> +
>      if (netdev_is_pmd(netdev)) {
>          dp_netdev_set_pmds_on_numa(dp, netdev_get_numa_id(netdev));
>          dp_netdev_reload_pmds(dp);
>      }
> -    ovs_refcount_init(&port->ref_cnt);
> -
> -    cmap_insert(&dp->ports, &port->node, hash_port_no(port_no));
>      seq_change(dp->port_seq);
>
>      return 0;
> --
> 1.7.9.5
>
> _______________________________________________
> dev mailing list
> [email protected]
> http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to