Repository : ssh://git@open-mesh.org/batman-adv
On branch : maint
>---------------------------------------------------------------
commit 1e4a96a4cfdfdf57fecacf1c8fa493345a9fcc03
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Mon Nov 3 23:16:19 2014 +0100
batman-adv: Fix double fetch in RCU version of hlist_*entry*
The backported (<3.9) version of hlist_for_each_entry_rcu and
hlist_for_each_entry_safe uses the new macro hlist_entry_safe. It is called
with an ACCESS_ONCE parameter for the first parameter ptr. This disallows
merging of the two loads which the current version of the macro uses.
This is problematic because this macro must only generate one load. Otherwise
with two contexts (or CPUs) following could happen:
1. context 1 fetches the ptr to the last entry in hlist_entry_safe() and
accepts this non-NULL ptr
2. context 2 deletes the last entry and terminates the list with NULL
3. context 1 re-fetches the pointer, doesn't check for zero, calculates the
entry based on a NULL pointer
4. context 1 crashes because it tries to load/write data from/to the invalid
address
Instead use a single load to a temporary variable and do the NULL-check and
calculation based on that one.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
>---------------------------------------------------------------
1e4a96a4cfdfdf57fecacf1c8fa493345a9fcc03
compat.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/compat.h b/compat.h
index 5eb5fe6..79ba39b 100644
--- a/compat.h
+++ b/compat.h
@@ -345,7 +345,9 @@ static int __batadv_interface_tx(struct sk_buff *skb, \
dev->master;\
})
#define hlist_entry_safe(ptr, type, member) \
- (ptr) ? hlist_entry(ptr, type, member) : NULL
+ ({ typeof(ptr) ____ptr = (ptr); \
+ ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
+ })
#undef hlist_for_each_entry
#define hlist_for_each_entry(pos, head, member) \
Repository : ssh://git@open-mesh.org/batman-adv
Branch 'master' now includes:
8353fd1 list: fix order of arguments for hlist_add_after(_rcu)
99aed11 Merge branch 'next'
Repository : ssh://git@open-mesh.org/batman-adv
On branch : next
>---------------------------------------------------------------
commit 8353fd1a6d4216a027c75fc3bb73b08ad1d55ef3
Author: Ken Helias <kenhelias(a)firemail.de>
Date: Fri Aug 15 13:38:47 2014 +0200
list: fix order of arguments for hlist_add_after(_rcu)
All other add functions for lists have the new item as first argument
and the position where it is added as second argument. This was changed
for no good reason in this function and makes using it unnecessary
confusing.
The name was changed to hlist_add_behind() to cause unconverted code to
generate a compile error instead of using the wrong parameter order.
[akpm(a)linux-foundation.org: coding-style fixes]
Signed-off-by: Ken Helias <kenhelias(a)firemail.de>
Cc: "Paul E. McKenney" <paulmck(a)linux.vnet.ibm.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher(a)intel.com> [intel driver bits]
Cc: Hugh Dickins <hughd(a)google.com>
Cc: Christoph Hellwig <hch(a)infradead.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds(a)linux-foundation.org>
[sven(a)narfation.org: fix parameter order, add compat code]
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
>---------------------------------------------------------------
8353fd1a6d4216a027c75fc3bb73b08ad1d55ef3
compat.h | 6 ++++++
fragmentation.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/compat.h b/compat.h
index ed5b815..eb837ae 100644
--- a/compat.h
+++ b/compat.h
@@ -446,4 +446,10 @@ static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
#endif /* < KERNEL_VERSION(3, 16, 0) */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
+
+#define hlist_add_behind(n, prev) hlist_add_after(prev, n)
+
+#endif /* < KERNEL_VERSION(3, 17, 0) */
+
#endif /* _NET_BATMAN_ADV_COMPAT_H_ */
diff --git a/fragmentation.c b/fragmentation.c
index 022d18a..fc1835c 100644
--- a/fragmentation.c
+++ b/fragmentation.c
@@ -188,7 +188,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
/* Reached the end of the list, so insert after 'frag_entry_last'. */
if (likely(frag_entry_last)) {
- hlist_add_after(&frag_entry_last->list, &frag_entry_new->list);
+ hlist_add_behind(&frag_entry_new->list, &frag_entry_last->list);
chain->size += skb->len - hdr_size;
chain->timestamp = jiffies;
ret = true;
Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
>---------------------------------------------------------------
commit 47dc789e7f949b74eef810ca3b48dd2fac0402bf
Author: Simon Wunderlich <sw(a)simonwunderlich.de>
Date: Wed Aug 13 14:26:56 2014 +0200
batman-adv: fix and simplify condition when bonding should be used
The current condition actually does NOT consider bonding when the
interface the packet came in from is the soft interface, which is the
opposite of what it should do (and the comment describes). Fix that and
slightly simplify the condition.
Reported-by: Ray Gibson <booray(a)gmail.com>
Signed-off-by: Simon Wunderlich <sw(a)simonwunderlich.de>
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
>---------------------------------------------------------------
47dc789e7f949b74eef810ca3b48dd2fac0402bf
routing.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/routing.c b/routing.c
index 3a6764d..139d2f6 100644
--- a/routing.c
+++ b/routing.c
@@ -442,11 +442,13 @@ batadv_find_router(struct batadv_priv *bat_priv,
router = batadv_orig_router_get(orig_node, recv_if);
+ if (!router)
+ return router;
+
/* only consider bonding for recv_if == BATADV_IF_DEFAULT (first hop)
* and if activated.
*/
- if (recv_if == BATADV_IF_DEFAULT || !atomic_read(&bat_priv->bonding) ||
- !router)
+ if (!(recv_if == BATADV_IF_DEFAULT && atomic_read(&bat_priv->bonding)))
return router;
/* bonding: loop through the list of possible routers found
The annotated tag, v3.18-rc3 has been created
at 9661ddfd3ad0bb4cee8ec6659331271eec7bd738 (tag)
tagging 0df1f2487d2f0d04703f142813d53615d62a1da4 (commit)
replaces v3.18-rc2
tagged by Linus Torvalds
on Sun Nov 2 15:02:13 2014 -0800
- Shortlog ------------------------------------------------------------
Linux 3.18-rc3
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAABAgAGBQJUVrf1AAoJEHm+PkMAQRiGtUkH/RX941uLQo0V+K0dy6LKD+Dv
YmdmS7wQQ/Y5ji+qaaMgpqS1Fcjh7q1qXLSCstxiU42xVsulFKF1iA4fbesdmUvN
zrtRYFCDPH2s0dycRfui9EW0ss/Bb3/l2aiRdpyzMBgwHa3Em2z74CdY9EPYkePW
zozrNSwSt+iTSw9sg9SdaBiayV+jlFwJ+pgpjUccpRz3Ob7z5LlYtuLk4pITtFuw
hc00bdCeduD0UJ3NC7WLS4USH5ZXZLkNB+OoteUw6srPUiDeaG0LefdV4D4J1eKe
dcUXgoCMAqqc3a4PybC0sYBGumJmdaQwNVkh7RBLwUkQ0zjiuvbNcjSYfTG2yFs=
=vR5Z
-----END PGP SIGNATURE-----
-----------------------------------------------------------------------
--
linux integration