Re: [PATCH net 1/2] inetpeer: enforce hard limit on tree size and fix NULL peer rate limit

Eric Dumazet <[email protected]>
Newsgroups org.kernel.vger.netdev
Message-ID <CANn89i+kQ2qoBpi=W4dEpgkUWBCPMOMp2bvTOroSESMeECgydA@mail.gmail.com>
On Wed, Aug 12, 2026 at 10:59 PM Eric Dumazet <[email protected]> wrote:
>
> Currently, inet_peer_threshold is used to trigger aggressive garbage
> collection when tree size reaches the threshold. However, if garbage
> collection is unable to reclaim candidate entries (e.g. due to held
> references or active fragment queues), base->total can grow without
> any upper bound, consuming excessive slab memory.
>
> Fix this by enforcing a hard limit on inet_peer allocations when
> (u64)base->total reaches 2ULL * READ_ONCE(inet_peer_threshold). Casting
> to 64-bit unsigned avoids signed integer overflow if inet_peer_threshold
> is configured to large values via sysctl.
>
> Additionally, when peer allocation fails and returns NULL,
> inet_peer_xrlim_allow() previously returned true, allowing packets
> without rate limiting. Fix this to return false when peer is NULL,
> ensuring rate limiting fails closed under memory pressure.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Reported-by: Michael Blunt <[email protected]>
> Signed-off-by: Eric Dumazet <[email protected]>
> ---

I will drop this patch, sashiko is not happy and I do not really care.

pw-bot: cr
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.