From 4eb19a389d74f06901b4cd6f24b996b2e84eaefc Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Sun, 4 Oct 2026 10:10:06 +0200 Subject: [PATCH] batman-adv: dat: initialize orig_node of unfilled candidate slots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit batadv_dat_select_candidates() allocates the candidate array without zeroing it. batadv_choose_next_candidate() marks each slot as BATADV_DAT_CANDIDATE_NOT_FOUND but only sets orig_node when an eligible originator was found. In the following rounds, batadv_is_orig_node_eligible() compares res[j].orig_node of all previous slots against the evaluated originator. For slots without candidates, it reads uninitialized memory. The orig_node has to be cleared together with the BATADV_DAT_CANDIDATE_NOT_FOUND type. Cc: stable@vger.kernel.org Reported-by: Sashiko Closes: https://sashiko.dev/#/bug/linux-b25d9aa4-10bb-427c-a145-ccaadc2a1bb9 Fixes: 785ea1144182 ("batman-adv: Distributed ARP Table - create DHT helper functions") Acked-by: Linus Lüssing Signed-off-by: Sven Eckelmann --- net/batman-adv/distributed-arp-table.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index 74050bffedbc..0260ed7e828b 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c @@ -653,6 +653,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv, * NOT_FOUND */ cands[select].type = BATADV_DAT_CANDIDATE_NOT_FOUND; + cands[select].orig_node = NULL; /* iterate over the originator list and find the node with the closest * dat_address which has not been selected yet