B.A.T.M.A.N Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Wunderlich <sw@simonwunderlich.de>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	b.a.t.m.a.n@lists.open-mesh.org,
	Sven Eckelmann <sven@narfation.org>,
	stable@vger.kernel.org, Simon Wunderlich <sw@simonwunderlich.de>
Subject: [PATCH net 3/9] batman-adv: bla: prevent CRC corruptions after claim flush
Date: Fri, 21 Aug 2026 11:48:07 +0200	[thread overview]
Message-ID: <20260821094813.201800-4-sw@simonwunderlich.de> (raw)
In-Reply-To: <20260821094813.201800-1-sw@simonwunderlich.de>

From: Sven Eckelmann <sven@narfation.org>

When batadv_bla_del_backbone_claims() tried to remove all claims of a
backbone, it sets the CRC to 0. It assumes that the it had the last
reference of the claims because batadv_claim_release() (which runs after
the last reference was released), is XORing the crc16 of the claim address
with the backbone CRC.

If there would be a parallel holder of any of these references, it could
happen that the backbone CRC is (0 ^ crc16(delayed_released_claim)). Which
is the wrong starting point for the new claims it may receive when the
remote answers the claim request from batadv_bla_send_request().

This reinitializations can be completely dropped to avoid this problem.
batadv_claim_release() will take care of fixing the backbone CRC.

Cc: stable@vger.kernel.org
Fixes: 23721387c409 ("batman-adv: add basic bridge loop avoidance code")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/bridge_loop_avoidance.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index a3530cc90c959..3194ccdbce607 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -325,11 +325,6 @@ batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw)
 		}
 		spin_unlock_bh(list_lock);
 	}
-
-	/* all claims gone, initialize CRC */
-	spin_lock_bh(&backbone_gw->crc_lock);
-	backbone_gw->crc = BATADV_BLA_CRC_INIT;
-	spin_unlock_bh(&backbone_gw->crc_lock);
 }
 
 /**
-- 
2.47.3


  parent reply	other threads:[~2026-08-21  9:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21  9:48 [PATCH net 0/9] pull request: batman-adv 2026-08-21 Simon Wunderlich
2026-08-21  9:48 ` [PATCH net 1/9] batman-adv: fix stale receive device on merged fragments Simon Wunderlich
2026-08-22 10:52   ` Sven Eckelmann
2026-08-22 20:00   ` patchwork-bot+netdevbpf
2026-08-21  9:48 ` [PATCH net 2/9] batman-adv: bla: avoid CRC corruption due to parallel claim add Simon Wunderlich
2026-08-22 11:01   ` Sven Eckelmann
2026-08-21  9:48 ` Simon Wunderlich [this message]
2026-08-22 11:15   ` [PATCH net 3/9] batman-adv: bla: prevent CRC corruptions after claim flush Sven Eckelmann
2026-08-21  9:48 ` [PATCH net 4/9] batman-adv: dat: avoid unaligned fault in IP extraction Simon Wunderlich
2026-08-21  9:48 ` [PATCH net 5/9] batman-adv: dat: atomically update mac addresses Simon Wunderlich
2026-08-21  9:48 ` [PATCH net 6/9] batman-adv: fix TX priority extraction for BATADV_FORW_MCAST Simon Wunderlich
2026-08-22 11:34   ` Sven Eckelmann
2026-08-21  9:48 ` [PATCH net 7/9] batman-adv: mcast: ensure unshared skb for multicast packets Simon Wunderlich
2026-08-21  9:48 ` [PATCH net 8/9] batman-adv: mcast: linearize skbuff for packet generation Simon Wunderlich
2026-08-22 11:41   ` Sven Eckelmann
2026-08-21  9:48 ` [PATCH net 9/9] batman-adv: bla: fix freeing of claims on meshif deletion Simon Wunderlich
2026-08-22 11:56   ` Sven Eckelmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260821094813.201800-4-sw@simonwunderlich.de \
    --to=sw@simonwunderlich.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=sven@narfation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox