From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dvalin.narfation.org (dvalin.narfation.org [213.160.73.56]) (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 765C23FB7C7 for ; Fri, 26 Jun 2026 16:10:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.160.73.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782490221; cv=none; b=lkbCTmpXCRJTE98j4Dg52fjriWj7t/s9oSWzm/ix3zJ1sHqNC041xlPyd3UtEkIQsNF9fszRgGTXIwhu2tIlqxQmw6PTa0oFSt7PqOwoh3m5bQggkkgUVsc8L2DsKpALas+klrQGPhJGTLUS4h1FLgNWZEQYgRpC4W1p+2fMzHc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782490221; c=relaxed/simple; bh=di51BW8gGhVdIPbboju227ruUnM23BORPLVpRQrjdS4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rbZmtqgJffo7+/sIpXNuxC4tXVQkudG7cIQZAl4QTMlL3Uv43l6Pt0Bn5sHCfs+bmCyMF7VTKUTsvH4XGzIrHUufJh9omz3OIvB5IHbHth7lgA4Ga4mn2TqpciLcjuCLq1S/DNZkrtyH89WQYnmK64p5hhsdj4QwtktjqErPX1c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=narfation.org; spf=pass smtp.mailfrom=narfation.org; dkim=pass (1024-bit key) header.d=narfation.org header.i=@narfation.org header.b=YwnAvkLu; arc=none smtp.client-ip=213.160.73.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=narfation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=narfation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=narfation.org header.i=@narfation.org header.b="YwnAvkLu" Received: by dvalin.narfation.org (Postfix) id B4B53202D1; Fri, 26 Jun 2026 16:10:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1782490203; 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=11MAXUY84KPFJmNH7zW2nOAu3IKj8iIqFAha+LVbqe0=; b=YwnAvkLuifP2TU36pC3YQM/M1z9XIOBueWpGR8dj/gf1B+RUFBWbBPA3OaFRoUhqUQDcLA qo2ekYG94+ZNL0f3KyyqmRTagK7wW1wPuJtPgZUKTfq3WM1/IuVHdYzRoPo4wKh9D0vuM/ uss6hyMBePWVC3fZMhTbZbwmDGvjBgk= From: Sven Eckelmann To: stable@vger.kernel.org Cc: Sven Eckelmann Subject: [PATCH 5.10 21/23] batman-adv: dat: prevent false sharing between VLANs Date: Fri, 26 Jun 2026 18:09:50 +0200 Message-ID: <20260626160952.123713-22-sven@narfation.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260626160952.123713-1-sven@narfation.org> References: <20260626160952.123713-1-sven@narfation.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit commit 20d7658b74169f86d4ac01b9185b3eadddf71f28 upstream. 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 --- 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 9d27d7d7b2b4b..592b61a2e7911 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c @@ -216,10 +216,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; } /** @@ -346,6 +349,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