path: root/net/8021q/vlan_netlink.c
diff options
authorPatrick McHardy <kaber@trash.net>2008-01-21 00:25:50 -0800
committerDavid S. Miller <davem@davemloft.net>2008-01-28 15:08:31 -0800
commitaf30151709bcace1ca844d4bb8b7e2e392ff81eb (patch)
tree5da346ea833fe8097359613463cd716613359215 /net/8021q/vlan_netlink.c
parentacc5efbcd2a023c8801f2bba39971cf93812ce7c (diff)
[VLAN]: Simplify vlan unregistration
Keep track of the number of VLAN devices in a vlan group. This allows to have the caller sense when the group is going to be destroyed and stop using it, which in turn allows to remove the wrapper around unregister_vlan_dev for the NETDEV_UNREGISTER notifier and avoid iterating over all possible VLAN ids whenever a device in unregistered. Also fix what looks like a use-after-free (but is actually safe since we're holding the RTNL), the real_dev reference should not be dropped while we still use it. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlan_netlink.c')
1 files changed, 1 insertions, 6 deletions
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index 0996185e2ed5..9ee63583ed27 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -137,11 +137,6 @@ static int vlan_newlink(struct net_device *dev,
return register_vlan_dev(dev);
-static void vlan_dellink(struct net_device *dev)
- unregister_vlan_device(dev);
static inline size_t vlan_qos_map_size(unsigned int n)
if (n == 0)
@@ -226,7 +221,7 @@ struct rtnl_link_ops vlan_link_ops __read_mostly = {
.validate = vlan_validate,
.newlink = vlan_newlink,
.changelink = vlan_changelink,
- .dellink = vlan_dellink,
+ .dellink = unregister_vlan_dev,
.get_size = vlan_get_size,
.fill_info = vlan_fill_info,

Privacy Policy