Skip to contentSkip to conversation

the macvlan device causes SLAB corruption on network namespace exit.

PATCH New Anders Franzen 1 participant 1 message Nov 24, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 the macvlan device causes SLAB corruption on network namespace exit.

When doing exit from a network namespace, cleanup functions are executed from the function default_device_exit_batch.
In the macvlan device, this will generate a call to macvlan_dellink. If it is the last macvlan using a ''lowerdev'' the port is destroyed.

Later the a call to macvlan_stop is executed. when the macvlan_hash_del(vlan) is executed, the memory of the already freed port will be corrupted.

---
 drivers/net/macvlan.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/macvlan.c +3 -1
index 6ed577b..c1cddb6 100644
@@ -338,7 +338,9 @@ static int macvlan_stop(struct net_device *dev)
 	dev_uc_del(lowerdev, dev->dev_addr);
 
 hash_del:
-	macvlan_hash_del(vlan);
+	if (macvlan_port_exists(lowerdev))
+		macvlan_hash_del(vlan);
+
 	return 0;
 }
 
Signature · 1 line
1.7.2.3