ofproto-dpif: Destroy bundle after moving its last port out.
authorBen Pfaff <blp@nicira.com>
Wed, 14 Aug 2013 00:44:14 +0000 (17:44 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 14 Aug 2013 18:50:39 +0000 (11:50 -0700)
commitcf7eed48d44f29c2d2670558c9370b7bf9d7e1e5
tree3be1e61418f4832cf47fdc9ddb6489425c4116c4
parentb31f6941e1aaba7468f0f712fc922ab36f18b395
ofproto-dpif: Destroy bundle after moving its last port out.

When the ofp_port argument to bundle_add_port() refers to an ofport_dpif
that already belongs to some other bundle, bundle_add_port() removed
the port from the other bundle, correctly, with bundle_del_port().
If the other bundle now contained no ports, however, this violated the
invariant that a bundle always contains at least one port.

Normally, this would get fixed up when the other bundle was processed
later during reconfiguration.  I haven't quite zeroed in on the exact
case where this is not true, but segfaults have happened here in
production, in particular when port adds and deletes happen simultaneously
and the new port reuses the OpenFlow port number of one of the deleted
ports.  It seems that the duplicate port number allows some port to rip
away the new port from its bundle without destroying that bundle.  I
suspect, therefore, that there is still a more subtle bug here, but I
hope that this will fix the segfault.

Bug #18967.
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto/ofproto-dpif.c