Commit efc73f4b authored by Amir Hanania's avatar Amir Hanania Committed by David S. Miller

net: Fix memory leak - vlan_info struct

In driver reload test there is a memory leak.
The structure vlan_info was not freed when the driver was removed.
It was not released since the nr_vids var is one after last vlan was removed.
The nr_vids is one, since vlan zero is added to the interface when the interface
is being set, but the vlan zero is not deleted at unregister.
Fix - delete vlan zero when we unregister the device.
Signed-off-by: default avatarAmir Hanania <amir.hanania@intel.com>
Acked-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 941a46a2
...@@ -403,6 +403,9 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, ...@@ -403,6 +403,9 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
break; break;
case NETDEV_DOWN: case NETDEV_DOWN:
if (dev->features & NETIF_F_HW_VLAN_FILTER)
vlan_vid_del(dev, 0);
/* Put all VLANs for this dev in the down state too. */ /* Put all VLANs for this dev in the down state too. */
for (i = 0; i < VLAN_N_VID; i++) { for (i = 0; i < VLAN_N_VID; i++) {
vlandev = vlan_group_get_device(grp, i); vlandev = vlan_group_get_device(grp, i);
......
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