summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Wang <alexw@nicira.com>2014-09-15 13:15:38 -0700
committerAlex Wang <alexw@nicira.com>2014-09-15 14:35:41 -0700
commitb7ccaf673e7669499155ccf2cacdfeb9971417b7 (patch)
tree722cc3d903f6c486cc9e31dc3168663eaa5c5639
parent476590621ec194c73b235ca5db15fa5e9bf50976 (diff)
downloadopenvswitch-b7ccaf673e7669499155ccf2cacdfeb9971417b7.tar.gz
netdev-dpdk: Fix thread-safety breach.
dpdk_eth_dev_init() must be called with dpdk_mutex. However, netdev_dpdk_set_multiq() fails to follow this rule. This commit fixes this breach. Found by clang. Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Daniele Di Proietto <ddiproietto@vmware.com>
-rw-r--r--lib/netdev-dpdk.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index e66eb6e6f..1e12e8bb6 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -622,6 +622,7 @@ netdev_dpdk_set_multiq(struct netdev *netdev_, unsigned int n_txq,
return err;
}
+ ovs_mutex_lock(&dpdk_mutex);
ovs_mutex_lock(&netdev->mutex);
rte_eth_dev_stop(netdev->port_id);
netdev->up.n_txq = n_txq;
@@ -632,6 +633,7 @@ netdev_dpdk_set_multiq(struct netdev *netdev_, unsigned int n_txq,
netdev_dpdk_set_txq(netdev, n_txq);
}
ovs_mutex_unlock(&netdev->mutex);
+ ovs_mutex_unlock(&dpdk_mutex);
return err;
}