summaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan_dev.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-04-04 12:45:12 -0700
committerDavid S. Miller <davem@davemloft.net>2008-04-04 12:45:12 -0700
commit23556323b22fef35bdc36465b7e7439ba3748c9f (patch)
treea82c7bfe8716a04b183bc9ac0689040be74229bc /net/8021q/vlan_dev.c
parentb2a5c19ca0315723cecb9489ff8b67c4f17367b4 (diff)
downloadop-kernel-dev-23556323b22fef35bdc36465b7e7439ba3748c9f.zip
op-kernel-dev-23556323b22fef35bdc36465b7e7439ba3748c9f.tar.gz
[VLAN]: Fix egress priority mappings leak.
These entries are allocated in vlan_dev_set_egress_priority, but are never released and leaks on vlan device removal. Drop these in vlan's ->uninit callback - after the device is brought down and everyone is notified about it is going to be unregistered. Found during testing vlan netnsization patchset. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Acked-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlan_dev.c')
-rw-r--r--net/8021q/vlan_dev.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 480ea90..41a76a0 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -692,6 +692,20 @@ static int vlan_dev_init(struct net_device *dev)
return 0;
}
+static void vlan_dev_uninit(struct net_device *dev)
+{
+ struct vlan_priority_tci_mapping *pm;
+ struct vlan_dev_info *vlan = vlan_dev_info(dev);
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(vlan->egress_priority_map); i++) {
+ while ((pm = vlan->egress_priority_map[i]) != NULL) {
+ vlan->egress_priority_map[i] = pm->next;
+ kfree(pm);
+ }
+ }
+}
+
void vlan_setup(struct net_device *dev)
{
ether_setup(dev);
@@ -701,6 +715,7 @@ void vlan_setup(struct net_device *dev)
dev->change_mtu = vlan_dev_change_mtu;
dev->init = vlan_dev_init;
+ dev->uninit = vlan_dev_uninit;
dev->open = vlan_dev_open;
dev->stop = vlan_dev_stop;
dev->set_mac_address = vlan_dev_set_mac_address;
OpenPOWER on IntegriCloud