Commit 23556323 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

[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: default avatarPavel Emelyanov <xemul@openvz.org>
Acked-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b2a5c19c
...@@ -692,6 +692,20 @@ static int vlan_dev_init(struct net_device *dev) ...@@ -692,6 +692,20 @@ static int vlan_dev_init(struct net_device *dev)
return 0; 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) void vlan_setup(struct net_device *dev)
{ {
ether_setup(dev); ether_setup(dev);
...@@ -701,6 +715,7 @@ void vlan_setup(struct net_device *dev) ...@@ -701,6 +715,7 @@ void vlan_setup(struct net_device *dev)
dev->change_mtu = vlan_dev_change_mtu; dev->change_mtu = vlan_dev_change_mtu;
dev->init = vlan_dev_init; dev->init = vlan_dev_init;
dev->uninit = vlan_dev_uninit;
dev->open = vlan_dev_open; dev->open = vlan_dev_open;
dev->stop = vlan_dev_stop; dev->stop = vlan_dev_stop;
dev->set_mac_address = vlan_dev_set_mac_address; dev->set_mac_address = vlan_dev_set_mac_address;
......
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