batman-adv: add critical bug fix
[openwrt/svn-archive/archive.git] / net / batman-adv / patches / batman-adv_fix_tt_local_reset_flags_function.patch
1 From: Antonio Quartulli <ordex@autistici.org>
2
3 Currently the counter of tt_local_entry structures (tt_local_num) is incremented
4 each time the tt_local_reset_flags() is invoked causing the node to send wrong
5 TT_REPONSE packets containing a copy of non-initialised memory thus corrupting
6 other nodes global translation table and making higher level communication
7 impossible.
8
9 Reported-by: Junkeun Song <jun361@gmail.com>
10 Signed-off-by: Antonio Quartulli <ordex@autistici.org>
11 Acked-by: Junkeun Song <jun361@gmail.com>
12 ---
13 translation-table.c | 2 ++
14 1 files changed, 2 insertions(+), 0 deletions(-)
15
16 diff --git a/translation-table.c b/translation-table.c
17 index 2d2cfc1..d4a3917 100644
18 --- a/translation-table.c
19 +++ b/translation-table.c
20 @@ -1727,6 +1727,8 @@ static void tt_local_reset_flags(struct bat_priv *bat_priv, uint16_t flags)
21 rcu_read_lock();
22 hlist_for_each_entry_rcu(tt_local_entry, node,
23 head, hash_entry) {
24 + if (!(tt_local_entry->flags & flags))
25 + continue;
26 tt_local_entry->flags &= ~flags;
27 atomic_inc(&bat_priv->num_local_tt);
28 }
29 --
30 1.7.3.4
31