From: Alex Wang Date: Fri, 11 Oct 2013 21:17:13 +0000 (-0700) Subject: ofproto-dpif-xlate: Fix freeing uninitialized "struct ofpbuf". X-Git-Tag: sliver-openvswitch-2.0.90-1~8^2~3 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=02ea2703b94a3d7e5412e9345f86ae80c182eaeb ofproto-dpif-xlate: Fix freeing uninitialized "struct ofpbuf". Commit 91d6cd12 (ofproto-dpif: Move send_packet() to ofproto-dpif-xlate module.) introduced a bug that frees the "struct ofpbuf" in 'xout' when the struct is not initialized. This commit fixes the bug. Reported-by: Simon Horman Signed-off-by: Alex Wang Signed-off-by: Ethan Jackson --- diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 4fb0d5e39..0e248ebd2 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -2879,9 +2879,8 @@ xlate_send_packet(const struct ofport_dpif *ofport, struct ofpbuf *packet) ovs_rwlock_rdlock(&xlate_rwlock); xport = xport_lookup(ofport); if (!xport) { - error = EINVAL; ovs_rwlock_unlock(&xlate_rwlock); - goto out; + return EINVAL; } odp_flow_key_from_flow(&key, &flow, ofp_port_to_odp_port(xport->xbridge, OFPP_LOCAL)); @@ -2899,8 +2898,6 @@ xlate_send_packet(const struct ofport_dpif *ofport, struct ofpbuf *packet) xout.odp_actions.data, xout.odp_actions.size, packet, (xout.slow & SLOW_ACTION) != 0); ovs_rwlock_unlock(&xlate_rwlock); - -out: xlate_out_uninit(&xout); return error; }