Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3005d7f authored by Denis V. Lunev's avatar Denis V. Lunev Committed by David S. Miller
Browse files

[NETNS]: Add netns refcnt debug for network devices.



dev_set_net is called for
- just allocated devices
- devices moving from one namespace to another
release_net has proper check inside to distinguish these cases.

Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3661a910
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -758,7 +758,8 @@ static inline
void dev_net_set(struct net_device *dev, struct net *net)
void dev_net_set(struct net_device *dev, struct net *net)
{
{
#ifdef CONFIG_NET_NS
#ifdef CONFIG_NET_NS
	dev->nd_net = net;
	release_net(dev->nd_net);
	dev->nd_net = hold_net(net);
#endif
#endif
}
}


+2 −0
Original line number Original line Diff line number Diff line
@@ -4042,6 +4042,8 @@ EXPORT_SYMBOL(alloc_netdev_mq);
 */
 */
void free_netdev(struct net_device *dev)
void free_netdev(struct net_device *dev)
{
{
	release_net(dev_net(dev));

	/*  Compatibility with error handling in drivers */
	/*  Compatibility with error handling in drivers */
	if (dev->reg_state == NETREG_UNINITIALIZED) {
	if (dev->reg_state == NETREG_UNINITIALIZED) {
		kfree((char *)dev - dev->padded);
		kfree((char *)dev - dev->padded);