[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Freeze exception for batman-adv-kernelland



Hi,

I've uploaded the version batman-adv-kernelland 2010.0.0-2 to unstable. It
fixes rc bugs #593471, #593472, #593519 and #593724 and the important bug
#593473. All those patches were already send to the Linux stable tree
maintainers and were accepted in 2.6.35.4.

A patch with all changes between both versions is attached. There are two
changes which corrects the path for the dkms module and the debian policy
version. I hope that those aren't too problematic for the release team.

The patches and the bugs contain all information to the problems and should be
verbose enough to understand them.

Could you please unblock this package?

thanks,
	Sven


Source: batman-adv-kernelland
Binary: batman-adv-source batman-adv-dkms
Architecture: source all
Version: 2010.0.0-2
Distribution: unstable
Urgency: low
Maintainer: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Changed-By: Sven Eckelmann <sven.eckelmann@gmx.de>
Description: 
 batman-adv-dkms - DKMS Source for the batman-advanced kernel module
 batman-adv-source - Source for the batman-advanced kernel module
Closes: 593471 593472 593473 593519 593724
Changes: 
 batman-adv-kernelland (2010.0.0-2) unstable; urgency=low
 .
   * Correct destination path of dkms module
   * Upgraded to policy 3.9.1, no changes required
   * debian/patches:
     - Add foreign_stats.patch, Don't increment stats of foreign device (Closes:
       #593473)
     - Add orig_hash_deadlock.patch, unify orig_hash_lock spinlock handling to
       avoid deadlocks (Closes: #593519)
     - Add register_event.patch, Create batman_if only on register event (Closes:
       #593471)
     - Add netdev_reference.patch, Don't use net_dev after dev_put (Closes:
       #593472)
     - Add mac_packet_buff_check.patch, Don't write in not allocated packet_buff
       (Closes: #593724)
diff --git a/debian/batman-adv-dkms.dkms b/debian/batman-adv-dkms.dkms
index 630e17a..18c9045 100644
--- a/debian/batman-adv-dkms.dkms
+++ b/debian/batman-adv-dkms.dkms
@@ -5,7 +5,7 @@ PACKAGE_NAME='batman-adv'
 PACKAGE_VERSION="#MODULE_VERSION#"
 
 BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
-DEST_MODULE_LOCATION[0]="/kernel/net/"
+DEST_MODULE_LOCATION[0]="/kernel/net/batman-adv/"
 AUTOINSTALL=yes
 
 MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build"
diff --git a/debian/changelog b/debian/changelog
index 37287dc..57c69b0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,21 @@
+batman-adv-kernelland (2010.0.0-2) unstable; urgency=low
+
+  * Correct destination path of dkms module
+  * Upgraded to policy 3.9.1, no changes required
+  * debian/patches:
+    - Add foreign_stats.patch, Don't increment stats of foreign device (Closes:
+      #593473)
+    - Add orig_hash_deadlock.patch, unify orig_hash_lock spinlock handling to
+      avoid deadlocks (Closes: #593519)
+    - Add register_event.patch, Create batman_if only on register event (Closes:
+      #593471)
+    - Add netdev_reference.patch, Don't use net_dev after dev_put (Closes:
+      #593472)
+    - Add mac_packet_buff_check.patch, Don't write in not allocated packet_buff
+      (Closes: #593724)
+
+ -- Sven Eckelmann <sven.eckelmann@gmx.de>  Sat, 21 Aug 2010 10:47:59 +0200
+
 batman-adv-kernelland (2010.0.0-1) unstable; urgency=low
 
   * New Upstream Version
diff --git a/debian/control b/debian/control
index f598e64..199f886 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,7 @@ Maintainer: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
 Uploaders: Sven Eckelmann <sven.eckelmann@gmx.de>
 Dm-Upload-Allowed: yes
 Homepage: http://www.open-mesh.net/
-Standards-Version: 3.8.4
+Standards-Version: 3.9.1
 Vcs-Browser: http://git.debian.org/?p=collab-maint/batman-adv-kernelland.git
 Vcs-Git: git://git.debian.org/git/collab-maint/batman-adv-kernelland.git
 Build-Depends: debhelper (>= 7), dkms (>= 2.1.1.1-2)
diff --git a/debian/patches/foreign_stats.patch b/debian/patches/foreign_stats.patch
new file mode 100644
index 0000000..797b88f
--- /dev/null
+++ b/debian/patches/foreign_stats.patch
@@ -0,0 +1,34 @@
+Description: Don't increment stats of foreign device
+ The receive hook for batman-adv ethernet frames tried to get the last device
+ which processed the skb before us. It only used that information to update the
+ rx_bytes and rx_packets stat of that foreign device which already has updated
+ it using its own receive functions.
+Author: Sven Eckelmann <sven.eckelmann@gmx.de>
+Bug-Debian: http://bugs.debian.org/593473
+
+---
+diff --git a/hard-interface.c b/hard-interface.c
+index bc2bd12cf96ce854311b28fdc3d73e5ecb41edc5..b2c53b771e337b979f7cf7d0054a37778e176a43 100644
+--- a/hard-interface.c
++++ b/hard-interface.c
+@@ -440,7 +440,6 @@ int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
+ {
+ 	struct batman_packet *batman_packet;
+ 	struct batman_if *batman_if;
+-	struct net_device_stats *stats;
+ 	int ret;
+ 
+ 	skb = skb_share_check(skb, GFP_ATOMIC);
+@@ -469,12 +468,6 @@ int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
+ 	if (batman_if->if_status != IF_ACTIVE)
+ 		goto err_free;
+ 
+-	stats = (struct net_device_stats *)dev_get_stats(skb->dev);
+-	if (stats) {
+-		stats->rx_packets++;
+-		stats->rx_bytes += skb->len;
+-	}
+-
+ 	batman_packet = (struct batman_packet *)skb->data;
+ 
+ 	if (batman_packet->version != COMPAT_VERSION) {
diff --git a/debian/patches/mac_packet_buff_check.patch b/debian/patches/mac_packet_buff_check.patch
new file mode 100644
index 0000000..e50f518
--- /dev/null
+++ b/debian/patches/mac_packet_buff_check.patch
@@ -0,0 +1,39 @@
+Description: Don't write in not allocated packet_buff
+ Each net_device in a system will automatically managed as a possible batman_if
+ and holds different informations like a buffer with a prepared originator
+ messages. To reduce the memory usage, the packet_buff will only be allocated
+ when the interface is really added/enabled for batman-adv.
+ .
+ The function to update the hw address information inside the packet_buff just
+ assumes that the packet_buff is always initialised and thus the kernel will
+ just oops when we try to change the hw address of a not already fully enabled
+ interface.
+ .
+ We must always check if the packet_buff is allocated before we try to change
+ information inside of it.
+Author: Sven Eckelmann <sven.eckelmann@gmx.de>
+Bug-Debian: http://bugs.debian.org/593724
+
+---
+diff --git a/hard-interface.c b/hard-interface.c
+index 60e8a56423766e2e69f55db561e42ede8c609a61..65a4a54ca91f6a05b84d21bacbfe293581a633e4 100644
+--- a/hard-interface.c
++++ b/hard-interface.c
+@@ -129,6 +129,9 @@ static bool hardif_is_iface_up(struct batman_if *batman_if)
+ 
+ static void update_mac_addresses(struct batman_if *batman_if)
+ {
++	if (!batman_if || !batman_if->packet_buff)
++		return;
++
+ 	addr_to_string(batman_if->addr_str, batman_if->net_dev->dev_addr);
+ 
+ 	memcpy(((struct batman_packet *)(batman_if->packet_buff))->orig,
+@@ -339,6 +342,7 @@ static struct batman_if *hardif_add_interface(struct net_device *net_dev)
+ 	batman_if->if_num = -1;
+ 	batman_if->net_dev = net_dev;
+ 	batman_if->if_status = IF_NOT_IN_USE;
++	batman_if->packet_buff = NULL;
+ 	INIT_LIST_HEAD(&batman_if->list);
+ 
+ 	check_known_mac_addr(batman_if->net_dev->dev_addr);
diff --git a/debian/patches/netdev_reference.patch b/debian/patches/netdev_reference.patch
new file mode 100644
index 0000000..d45d6b4
--- /dev/null
+++ b/debian/patches/netdev_reference.patch
@@ -0,0 +1,69 @@
+Description: Don't use net_dev after dev_put
+ dev_put allows a device to be freed when all its references are dropped. After
+ that we are not allowed to access that information anymore. Access to the data
+ structure of a net_device must be surrounded a dev_hold and ended using
+ dev_put.
+ .
+ batman-adv adds a device to its own management structure in
+ hardif_add_interface and will release it in hardif_remove_interface. Thus it
+ must hold a reference all the time between those functions to prevent any
+ access to the already released net_device structure.
+Author: Sven Eckelmann <sven.eckelmann@gmx.de>
+Bug-Debian: http://bugs.debian.org/593472
+
+---
+diff --git a/hard-interface.c b/hard-interface.c
+index 67f5ed6ae76bb075fb400bc117d37b4e5658aa0a..60e8a56423766e2e69f55db561e42ede8c609a61 100644
+--- a/hard-interface.c
++++ b/hard-interface.c
+@@ -195,8 +195,6 @@ static void hardif_activate_interface(struct bat_priv *bat_priv,
+ 	if (batman_if->if_status != IF_INACTIVE)
+ 		return;
+ 
+-	dev_hold(batman_if->net_dev);
+-
+ 	update_mac_addresses(batman_if);
+ 	batman_if->if_status = IF_TO_BE_ACTIVATED;
+ 
+@@ -223,8 +221,6 @@ static void hardif_deactivate_interface(struct batman_if *batman_if)
+ 	   (batman_if->if_status != IF_TO_BE_ACTIVATED))
+ 		return;
+ 
+-	dev_put(batman_if->net_dev);
+-
+ 	batman_if->if_status = IF_INACTIVE;
+ 
+ 	printk(KERN_INFO "batman-adv:Interface deactivated: %s\n",
+@@ -322,12 +318,14 @@ static struct batman_if *hardif_add_interface(struct net_device *net_dev)
+ 	if (ret != 1)
+ 		goto out;
+ 
++	dev_hold(net_dev);
++
+ 	batman_if = kmalloc(sizeof(struct batman_if), GFP_ATOMIC);
+ 	if (!batman_if) {
+ 		printk(KERN_ERR "batman-adv:"
+ 		       "Can't add interface (%s): out of memory\n",
+ 		       net_dev->name);
+-		goto out;
++		goto release_dev;
+ 	}
+ 
+ 	batman_if->dev = kstrdup(net_dev->name, GFP_ATOMIC);
+@@ -351,6 +349,8 @@ free_dev:
+ 	kfree(batman_if->dev);
+ free_if:
+ 	kfree(batman_if);
++release_dev:
++	dev_put(net_dev);
+ out:
+ 	return NULL;
+ }
+@@ -379,6 +379,7 @@ static void hardif_remove_interface(struct batman_if *batman_if)
+ 	batman_if->if_status = IF_TO_BE_REMOVED;
+ 	list_del_rcu(&batman_if->list);
+ 	sysfs_del_hardif(&batman_if->hardif_obj);
++	dev_put(batman_if->net_dev);
+ 	call_rcu(&batman_if->rcu, hardif_free_interface);
+ }
+ 
diff --git a/debian/patches/orig_hash_deadlock.patch b/debian/patches/orig_hash_deadlock.patch
new file mode 100644
index 0000000..e50a71f
--- /dev/null
+++ b/debian/patches/orig_hash_deadlock.patch
@@ -0,0 +1,68 @@
+Description: unify orig_hash_lock spinlock handling to avoid deadlocks
+ The orig_hash_lock spinlock always has to be locked with IRQs being disabled to
+ avoid deadlocks between code that is being executed in IRQ context and code
+ that is being executed in non-IRQ context.
+Author: Marek Lindner <lindner_marek@yahoo.de>
+Bug-Debian: http://bugs.debian.org/593519
+
+---
+diff --git a/originator.c b/originator.c
+index 5435bd6cc79098a66a5f4a375103f921665772ed..a330580d689867d1f23ad3063431f19ca24d3656 100644
+--- a/originator.c
++++ b/originator.c
+@@ -401,11 +401,12 @@ static int orig_node_add_if(struct orig_node *orig_node, int max_if_num)
+ int orig_hash_add_if(struct batman_if *batman_if, int max_if_num)
+ {
+ 	struct orig_node *orig_node;
++	unsigned long flags;
+ 	HASHIT(hashit);
+ 
+ 	/* resize all orig nodes because orig_node->bcast_own(_sum) depend on
+ 	 * if_num */
+-	spin_lock(&orig_hash_lock);
++	spin_lock_irqsave(&orig_hash_lock, flags);
+ 
+ 	while (hash_iterate(orig_hash, &hashit)) {
+ 		orig_node = hashit.bucket->data;
+@@ -414,11 +415,11 @@ int orig_hash_add_if(struct batman_if *batman_if, int max_if_num)
+ 			goto err;
+ 	}
+ 
+-	spin_unlock(&orig_hash_lock);
++	spin_unlock_irqrestore(&orig_hash_lock, flags);
+ 	return 0;
+ 
+ err:
+-	spin_unlock(&orig_hash_lock);
++	spin_unlock_irqrestore(&orig_hash_lock, flags);
+ 	return -ENOMEM;
+ }
+ 
+@@ -480,12 +481,13 @@ int orig_hash_del_if(struct batman_if *batman_if, int max_if_num)
+ {
+ 	struct batman_if *batman_if_tmp;
+ 	struct orig_node *orig_node;
++	unsigned long flags;
+ 	HASHIT(hashit);
+ 	int ret;
+ 
+ 	/* resize all orig nodes because orig_node->bcast_own(_sum) depend on
+ 	 * if_num */
+-	spin_lock(&orig_hash_lock);
++	spin_lock_irqsave(&orig_hash_lock, flags);
+ 
+ 	while (hash_iterate(orig_hash, &hashit)) {
+ 		orig_node = hashit.bucket->data;
+@@ -512,10 +514,10 @@ int orig_hash_del_if(struct batman_if *batman_if, int max_if_num)
+ 	rcu_read_unlock();
+ 
+ 	batman_if->if_num = -1;
+-	spin_unlock(&orig_hash_lock);
++	spin_unlock_irqrestore(&orig_hash_lock, flags);
+ 	return 0;
+ 
+ err:
+-	spin_unlock(&orig_hash_lock);
++	spin_unlock_irqrestore(&orig_hash_lock, flags);
+ 	return -ENOMEM;
+ }
diff --git a/debian/patches/register_event.patch b/debian/patches/register_event.patch
new file mode 100644
index 0000000..d620557
--- /dev/null
+++ b/debian/patches/register_event.patch
@@ -0,0 +1,35 @@
+Description: Create batman_if only on register event
+ We try to get all events for all net_devices to be able to add special sysfs
+ folders for the batman-adv configuration. This also includes such events like
+ NETDEV_POST_INIT which has no valid kobject according to
+ v2.6.32-rc3-13-g7ffbe3f. This would create an oops in that situation.
+ .
+ It is enough to create the batman_if only on NETDEV_REGISTER events because we
+ will also receive those events for devices which already existed when we
+ registered the notifier call.
+Author: Sven Eckelmann <sven.eckelmann@gmx.de>
+Bug-Debian: http://bugs.debian.org/593471
+
+---
+diff --git a/hard-interface.c b/hard-interface.c
+index b2c53b771e337b979f7cf7d0054a37778e176a43..67f5ed6ae76bb075fb400bc117d37b4e5658aa0a 100644
+--- a/hard-interface.c
++++ b/hard-interface.c
+@@ -398,15 +398,13 @@ static int hard_if_event(struct notifier_block *this,
+ 	/* FIXME: each batman_if will be attached to a softif */
+ 	struct bat_priv *bat_priv = netdev_priv(soft_device);
+ 
+-	if (!batman_if)
+-		batman_if = hardif_add_interface(net_dev);
++	if (!batman_if && event == NETDEV_REGISTER)
++			batman_if = hardif_add_interface(net_dev);
+ 
+ 	if (!batman_if)
+ 		goto out;
+ 
+ 	switch (event) {
+-	case NETDEV_REGISTER:
+-		break;
+ 	case NETDEV_UP:
+ 		hardif_activate_interface(bat_priv, batman_if);
+ 		break;
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..42cf32d
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,5 @@
+foreign_stats.patch
+orig_hash_deadlock.patch
+register_event.patch
+netdev_reference.patch
+mac_packet_buff_check.patch

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: