Skip to content

Commit

Permalink
openvswitch: Return vport module ref before destruction
Browse files Browse the repository at this point in the history
Return module reference before invoking the respective vport
->destroy() function. This is needed as ovs_vport_del() is not
invoked inside an RCU read side critical section so the kfree
can occur immediately before returning to ovs_vport_del().

Returning the module reference before ->destroy() is safe because
the module unregistration is blocked on ovs_lock which we hold
while destroying the datapath.

Fixes: 62b9c8d ("ovs: Turn vports with dependencies into separate modules")
Reported-by: Pravin Shelar <pshelar@nicira.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Thomas Graf authored and David S. Miller committed Mar 31, 2015
1 parent 5899f04 commit fa2d8ff
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions net/openvswitch/vport.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,8 @@ void ovs_vport_del(struct vport *vport)
ASSERT_OVSL();

hlist_del_rcu(&vport->hash_node);

vport->ops->destroy(vport);

module_put(vport->ops->owner);
vport->ops->destroy(vport);
}

/**
Expand Down

0 comments on commit fa2d8ff

Please sign in to comment.