Re: [PATCH nf] netfilter: ipset: do not exceed maxelem when reusing a deleted slot
From: Qing Lee
Date: Fri Dec 04 2026 - 11:04:44 EST
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