summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2014-07-22 21:06:44 -0700
committerBen Pfaff <blp@nicira.com>2014-07-22 22:30:03 -0700
commitb6f4590fa036e213fcceafdcb5aa64bcf5c3e5c0 (patch)
tree2d0853b13c62108a7ac8c59fc72acd41cb33c27c
parente9fe2381ec863f85eb766ed5d309e22146d2fb04 (diff)
downloadopenvswitch-b6f4590fa036e213fcceafdcb5aa64bcf5c3e5c0.tar.gz
dpif-netdev: Initialize upcall->packet when queuing to userspace.
Commit db73f7166a6 (netdev-dpdk: Fix race condition with DPDK mempools in non pmd threads) switched to a new way of setting up 'upcall->packet', but only initialized two of the fields in the packet. This could cause core dumps and other strange behavior. In particular it caused failures in several unit tests on XenServer. This commit fixes the problem by initializing the entire ofpbuf. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Justin Pettit <jpettit@nicira.com>
-rw-r--r--lib/dpif-netdev.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index cad8c7a71..8422c8975 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2153,6 +2153,7 @@ OVS_REQUIRES(q->mutex)
struct ofpbuf *buf = &u->buf;
size_t buf_size;
struct flow flow;
+ void *data;
upcall->type = type;
@@ -2179,8 +2180,8 @@ OVS_REQUIRES(q->mutex)
/* We have to perform a copy of the packet, because we cannot send DPDK
* mbufs to a non pmd thread. When the upcall processing will be done
* in the pmd thread, this copy can be avoided */
- ofpbuf_set_data(&upcall->packet, ofpbuf_put(buf, ofpbuf_data(packet),
- ofpbuf_size(packet)));
+ data = ofpbuf_put(buf, ofpbuf_data(packet), ofpbuf_size(packet));
+ ofpbuf_use_stub(&upcall->packet, data, ofpbuf_size(packet));
ofpbuf_set_size(&upcall->packet, ofpbuf_size(packet));
seq_change(q->seq);