[ovs-git] [openvswitch/ovs] a1fdee: dpif-netdev: Introduce port_try_ref() to prevent a...

GitHub noreply at github.com
Wed Sep 3 20:30:45 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: a1fdee136b278e575d84aeeac06374a44a530300
      https://github.com/openvswitch/ovs/commit/a1fdee136b278e575d84aeeac06374a44a530300
  Author: Alex Wang <alexw at nicira.com>
  Date:   2014-09-03 (Wed, 03 Sep 2014)

  Changed paths:
    M lib/dpif-netdev.c

  Log Message:
  -----------
  dpif-netdev: Introduce port_try_ref() to prevent a race.

When pmd thread interates through all ports for queue loading,
the main thread may unreference and 'rcu-free' a port before
pmd thread take new reference of it.  This could cause pmd
thread fail the reference and access freed memory later.

This commit fixes this race by introducing port_try_ref()
which uses ovs_refcount_try_ref_rcu().  And the pmd thread
will only load the port's queue, if port_try_ref() returns
true.

Found by inspection.

Signed-off-by: Alex Wang <alexw at nicira.com>
Acked-by: Pravin B Shelar <pshelar at nicira.com>




More information about the git mailing list