mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
dpif-netdev: Move 'struct dp_netdev_port' initialization before use.
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 <alexw@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
This commit is contained in:
@@ -862,13 +862,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;
|
||||
|
Reference in New Issue
Block a user