Patchwork [10/10] batman-adv: Fix range check for expected packets

login
register
mail settings
Submitter Marek Lindner
Date Nov. 26, 2011, 2:26 p.m.
Message ID <1322317612-7770-11-git-send-email-lindner_marek@yahoo.de>
Download mbox | patch
Permalink /patch/127810/
State Accepted
Delegated to: David Miller
Headers show

Comments

Marek Lindner - Nov. 26, 2011, 2:26 p.m.
From: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>

The check for new packets in the future used a wrong binary operator,
which makes the check expression always true and accepting too many
packets.

Reported-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 net/batman-adv/bitarray.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/net/batman-adv/bitarray.c b/net/batman-adv/bitarray.c
index 0be9ff3..9bc63b2 100644
--- a/net/batman-adv/bitarray.c
+++ b/net/batman-adv/bitarray.c
@@ -155,7 +155,7 @@  int bit_get_packet(void *priv, unsigned long *seq_bits,
 	/* sequence number is much newer, probably missed a lot of packets */
 
 	if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE)
-		|| (seq_num_diff < EXPECTED_SEQNO_RANGE)) {
+		&& (seq_num_diff < EXPECTED_SEQNO_RANGE)) {
 		bat_dbg(DBG_BATMAN, bat_priv,
 			"We missed a lot of packets (%i) !\n",
 			seq_num_diff - 1);