[kernel] r16257 - in dists/sid/linux-2.6/debian: . patches/bugfix/all patches/features/all/openvz patches/series

Ben Hutchings benh at alioth.debian.org
Thu Sep 9 04:32:31 UTC 2010


Author: benh
Date: Thu Sep  9 04:32:24 2010
New Revision: 16257

Log:
tun: Don't add sysfs attributes to devices without sysfs directories (Closes: #594845)

OpenVZ already had this!  Maybe they should have shared it.

Added:
   dists/sid/linux-2.6/debian/patches/bugfix/all/tun-Dont-add-sysfs-attributes-to-devices-without-sysfs-dirs.patch
Modified:
   dists/sid/linux-2.6/debian/changelog
   dists/sid/linux-2.6/debian/patches/features/all/openvz/openvz.patch
   dists/sid/linux-2.6/debian/patches/series/22

Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog	Thu Sep  9 04:30:28 2010	(r16256)
+++ dists/sid/linux-2.6/debian/changelog	Thu Sep  9 04:32:24 2010	(r16257)
@@ -44,6 +44,8 @@
     due to the potential ABI change which we now carefully avoid)
   * net/{tcp,udp,llc,sctp,tipc,x25}: Add limit for socket backlog
     (Closes: #592187)
+  * tun: Don't add sysfs attributes to devices without sysfs directories
+    (Closes: #594845)
 
   [ Bastian Blank ]
   * Use Breaks instead of Conflicts.

Added: dists/sid/linux-2.6/debian/patches/bugfix/all/tun-Dont-add-sysfs-attributes-to-devices-without-sysfs-dirs.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/bugfix/all/tun-Dont-add-sysfs-attributes-to-devices-without-sysfs-dirs.patch	Thu Sep  9 04:32:24 2010	(r16257)
@@ -0,0 +1,31 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Mon, 30 Aug 2010 14:38:14 +0100
+Subject: [PATCH] tun: Don't add sysfs attributes to devices without sysfs directories
+
+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-by: Russell Stuart <russell-debian at stuart.id.au>
+Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
+---
+ 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
+

Modified: dists/sid/linux-2.6/debian/patches/features/all/openvz/openvz.patch
==============================================================================
--- dists/sid/linux-2.6/debian/patches/features/all/openvz/openvz.patch	Thu Sep  9 04:30:28 2010	(r16256)
+++ dists/sid/linux-2.6/debian/patches/features/all/openvz/openvz.patch	Thu Sep  9 04:32:24 2010	(r16257)
@@ -12315,20 +12315,6 @@
  		tun_net_init(dev);
  
  		if (strchr(dev->name, '%')) {
-@@ -1006,9 +1030,10 @@ 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) ||
--		    device_create_file(&tun->dev->dev, &dev_attr_owner) ||
--		    device_create_file(&tun->dev->dev, &dev_attr_group))
-+		if ((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");
- 
- 		sk->sk_destruct = tun_sock_destruct;
 @@ -1316,6 +1341,7 @@ static int tun_chr_open(struct inode *inode, struct file * file)
  	tfile->tun = NULL;
  	tfile->net = get_net(current->nsproxy->net_ns);

Modified: dists/sid/linux-2.6/debian/patches/series/22
==============================================================================
--- dists/sid/linux-2.6/debian/patches/series/22	Thu Sep  9 04:30:28 2010	(r16256)
+++ dists/sid/linux-2.6/debian/patches/series/22	Thu Sep  9 04:32:24 2010	(r16257)
@@ -113,3 +113,4 @@
 + bugfix/all/tipc-use-limited-socket-backlog.patch
 + bugfix/all/x25-use-limited-socket-backlog.patch
 + debian/net-Avoid-ABI-change-from-limit-for-socket-backlog.patch
++ bugfix/all/tun-Dont-add-sysfs-attributes-to-devices-without-sysfs-dirs.patch



More information about the Kernel-svn-changes mailing list