41 lines
1.3 KiB
Diff
41 lines
1.3 KiB
Diff
From 586df9e2537b51c0df7ce99576c3cee1681b64de Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
|
|
Date: Tue, 16 Jun 2015 17:10:23 +0200
|
|
Subject: [PATCH 04/10] batman-adv: Make NC capability changes atomic
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Bitwise OR/AND assignments in C aren't guaranteed to be atomic. One
|
|
OGM handler might undo the set/clear of a specific bit from another
|
|
handler run in between.
|
|
|
|
Fix this by using the atomic set_bit()/clear_bit() functions.
|
|
|
|
Fixes: 7dd9d8992b0c ("batman-adv: tvlv - add network coding container")
|
|
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
|
|
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
|
|
---
|
|
network-coding.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/network-coding.c b/network-coding.c
|
|
index 89e1d47..3ce493e 100644
|
|
--- a/network-coding.c
|
|
+++ b/network-coding.c
|
|
@@ -105,9 +105,9 @@ static void batadv_nc_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
|
|
uint16_t tvlv_value_len)
|
|
{
|
|
if (flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND)
|
|
- orig->capabilities &= ~BATADV_ORIG_CAPA_HAS_NC;
|
|
+ clear_bit(BATADV_ORIG_CAPA_HAS_NC, &orig->capabilities);
|
|
else
|
|
- orig->capabilities |= BATADV_ORIG_CAPA_HAS_NC;
|
|
+ set_bit(BATADV_ORIG_CAPA_HAS_NC, &orig->capabilities);
|
|
}
|
|
|
|
/**
|
|
--
|
|
2.1.4
|
|
|