From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.simonwunderlich.de (mail.simonwunderlich.de [23.88.38.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3B6233ADA8 for ; Fri, 19 Jun 2026 07:00:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=23.88.38.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781852460; cv=none; b=c+lhpFrp1YSGWabgQOEHlKPhme1badeHxysoTwuSY+My2rO980CDH01GnrpKNo9ZK8AOTsK+yr9JGhV4wGsCAtGdFpAaT5obyD+XVOfkqfkygaEiBqzbtiTufQS/Y9nGFussJbRVcp/RixA6zoKysonr+kNdrvQ/yR+I01RdOIs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781852460; c=relaxed/simple; bh=pW77rAJgegkBP/hnVfi2NYylT9SiKlq3uZ53FUz6NhQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aRVgUti7GIAp2YIOxjsO88hsopW8PPL/86UPhQryhCpzQEJl1f15Gkmi+AU7oB8QsP3dkG50oZLhuf4WVXE3qeXpAljgV3pBEFmfmcqBkZS891xij9UdKVhtu2ifTxpGGHTd7Li3JLM23ymb2BNkjvoyWLmnylGoE1IYGAnab+Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=simonwunderlich.de; spf=pass smtp.mailfrom=simonwunderlich.de; dkim=pass (2048-bit key) header.d=simonwunderlich.de header.i=@simonwunderlich.de header.b=pAt5jmmu; arc=none smtp.client-ip=23.88.38.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=simonwunderlich.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=simonwunderlich.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=simonwunderlich.de header.i=@simonwunderlich.de header.b="pAt5jmmu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=simonwunderlich.de; s=09092022; t=1781852455; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4vd3XpcRqG07DRs5Sf90jAxQ0vzJC0YNpd4xsAKMEl4=; b=pAt5jmmutaVQHH8SPqrS+uSvumGinZA7gjUTi19bSDn5Jtd2I1hgavcPSQOlHngQM9CWax EujQ9WecmRffta1Y1ih4P1GquFu6UkXIq7KBEzBc98TfLKvEts2QwFDBY/DmEV1kA1A+tR H4P5UJf5LEhORZSDMGHAuStgc7481QwIlm3G65nvTKZ+sOsSgzzn9k9HJ4cVEK1nObx36q P3P8tHFBKjvnpwxRrEjaydFERf4XiuO14atX5uOPWMGIsZAoLbiAoqczi4GXNg4z/vKr9o J/KnjzXAwEreMOkKexDIptgV1AJECc3tCdZDDZsQsIGwZisLD39MlbvHdemX1A== From: Simon Wunderlich To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , b.a.t.m.a.n@lists.open-mesh.org, Sven Eckelmann , stable@kernel.org, Simon Wunderlich Subject: [PATCH net 13/15] batman-adv: dat: prevent false sharing between VLANs Date: Fri, 19 Jun 2026 09:00:43 +0200 Message-ID: <20260619070045.438101-14-sw@simonwunderlich.de> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260619070045.438101-1-sw@simonwunderlich.de> References: <20260619070045.438101-1-sw@simonwunderlich.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Sven Eckelmann The local hash of DAT entries is supposed to be VLAN (VID) aware. But the adding to the hash and the search in the hash were not checking the VID information of the hash entries. The entries would therefore only be correctly separated when batadv_hash_dat() didn't select the same buckets for different VIDs. Cc: stable@kernel.org Fixes: be1db4f6615b ("batman-adv: make the Distributed ARP Table vlan aware") Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich --- net/batman-adv/distributed-arp-table.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index aaea155b94038..ae39ceaa2e29a 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c @@ -215,10 +215,13 @@ static void batadv_dat_purge(struct work_struct *work) */ static bool batadv_compare_dat(const struct hlist_node *node, const void *data2) { - const void *data1 = container_of(node, struct batadv_dat_entry, - hash_entry); + const struct batadv_dat_entry *entry1; + const struct batadv_dat_entry *entry2; - return memcmp(data1, data2, sizeof(__be32)) == 0; + entry1 = container_of(node, struct batadv_dat_entry, hash_entry); + entry2 = data2; + + return entry1->ip == entry2->ip && entry1->vid == entry2->vid; } /** @@ -345,6 +348,9 @@ batadv_dat_entry_hash_find(struct batadv_priv *bat_priv, __be32 ip, if (dat_entry->ip != ip) continue; + if (dat_entry->vid != vid) + continue; + if (!kref_get_unless_zero(&dat_entry->refcount)) continue; -- 2.47.3