The following commit has been merged in the linux branch:
commit 6a10cd96982e33b7587c635eaabf1a8944b65f4f
Author: Sven Eckelmann <sven.eckelmann(a)gmx.de>
Date: Tue Sep 7 20:31:42 2010 +0200
Staging: batman-adv: Add rcu TODO
Paul E. McKenney informed us that rcu is misused by leaking pointers to
rcu related elements outside read-side protected critical sections.
He also recommended that we should check it against the rcu checklist.
Signed-off-by: Sven Eckelmann <sven.eckelmann(a)gmx.de>
diff --git a/drivers/staging/batman-adv/TODO b/drivers/staging/batman-adv/TODO
index 1457c7f..3af8028 100644
--- a/drivers/staging/batman-adv/TODO
+++ b/drivers/staging/batman-adv/TODO
@@ -1,3 +1,8 @@
+ * Rework usage of RCU
+ - don't leak pointers from rcu out of rcu critical area which may
+ get freed
+ - check were synchronize_rcu must be used
+ - go through Documentation/RCU/checklist.txt
* Request a new review
* Process the comments from the review
* Move into mainline proper
--
linux integration
Author: marek
Date: 2010-09-06 16:08:05 +0200 (Mon, 06 Sep 2010)
New Revision: 1788
Modified:
trunk/batman-adv/main.c
Log:
batman-adv: Always synchronize rcu's on module shutdown
During the module shutdown procedure in batman_exit(), a rcu callback is
being scheduled (batman_exit -> hardif_remove_interfaces ->
hardif_remove_interfae -> call_rcu). However, when the kernel unloads
the module, the rcu callback might not have been executed yet, resulting
in a "unable to handle kernel paging request" in __rcu_process_callback
afterwards, causing the kernel to freeze.
The synchronize_net and synchronize_rcu in mesh_free are currently
called before the call_rcu in hardif_remove_interface and have no real
effect on it.
Therefore, we should always flush all rcu callback functions scheduled
during the shutdown procedure using synchronize_net. The call to
synchronize_rcu can be omitted because synchronize_net already calls it.
Signed-off-by: Linus L?\195?\188ssing <linus.luessing(a)web.de>
Acked-by: Sven Eckelmann <sven.eckelmann(a)gmx.de>
Modified: trunk/batman-adv/main.c
===================================================================
--- trunk/batman-adv/main.c 2010-09-04 23:47:38 UTC (rev 1787)
+++ trunk/batman-adv/main.c 2010-09-06 14:08:05 UTC (rev 1788)
@@ -73,6 +73,8 @@
flush_workqueue(bat_event_workqueue);
destroy_workqueue(bat_event_workqueue);
bat_event_workqueue = NULL;
+
+ synchronize_net();
}
int mesh_init(struct net_device *soft_iface)
@@ -135,9 +137,6 @@
hna_local_free(bat_priv);
hna_global_free(bat_priv);
- synchronize_net();
-
- synchronize_rcu();
atomic_set(&bat_priv->mesh_state, MESH_INACTIVE);
}
Author: marek
Date: 2010-09-05 01:47:38 +0200 (Sun, 05 Sep 2010)
New Revision: 1787
Modified:
trunk/batman-adv/bitarray.h
Log:
batman-adv: make bitarray.h checkpatch clean
Signed-off-by: Sven Eckelmann <sven.eckelmann(a)gmx.de>
Modified: trunk/batman-adv/bitarray.h
===================================================================
--- trunk/batman-adv/bitarray.h 2010-09-04 22:56:50 UTC (rev 1786)
+++ trunk/batman-adv/bitarray.h 2010-09-04 23:47:38 UTC (rev 1787)
@@ -23,7 +23,7 @@
#define _NET_BATMAN_ADV_BITARRAY_H_
/* you should choose something big, if you don't want to waste cpu
- and keep the type in sync with bit_packet_count */
+ * and keep the type in sync with bit_packet_count */
#define TYPE_OF_WORD unsigned long
#define WORD_BIT_SIZE (sizeof(TYPE_OF_WORD) * 8)
The following commit has been merged in the linux branch:
commit b4fb4917c35c29b183bee3f60c55156200f091a0
Author: Sven Eckelmann <sven.eckelmann(a)gmx.de>
Date: Sat Sep 4 18:25:43 2010 +0200
batman-adv: Add missing include for bat_sys.h
soft_interface.c needs sysfs_add_meshif and sysfs_del_meshif after
"batman-adv: attach each hard-interface to a soft-interface". This
Include is provided indirectly using compat.h on standalone sources, but
missing on kernel builds.
We should add it directly as the compat.h include is only a side effect
we cannot rely on.
Signed-off-by: Sven Eckelmann <sven.eckelmann(a)gmx.de>
diff --git a/drivers/staging/batman-adv/soft-interface.c b/drivers/staging/batman-adv/soft-interface.c
index 15a7c1e..592cb39 100644
--- a/drivers/staging/batman-adv/soft-interface.c
+++ b/drivers/staging/batman-adv/soft-interface.c
@@ -29,6 +29,7 @@
#include "types.h"
#include "hash.h"
#include "send.h"
+#include "bat_sysfs.h"
#include <linux/slab.h>
#include <linux/ethtool.h>
#include <linux/etherdevice.h>
--
linux integration
The tag, GregKH-20100904 has been updated
to 8001773d85548980c3a8ada0dfce941577895181 (commit)
from b4fb4917c35c29b183bee3f60c55156200f091a0
- Shortlog ------------------------------------------------------------
commit 8001773d85548980c3a8ada0dfce941577895181
Merge: b4fb491 dde523b
Author: Sven Eckelmann <sven.eckelmann(a)gmx.de>
Date: Sun Sep 5 01:23:18 2010 +0200
Merge remote branch 'origin/next' into linux
-----------------------------------------------------------------------
--
linux integration
Author: marek
Date: 2010-09-05 00:56:50 +0200 (Sun, 05 Sep 2010)
New Revision: 1786
Modified:
trunk/batman-adv/soft-interface.c
Log:
batman-adv: Don't double free unicast skb on failure
The soft-interface transmission function expects that the unicast skb is
still available when a send failed. This is not true on failed search
for a router. Thus we would try to free the skb twice and create many
different and hard to debug memory access failures due to access on not
(anymore) allocated memory.
Reported-by: Andreas Langer <an.langer(a)gmx.de>
Signed-off-by: Sven Eckelmann <sven.eckelmann(a)gmx.de>
Modified: trunk/batman-adv/soft-interface.c
===================================================================
--- trunk/batman-adv/soft-interface.c 2010-09-04 22:37:10 UTC (rev 1785)
+++ trunk/batman-adv/soft-interface.c 2010-09-04 22:56:50 UTC (rev 1786)
@@ -183,7 +183,7 @@
} else {
ret = unicast_send_skb(skb, bat_priv);
if (ret != 0)
- goto dropped;
+ goto dropped_freed;
}
bat_priv->stats.tx_packets++;
@@ -191,8 +191,9 @@
goto end;
dropped:
+ kfree_skb(skb);
+dropped_freed:
bat_priv->stats.tx_dropped++;
- kfree_skb(skb);
end:
return NETDEV_TX_OK;
}
Author: marek
Date: 2010-09-05 00:37:10 +0200 (Sun, 05 Sep 2010)
New Revision: 1785
Modified:
trunk/batman-adv/soft-interface.c
Log:
batman-adv: Add missing include for bat_sys.h
soft_interface.c needs sysfs_add_meshif and sysfs_del_meshif after
"batman-adv: attach each hard-interface to a soft-interface". This
Include is provided indirectly using compat.h on standalone sources, but
missing on kernel builds.
We should add it directly as the compat.h include is only a side effect
we cannot rely on.
Signed-off-by: Sven Eckelmann <sven.eckelmann(a)gmx.de>
Modified: trunk/batman-adv/soft-interface.c
===================================================================
--- trunk/batman-adv/soft-interface.c 2010-09-04 12:42:28 UTC (rev 1784)
+++ trunk/batman-adv/soft-interface.c 2010-09-04 22:37:10 UTC (rev 1785)
@@ -31,6 +31,7 @@
#include "gateway_common.h"
#include "gateway_client.h"
#include "send.h"
+#include "bat_sysfs.h"
#include <linux/slab.h>
#include <linux/ethtool.h>
#include <linux/etherdevice.h>