[PATCH] fix net_device leak in vlan

Subsystems: networking [general], the rest

STALE6930d

3 messages, 3 authors, 2007-09-16 · open the first message on its own page

[PATCH] fix net_device leak in vlan

From: Al Viro <hidden>
Date: 2007-09-03 13:35:33

In "[VLAN]: Move device registation to seperate function" (commit
e89fe42cd03c8fd3686df82d8390a235717a66de), a pile of code got moved
to register_vlan_dev(), including grabbing a reference to underlying
device.  However, original dev_hold() had been left behind, so we
leak a reference to net_device now...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 1583c5e..2a54691 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -562,8 +562,6 @@ static int register_vlan_device(struct net_device *real_dev,
 	if (err < 0)
 		goto out_free_newdev;
 
-	/* Account for reference in struct vlan_dev_info */
-	dev_hold(real_dev);
 #ifdef VLAN_DEBUG
 	printk(VLAN_DBG "Allocated new device successfully, returning.\n");
 #endif

Re: [PATCH] fix net_device leak in vlan

From: Patrick McHardy <hidden>
Date: 2007-09-03 14:23:34

Al Viro wrote:
In "[VLAN]: Move device registation to seperate function" (commit
e89fe42cd03c8fd3686df82d8390a235717a66de), a pile of code got moved
to register_vlan_dev(), including grabbing a reference to underlying
device.  However, original dev_hold() had been left behind, so we
leak a reference to net_device now...

Looks good, thanks for catching this.

Re: [PATCH] fix net_device leak in vlan

From: David Miller <davem@davemloft.net>
Date: 2007-09-16 23:43:30

From: Al Viro <redacted>
Date: Mon, 3 Sep 2007 14:35:20 +0100
In "[VLAN]: Move device registation to seperate function" (commit
e89fe42cd03c8fd3686df82d8390a235717a66de), a pile of code got moved
to register_vlan_dev(), including grabbing a reference to underlying
device.  However, original dev_hold() had been left behind, so we
leak a reference to net_device now...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Patch applied, thanks Al.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help