Commit fa2d8ff4 authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller

openvswitch: Return vport module ref before destruction

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: 62b9c8d0 ("ovs: Turn vports with dependencies into separate modules")
Reported-by: default avatarPravin Shelar <pshelar@nicira.com>
Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Acked-by: default avatarPravin B Shelar <pshelar@nicira.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5899f047
...@@ -274,10 +274,8 @@ void ovs_vport_del(struct vport *vport) ...@@ -274,10 +274,8 @@ void ovs_vport_del(struct vport *vport)
ASSERT_OVSL(); ASSERT_OVSL();
hlist_del_rcu(&vport->hash_node); hlist_del_rcu(&vport->hash_node);
vport->ops->destroy(vport);
module_put(vport->ops->owner); module_put(vport->ops->owner);
vport->ops->destroy(vport);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment