[ovs-git] [openvswitch/ovs] 380ab1: ofproto/bond: Fix bond reconfiguration race condit...

GitHub noreply at github.com
Fri Feb 24 22:36:41 UTC 2017


  Branch: refs/heads/branch-2.5
  Home:   https://github.com/openvswitch/ovs
  Commit: 380ab17743b7e3d4379e1dd3f51e2381543e0ac7
      https://github.com/openvswitch/ovs/commit/380ab17743b7e3d4379e1dd3f51e2381543e0ac7
  Author: Andy Zhou <azhou at ovn.org>
  Date:   2017-02-24 (Fri, 24 Feb 2017)

  Changed paths:
    M ofproto/bond.c
    M ofproto/bond.h
    M ofproto/ofproto-dpif-xlate.c

  Log Message:
  -----------
  ofproto/bond: Fix bond reconfiguration race condition.

During the upcall thread bond output translation, bond_may_recirc()
is currently called outside the lock. In case the main thread executes
bond_reconfigure() at the same time, the upcall thread may find bond
state to be inconsistent when calling bond_update_post_recirc_rules().

This patch fixes the race condition by acquiring the write lock
before calling bond_may_recirc(). The APIs are refactored slightly.

The race condition can result in the following stack trace. Copied
from 'Reported-at':

    Thread 23 handler69:
    Invalid write of size 8
  update_recirc_rules (bond.c:385)
  bond_update_post_recirc_rules__ (bond.c:952)
  bond_update_post_recirc_rules (bond.c:960)
  output_normal (ofproto-dpif-xlate.c:2102)
  xlate_normal (ofproto-dpif-xlate.c:2858)
  xlate_output_action (ofproto-dpif-xlate.c:4407)
  do_xlate_actions (ofproto-dpif-xlate.c:5335)
  xlate_actions (ofproto-dpif-xlate.c:6198)
  upcall_xlate (ofproto-dpif-upcall.c:1129)
  process_upcall (ofproto-dpif-upcall.c:1271)
  recv_upcalls (ofproto-dpif-upcall.c:822)
  udpif_upcall_handler (ofproto-dpif-upcall.c:740)
    Address 0x18630490 is 1,904 bytes inside a block of size 12,288 free'd
  free (vg_replace_malloc.c:529)
  bond_entry_reset (bond.c:1635)
  bond_reconfigure (bond.c:457)
  bundle_set (ofproto-dpif.c:2896)
  ofproto_bundle_register (ofproto.c:1343)
  port_configure (bridge.c:1159)
  bridge_reconfigure (bridge.c:785)
  bridge_run (bridge.c:3099)
  main (ovs-vswitchd.c:111)
    Block was alloc'd at
  malloc (vg_replace_malloc.c:298)
  xmalloc (util.c:110)
  bond_entry_reset (bond.c:1629)
  bond_reconfigure (bond.c:457)
  bond_create (bond.c:245)
  bundle_set (ofproto-dpif.c:2900)
  ofproto_bundle_register (ofproto.c:1343)
  port_configure (bridge.c:1159)
  bridge_reconfigure (bridge.c:785)
  bridge_run (bridge.c:3099)
  main (ovs-vswitchd.c:111)

Reported-by: Huanle Han <hanxueluo at gmail.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-February/328969.html
CC: Huanle Han <hanxueluo at gmail.com>
Signed-off-by: Andy Zhou <azhou at ovn.org>
Acked-by: Jarno Rajahalme <jarno at ovn.org>
Acked-by: Huanle Han <hanxueluo at gmail.com>


  Commit: f12aac9ebd944859a09228775efeb93cf25caf8a
      https://github.com/openvswitch/ovs/commit/f12aac9ebd944859a09228775efeb93cf25caf8a
  Author: Andy Zhou <azhou at ovn.org>
  Date:   2017-02-24 (Fri, 24 Feb 2017)

  Changed paths:
    M ofproto/bond.c

  Log Message:
  -----------
  ofproto/bond: Fix bond post recirc rule leak.

When bond is removed or when its configuration changes,
the post recirculation rules that are installed by current
bond configuration, if any, should be also be removed.

Reported-by: Huanle Han <hanxueluo at gmail.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-February/328969.html
CC: Huanle Han <hanxueluo at gmail.com>
Signed-off-by: Andy Zhou <azhou at ovn.org>
Acked-by: Jarno Rajahalme <jarno at ovn.org>
Acked-by: Huanle Han <hanxueluo at gmail.com>

Conflicts:
	ofproto/bond.c


  Commit: b1afb2ea3b4072ebdfe706d9b8a2004ce4d0cfc7
      https://github.com/openvswitch/ovs/commit/b1afb2ea3b4072ebdfe706d9b8a2004ce4d0cfc7
  Author: Huanle Han <hanxueluo at gmail.com>
  Date:   2017-02-24 (Fri, 24 Feb 2017)

  Changed paths:
    M ofproto/ofproto-dpif.c

  Log Message:
  -----------
  ofproto/bond: fix interal flow leak of tcp-balance bond

ofproto_dpif_delete_internal_flow() never deletes any flows
because out_port and out_group mismatch.

Signed-off-by: Huanle Han <hanxueluo at gmail.com>
Signed-off-by: Andy Zhou <azhou at ovn.org>

Conflicts:
	ofproto/ofproto-dpif.c


Compare: https://github.com/openvswitch/ovs/compare/44ce2966b6cb...b1afb2ea3b40


More information about the git mailing list