🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16179

[PATCH net-next 12/15] batman-adv: dat: increase hash generation when purging entries

#16179
From: Simon Wunderlich
Date: Sat, 14 Nov 2026 09:15
33 lines
10049 bytes
From: Sven Eckelmann <sven@narfation.org>

If batadv_dat_cache_dump() is preempted during a netlink dump and resumes
in the middle of a hash bucket while __batadv_dat_purge() concurrently
removes an entry, the dump offset will be shifted.

Without incrementing the hash generation counter, netlink won't set
NLM_F_DUMP_INTR and the userspace will not be informed about the
inconsistent dump.

Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-83da443f-ce69-4393-a29f-e02b70d1ec96
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 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 37de9787104d5..d558d2300d607 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -248,6 +248,7 @@ static void __batadv_dat_purge(struct batadv_priv *bat_priv,
 				continue;
 
 			hlist_del_rcu(&dat_entry->hash_entry);
+			atomic_inc(&bat_priv->dat.hash->generation);
 			batadv_dat_entry_put(dat_entry);
 		}
 		spin_unlock_bh(list_lock);
-- 
2.47.3
Technical Details
Message-ID: <20261114091556.3336038-13-sw@simonwunderlich.de>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363142-linux-kernel-netdev=dewy.ru
References: <20261114091556.3336038-1-sw@simonwunderlich.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363142-linux-kernel-netdev=dewy.ru
From: sw@simonwunderlich.de (Simon Wunderlich)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 12/15] batman-adv: dat: increase hash generation when purging entries
Date: Sat, 14 Nov 2026 10:15:53 +0100
Organization: Usenet Network
Message-ID: <20261114091556.3336038-13-sw@simonwunderlich.de>
References: <20261114091556.3336038-1-sw@simonwunderlich.de>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1538592"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:PWS/KZHItSCb42Nhw8f+XIsG9sM= sha256:x/2JlYMaeTzHGMuc1MP3d7aVl6K61FMhqDBrGVDVzVk=
	sha1:4eaXjFABbdv5WM9oGGGUWuhmZkg= sha256:+wrKXQFOTdc1GbbZ3LZ5s7g2ASZlEYNPbQefAwJ49yA=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 4489C114776; Sat, 14 Nov 2026 12:17:09 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=simonwunderlich.de
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id a2AnogeW6rrf;
	Sat, 14 Nov 2026 12:17:06 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-363142-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=simonwunderlich.de
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 90B1611477D; Sat, 14 Nov 2026 12:16:57 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id ACF5462C6B; Sat, 14 Nov 2026 09:16:47 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794647772;
	b=bwguQMz2K3l4NVRJ3Nj2YL8pIA0g4u73K/Um1KlI2RfY2jcUkVdodU8fSr6vTNOYYiix
	 OTIGLs6n0odnptPDk6UloqWuv8KDxpiP0vp8Jkypv9MD1RMfwXW2qwZeNzy7kLZK5Bya/
	 B0LaCODvhwwmbIoRjK3+VBx8DWc1bO98B8L3HhuUmmUdHWUms5T/IshzUUdl9cajGyN/P
	 jm6H7z9Cr6QOQZakVWDofLvbxT5PsF2DZ5j8H0huBIZ+RNo4Na9x0nb6uaRVAW8RvZKPJ
	 d4E8CrYxz2ByU9UNUSb+pKG5Pfsnq9y17hRF35nEFOYtlLSS1pIEiHG/LwZV6kLoapg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794647772;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To:
	 Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=VeB0jYC6+zpSJAoBxeDUgpp5ixdXEAE72IDA3+gAE3M=;
	b=cx+UrfrnqBMuhpjvK7mu+QC2ruVTbl2XJmyrTdpZ7ovSeK5iO6bTVqG6mrHt10uNqKYX
	 xHQZ02ImvnvuTr0wNVOTM0pqGzOcp1M2FLfwqkG3I6HUxG7SpI5uDMB4iC/5YWa2hPwuL
	 vbq4DbhYJWIlCx2cu346aEwpd5BeVi2nkNpRlX6Y+qcWewbUblpDgCZX8u6C7r67bGzfw
	 SVoOsQhTo3AlenTjaDyXdPnUskk8F/0zZzrJRFPaQUZtHohtcPH+G0Zm1ELF+kT6y5CXV
	 TSY/sR5sFWSHF/OigLbYXI+i6K5zV49n8oqq47fuR4f/IXoA901cwb0Wdxtdiu6OP6w==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=simonwunderlich.de header.i=@simonwunderlich.de header.a=rsa-sha256 header.s=09092022 header.b=e474Cllx;
	dmarc=pass header.from=simonwunderlich.de;
	spf=pass smtp.mailfrom=simonwunderlich.de;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id B034360A263C;
	Sat, 14 Nov 2026 09:16:12 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=simonwunderlich.de header.i=@simonwunderlich.de header.a=rsa-sha256 header.s=09092022 header.b=e474Cllx
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=23.88.38.48
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794647771;
	b=PqAD83oQFxz9oI7CWs52kfbAdJuYEVoYI7rT/MXF6fINq9YZohsLfuBwYvI5h//DTBZe
	 hf5N4/KS4dANNzqDjfKH0kQkfIUoJj18EqocukkMY+/CNjjzJbccqWwbMP+6Wp2bqbddv
	 uvO80eSGp1TWjDS39xz+ZsXKjdaSRq4XGdDvH2EgoOe7JlLq2i7Nvbcm9+29q29C3fQ5Y
	 Oji0Ytk/fWmy3lK989U2qe+evOjiFaPgDxLqURw3DvsQ4nWF7BgLJAo6+Xt1TKL8j9CEY
	 2tAgnZ6LxYlQF5TrGFInuuihvPQgl5KEuVmWFlkc4erw9q+6uUf+CMnOJXHqCs53t2g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794647771;
	h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=VeB0jYC6+zpSJAoBxeDUgpp5ixdXEAE72IDA3+gAE3M=;
	b=s4DO5eX2K27dh3ORpHQCZ/tAqCZmxR7uaQf8kbs8vIM9IDKHFJLhLBuuN/vy7pmMLDLD
	 Rlw0zglk9xiPlcaYek8pIJw9QNS9+mPNmJ8lHQtlCXUgj7CLKFQcp7dRYpuKs030VD/7y
	 qwCaA+UfdGSRzmUBZKDKp6PDB5EBd0yVVthB9ZJF5OKvWBddcxYV1PalphYz0hbw4af4G
	 HDQ2OlhnKt2VnPxldjsrVU77cQENH9c1jzM+pgSwFcMMvfjKLCwF6DfxSGhh4MNhrB/pt
	 Nj5u3/g2JRgBvxcY35oVlo6k3ACzI5d8GF08WhdicLpBS4Z7hIsPbMlS1VOTkOSSQAQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=simonwunderlich.de;
	spf=pass smtp.mailfrom=simonwunderlich.de;
	dkim=pass header.d=simonwunderlich.de header.i=@simonwunderlich.de header.a=rsa-sha256 header.s=09092022 header.b=e474Cllx;
	arc=none smtp.remote-ip=23.88.38.48
X-Received: from mail.simonwunderlich.de (mail.simonwunderlich.de [23.88.38.48])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with UTF8SMTPS id 5F46860A2602
	for <netdev@vger.kernel.org>; Sat, 14 Nov 2026 09:16:11 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5F46860A2602
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=simonwunderlich.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=simonwunderlich.de
X-Received: from kero.packetmixer.de (unknown [IPv6:2a02:3037:6ed:dd6c:838:344b:3152:2d5e])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange secp256r1 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by mail.simonwunderlich.de (Postfix) with UTF8SMTPSA id 4DE2AFA262;
	Sat, 14 Nov 2026 10:16:09 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=simonwunderlich.de;
	s=09092022; t=1794647769;
	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=VeB0jYC6+zpSJAoBxeDUgpp5ixdXEAE72IDA3+gAE3M=;
	b=e474CllxrcR39m3gPVulcyvj/7YmhHLQVhpSzL6UofdzAruhudb5Hpx+/e9B3kYzIWdWJj
	afteiIijqvXeY8ad7F0tdYtdIMVRgFHnGxkAEgd1CIhr97Ywejmxa2+oJyX+LQwnSaUk2w
	O2sZWAz8chSqtaa7hpaXlPn0CxxKN8j5EGP3Mks//sEDYDB7OXv95ltV0EbaZjnWRt7cz0
	p6sJYrZeE4IpwpA7T2ljHLXSnFSi+cjYGspoymttUXvaOIk5mxrCAQR5Gt80tdrH+lnqGM
	qhN7hJuLPPIIxz2WigLQGOG8ClN/xR/M46v8bBXbL9OaPg9F1B4K6fr09ybMVA==
X-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>,
	Sashiko <sashiko-bot@kernel.org>,
	Simon Wunderlich <sw@simonwunderlich.de>
X-Mailer: git-send-email 2.47.3
X-In-Reply-To: <20261114091556.3336038-1-sw@simonwunderlich.de>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list