Prior to Linux 2.6.35, net devices outside the initial net namespace
did not have sysfs directories.  Attempting to add attributes to
them will trigger a BUG().

Reported-and-tested-by: Russell Stuart <russell-deb...@stuart.id.au>
Signed-off-by: Ben Hutchings <b...@decadent.org.uk>
---
This applies to 2.6.32 *only*.  It has not been applied upstream since
the limitation no longer exists.

Dave, please ack or nak this for stable.

Ben.

 drivers/net/tun.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 4fdfa2a..0f77aca 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1006,7 +1006,8 @@ static int tun_set_iff(struct net *net, struct file 
*file, struct ifreq *ifr)
                if (err < 0)
                        goto err_free_sk;
 
-               if (device_create_file(&tun->dev->dev, &dev_attr_tun_flags) ||
+               if (!net_eq(dev_net(tun->dev), &init_net) ||
+                   device_create_file(&tun->dev->dev, &dev_attr_tun_flags) ||
                    device_create_file(&tun->dev->dev, &dev_attr_owner) ||
                    device_create_file(&tun->dev->dev, &dev_attr_group))
                        printk(KERN_ERR "Failed to create tun sysfs files\n");
-- 
1.7.1




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to