[ovs-git] Open vSwitch: ofproto-dpif: Fix memory leak sending packets to controller. (branch-1.4)

dev at openvswitch.org dev at openvswitch.org
Thu May 2 17:27:15 UTC 2013

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, branch-1.4 has been updated
       via  04722c9acf48a7a6fcedcfb1bc1d31cf4fc256c1 (commit)
      from  09aa269fe365e61d8bec0afc1cc127249926b80c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 04722c9acf48a7a6fcedcfb1bc1d31cf4fc256c1
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=04722c9acf48a7a6fcedcfb1bc1d31cf4fc256c1
Author: Ben Pfaff <blp at nicira.com>
ofproto-dpif: Fix memory leak sending packets to controller.
In the case where execute_controller_action() returned true to
handle_flow_miss(), indicating that the packet had been sent to the
controller, nothing ever freed the packet, causing a memory leak.

One plausible solution seemed to be to turn over ownership of the packet to
execute_controller_action(), by passing false instead of true as its
'clone' argument.  Another is to add an else case to the "if" statement
that calls execute_controller_action() to free the packet.

However, neither of these solutions is actually correct, for a subtle
reason.  The block of memory that includes the packet also includes the
key for the flow miss.  At the end of handle_flow_miss(), past the end of
the loop, the key is normally needed to install the flow in the datapath.
Thus, by destroying the packet we potentially corrupt the key, and this
has actually been seen while testing memory leak fixes.

This commit uses a different approach: instead of trying to destroy the
packets one at a time when it becomes possible, it destroys all the packets
together at the end.

Reported-by: Zoltan Kiss <zoltan.kiss at citrix.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>


Summary of changes:
 ofproto/ofproto-dpif.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

Open vSwitch

More information about the git mailing list