Skip to contentSkip to conversation

fix net_device leak in vlan

PATCH In review Al Viro 3 participants 3 messages Sep 3, 2007 – Sep 16, 2007

Subsystems (2)
lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 1/1 fix net_device leak in vlan

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...

---

net/8021q/vlan.c +0 -2
index 1583c5e..2a54691 100644
@@ -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
#1 lore raw
Quoted 5 lines · Al Viro

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.

maintainer
#2 lore raw
In reply to Al Viro

From: Al Viro <[email protected]>
Date: Mon, 3 Sep 2007 14:35:20 +0100

Quoted 7 lines

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...

Patch applied, thanks Al.