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.
Unified · Split
| @@ -274,10 +274,8 @@ void ovs_vport_del(struct vport *vport) · 273 unmodified lines | |||
| 274 | ASSERT_OVSL(); | 274 | ASSERT_OVSL(); |
| 275 | 275 | ||
| 276 | hlist_del_rcu(&vport->hash_node); | 276 | hlist_del_rcu(&vport->hash_node); |
| 277 | |||
| 278 | vport->ops->destroy(vport); | ||
| 279 | |||
| 280 | module_put(vport->ops->owner); | 277 | module_put(vport->ops->owner); |
| 278 | vport->ops->destroy(vport); | ||
| 281 | } | 279 | } |
| 282 | 280 | ||
| 283 | /** | 281 | /** |