Article View: linux.kernel.netdev
Article #27015Re: [PATCH nf] netfilter: ipset: do not exceed maxelem when reusing a deleted slot
From: Qing Lee
Date: Fri, 04 Dec 2026 16:04
Date: Fri, 04 Dec 2026 16:04
18 lines
11494 bytes
11494 bytes
Hi, This bug was observed during real-world testing on an embedded Linux 6.18 system running an iptables rule with a hash:ip ipset configured with a small maxelem (5) and a timeout. After a previously inserted entry expired/was removed from a bucket and 5 other IPs subsequently filled the set to maxelem, inserting another IP that hashed into the bucket with the deleted slot succeeded, resulting in `ipset list` reporting 6 entries with `maxelem 5`. From there, I traced the issue to mtype_add() in net/netfilter/ipset/ip_set_hash_gen.h, verified it is still present in nf.git, and compile-tested the patch with W=1. Thanks, Qing
Technical Details
Message-ID:
<20261204160422.181200-1-l.qing95@gmail.com>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377474-linux-kernel-netdev=dewy.ruReferences:
<179639924046.3305.14799040042850658552@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377474-linux-kernel-netdev=dewy.ru
From: l.qing95@gmail.com (Qing Lee)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH nf] netfilter: ipset: do not exceed maxelem when reusing a deleted slot
Date: Fri, 4 Dec 2026 17:04:22 +0100
Organization: Usenet Network
Message-ID: <20261204160422.181200-1-l.qing95@gmail.com>
References: <179639924046.3305.14799040042850658552@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2801233"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:avSaDZN7nc+TCWM3MctDC82uWBc= sha256:0N2SGvBooPWNDFKJSEdygK7b8Sv3xwphtDVdYiYgrSQ=
sha1:5eWCpLjIv9w+8HAuTFBOLZJYThE= sha256:ENJcnH6GzCPXbbUshl+3fepQBg9qUsMC/3WZdjqybb4=
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 CBB6D117C57; Fri, 4 Dec 2026 19:04:59 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.297
X-Spam-Status: No, score=-3.297 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001,
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=gmail.com
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 uZx3ex23_Jrj;
Fri, 4 Dec 2026 19:04:57 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377474-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 0735A117BFA; Fri, 4 Dec 2026 19:04:42 +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 E584586501; Fri, 4 Dec 2026 16:04:37 +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=1796400276;
b=k7/9eDjnaixB4wwj/AKsWX0zFo6fVK+mF111NdixYfaBPfeCbaj1+orRDi/Dprui/U6O
hjLGEwkFnmv3tACT2h+VR2X4tRoG7bPcX+1pCgG4Y9Au5v1Jq7FRkwtEHqmoM5kamP3xv
fVC+yMN15Ss9fRUuu+CPgKNkPPfRJFFCqwExJrc/0qb+uTo3pX1tRAfhfUzc9FKYVfTl8
TpSpTZmpqJoiGHoyR8nRC+dGLBlgRMJFkb0of3Ow6u4WTQ75cWeRIHmxMibT5fu/cOnBX
eLtJnpuCWrcAWoAZXuMqsvkFHbIEQzT1fWA6cCnkm1B/L6fl5ETISYwGCste/uLQLuQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796400276;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received: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=8KcV64+3gQKxSy5KvyaBw1KpSBhTdnaQcDjQVOcu99c=;
b=dEGKSIH2jWtossIkcshwBPOT4c7QKUe7dpTHmNH5zaQ4mz04nA30GGdH31VZuBMLmMOH
5UsybJvap9qPAnGqP66PtVZ9VsYt1vmNGvKdGLMEc14bpgeE+DO0YPTBkswPQ3hsd8NqY
rARrSQu5Q6ZAferu9Q0EsEW1OaPzc5LIrE40jCx8DpjTj1aunqOwyN7E6R2JSOvOAeDgn
1H8WVn0Frhd3y+umgVpmFVE0rfK/hwBB9FrZcO2Kp5wMUhGxgFE0FnewxmIKrVJQ6fh98
2tO2yg2JImUHWtPFlu0izgiH3gCO6D5tlIhoB2SwtKp78m1OsbXmBzJf8l4iKci0y/A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=NO4CGWjD;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
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 7FF06606A32D;
Fri, 4 Dec 2026 16:04:36 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=NO4CGWjD
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.54
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796400275;
b=T5EIj0ZNY3noWQ9X3Ji99AbnCprXOjTZTfkl9EMkq6pAx1BLge4uP73Jmo8u15z3lA84
YpzkgG/szPBlJFAIcSHquxc7+zxoMSzGVjnktBf1YrJ13OhEeQIjlTZKCGaaM9/xfjmIv
zPEGZlxf0Yd0pP9Zml+xKMvLQsSbWRvTXCN/PvZFjYd+ipORJ8xK3eRwj3yew7iIkl3Q5
k24VPQxz+6vdXJBGjRYzJ1vzoiZFcP5YM326bSp8a2HgFgJlW2H0FO57/0xNCb90T3GOp
kKSVWWQeMiKdr1tgHTdzERkLYODW3d53HRzj5MCK/B03ia28EUaFRfxshIDbFFf3cvA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796400275;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:
MIME-Version:Content-Transfer-Encoding;
bh=8KcV64+3gQKxSy5KvyaBw1KpSBhTdnaQcDjQVOcu99c=;
b=HWozhLPjehCTgQ1GbBh7Fx/Gxp70sh9jERRenOLyMRezr8uQG0a4DTYf/RCY+38ZfDh+
f+ZAAGDE0y2KbG3K9AQkH1ZSm3yDBKGxJlQjDsXdVLv7PxalqqBAy9pzsm0fiHq6avFWQ
tSCOHEJWsdWAsDOojM+BQKRufdG5s9ScslwnzrvxZrxnmEXE0MAmD/LuVY08yaBgINXTH
Gp9+D/uWrIt4J0Gek+W3EnWJR/sYLSDM5MeH+7CNX5u6o75lsX2jVMx2sainfpMXIR2IY
b2cVCTKoDxHHh9OJpC9ZHRFEUNunzOe0Z3Llu87nA6og7wvBSM1drC/v5gEZPyDqSrQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=NO4CGWjD;
arc=none smtp.remote-ip=209.85.128.54
X-Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AD0A606A322
for <netdev@vger.kernel.org>; Fri, 4 Dec 2026 16:04:35 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5AD0A606A322
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4a214c5c4c0so10871245e9.3
for <netdev@vger.kernel.org>; Fri, 04 Dec 2026 08:04:35 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1796400274; x=1797005074; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=8KcV64+3gQKxSy5KvyaBw1KpSBhTdnaQcDjQVOcu99c=;
b=NO4CGWjD5mx7Pgd4Txi3NHoi6BLb/hJjGU1IgIfqeR5FI95Yd2VUoiH6PfwlxnHM+T
0Ll4WEMwYW8b+oV94fB43PZtqKhGBYqCJod/erSU9TcKDT7CrnKx59/lUc61ghq4tHy9
lfNJzdWnEW9b2s17S9riGOBBrY5TxaIQ8HQgpW96srXlp55TUIg4KhQ4c3nvMUTKH5Lt
gmFRE+SMD+/hM34T50eXBxFOK0JorpZS4UliXyAjCdYRPqJXSM+ZMXW15uWDGIby2TxS
xP/df6fDDWsJVzYLcxLgowdbfVsHKddCYNHc1C0W+hwAYKsVulIyTVB/mmOGJ/qF1Dc6
HX7w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796400274; x=1797005074;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=8KcV64+3gQKxSy5KvyaBw1KpSBhTdnaQcDjQVOcu99c=;
b=yfmck/+U4zG3X55/tj4xcLDXdMEb2GrBY8BHiynJ8Qk+Nx8YBZsFtS4J7bgitF8Sku
YzCTkgtQ1Gg5lWNsxinQAWXCGV6aMES0Zmb8kZWuPl44i0kJMkclxG6Ar5czuRYLE46b
C1paQFxp3cy27AyORZVrKgoeaWZBI+Tlqm1o3Kw1+3kD5SwBNm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Received: by 2002:a05:600c:4fd1:b0:4bb:9dbd:feb7 with SMTP id 5b1f17b1804b1-4bbeb8bf3e4mr49921045e9.9.1796400273721;
Fri, 04 Dec 2026 08:04:33 -0800 (PST)
X-Received: from debian-ql.TELEVIC.com ([84.199.255.188])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbe21895edsm158369685e9.15.2026.12.04.08.04.33
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 04 Dec 2026 08:04:33 -0800 (PST)
X-Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Florian Westphal <fw@strlen.de>,
Phil Sutter <phil@nwl.cc>,
netfilter-devel@vger.kernel.org,
coreteam@netfilter.org,
netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.47.3
X-In-Reply-To: <179639924046.3305.14799040042850658552@kernel.org>
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