alfred: bump version to 2015.1
[feed/routing.git] / batman-adv / patches / 0004-batman-adv-Make-NC-capability-changes-atomic.patch
1 From 586df9e2537b51c0df7ce99576c3cee1681b64de Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
3 Date: Tue, 16 Jun 2015 17:10:23 +0200
4 Subject: [PATCH 04/17] batman-adv: Make NC capability changes atomic
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Bitwise OR/AND assignments in C aren't guaranteed to be atomic. One
10 OGM handler might undo the set/clear of a specific bit from another
11 handler run in between.
12
13 Fix this by using the atomic set_bit()/clear_bit() functions.
14
15 Fixes: 7dd9d8992b0c ("batman-adv: tvlv - add network coding container")
16 Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
17 Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
18 ---
19 network-coding.c | 4 ++--
20 1 file changed, 2 insertions(+), 2 deletions(-)
21
22 diff --git a/network-coding.c b/network-coding.c
23 index 89e1d47..3ce493e 100644
24 --- a/network-coding.c
25 +++ b/network-coding.c
26 @@ -105,9 +105,9 @@ static void batadv_nc_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
27 uint16_t tvlv_value_len)
28 {
29 if (flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND)
30 - orig->capabilities &= ~BATADV_ORIG_CAPA_HAS_NC;
31 + clear_bit(BATADV_ORIG_CAPA_HAS_NC, &orig->capabilities);
32 else
33 - orig->capabilities |= BATADV_ORIG_CAPA_HAS_NC;
34 + set_bit(BATADV_ORIG_CAPA_HAS_NC, &orig->capabilities);
35 }
36
37 /**
38 --
39 2.1.4
40