Skip to contentSkip to conversation

openvswitch: properly refcount vport-vxlan module

PATCH Superseded Paolo Abeni 2 participants 2 messages Nov 25, 2015 – Nov 30, 2015

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Paolo Abeni

author maintainer
#0 lore raw

PATCH 1/1 openvswitch: properly refcount vport-vxlan module

After 614732eaa12d, no refcount is mainteined for the vport-vxlan module. This allows the userspace to remove such module while vport-vxlan devices still exist, which lead to later oops, i.e. when
the openvswitch module is removed.

Fixes 614732eaa12d ("openvswitch: Use regular VXLAN net_device device")
---
 net/openvswitch/vport-vxlan.c | 1 +
 1 file changed, 1 insertion(+)
net/openvswitch/vport-vxlan.c +1 -0
index 1605691..a2a83f3 100644
@@ -152,6 +152,7 @@ static struct vport_ops ovs_vxlan_netdev_vport_ops = {
 	.destroy		= ovs_netdev_tunnel_destroy,
 	.get_options		= vxlan_get_options,
 	.send			= dev_queue_xmit,
+	.owner			= THIS_MODULE,
 };
 
 static int __init ovs_vxlan_tnl_init(void)
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw

From: Paolo Abeni <[email protected]>
Date: Wed, 25 Nov 2015 18:05:27 +0100

Quoted 8 lines

After 614732eaa12d, no refcount is mainteined for the vport-vxlan module. This allows the userspace to remove such module while vport-vxlan devices still exist, which lead to later oops, i.e. when
the openvswitch module is removed.

Fixes 614732eaa12d ("openvswitch: Use regular VXLAN net_device device")

This is so error prone, with some vport_ops needing to mark the module and some don't (because they are in the main openvswitch driver).

Fix this properly, by making the vport_ops register function be a macro that sets THIS_MODULE in the vport_ops before passing it on down to the real registry function.