netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net] net: Fix memory leak - vlan_info struct
@ 2012-07-10  6:47 Jeff Kirsher
  2012-07-11  6:36 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Kirsher @ 2012-07-10  6:47 UTC (permalink / raw)
  To: davem; +Cc: Amir Hanania, netdev, gospo, sassmann, Jeff Kirsher

From: Amir Hanania <amir.hanania@intel.com>

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: Amir Hanania <amir.hanania@intel.com>
Acked-by: John Fastabend <john.r.fastabend@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 net/8021q/vlan.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 6089f0c..9096bcb 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -403,6 +403,9 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
 		break;
 
 	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.  */
 		for (i = 0; i < VLAN_N_VID; i++) {
 			vlandev = vlan_group_get_device(grp, i);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [net] net: Fix memory leak - vlan_info struct
  2012-07-10  6:47 [net] net: Fix memory leak - vlan_info struct Jeff Kirsher
@ 2012-07-11  6:36 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-07-11  6:36 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: amir.hanania, netdev, gospo, sassmann

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Mon,  9 Jul 2012 23:47:19 -0700

> From: Amir Hanania <amir.hanania@intel.com>
> 
> 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: Amir Hanania <amir.hanania@intel.com>
> Acked-by: John Fastabend <john.r.fastabend@intel.com>
> Tested-by: Aaron Brown <aaron.f.brown@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-11  6:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-10  6:47 [net] net: Fix memory leak - vlan_info struct Jeff Kirsher
2012-07-11  6:36 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).