diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2010-09-09 05:21:16 +0100 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2011-01-06 18:07:55 -0500 |
commit | 018402a0ef1042e1d1bbc22507dad258b5402e7c (patch) | |
tree | f61cbe9512e81900a87798714ef9c5ebfa964bc6 /drivers/net | |
parent | 0ca77ac6d65b2d2b0495fd3a8ebdeecc657d81b8 (diff) | |
download | linux-stable-018402a0ef1042e1d1bbc22507dad258b5402e7c.tar.gz linux-stable-018402a0ef1042e1d1bbc22507dad258b5402e7c.tar.bz2 linux-stable-018402a0ef1042e1d1bbc22507dad258b5402e7c.zip |
tun: Don't add sysfs attributes to devices without sysfs directories
This applies to 2.6.32 *only*. It has not been applied upstream since
the limitation no longer exists.
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-debian@stuart.id.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | 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 43265207d463..7b4a88b2f696 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1061,7 +1061,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"); |