All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf 0/2] netfilter: ctnetlink: fix memory leak in ctnetlink dump
@ 2025-08-01 15:25 Florian Westphal
  2025-08-01 15:25 ` [PATCH nf 1/2] netfilter: ctnetlink: fix refcount leak on table dump Florian Westphal
  2025-08-01 15:25 ` [PATCH nf 2/2] netfilter: ctnetlink: remove refcounting in expectation dumpers Florian Westphal
  0 siblings, 2 replies; 5+ messages in thread
From: Florian Westphal @ 2025-08-01 15:25 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

This series fixes a memory (refcount) leak in the ctnetlink dump code.
In some cases is possible that the entry being held in cb->args[] (with
refcount raised) fails to be delivered.

If this happens, the reference count is erronously incremented a second
time.

This results in a memory leak and non-recoverable hang in the netns
cleanup worker.

The second patch fixes a similar pattern in the expectation dump code.

In both cases the fix is to not use reference counting at all, the restart
hint is replaced by a cookie value, this has the same guarantees as the
existing code without need for keeping objects alive across partial dumps.

Note that the same pattern is used for dying lists, but as far as I can
see this problem can't happen there.  I will submit a patch for nf-next
that also uses refcount-less cookie values in the dying list dumper.

Florian Westphal (2):
  netfilter: ctnetlink: fix refcount leak on table dump
  netfilter: ctnetlink: remove refcounting in expectation dumpers

 net/netfilter/nf_conntrack_netlink.c | 65 +++++++++++++---------------
 1 file changed, 30 insertions(+), 35 deletions(-)

-- 
2.49.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-08-07 11:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-01 15:25 [PATCH nf 0/2] netfilter: ctnetlink: fix memory leak in ctnetlink dump Florian Westphal
2025-08-01 15:25 ` [PATCH nf 1/2] netfilter: ctnetlink: fix refcount leak on table dump Florian Westphal
2025-08-07 10:57   ` Pablo Neira Ayuso
2025-08-07 11:29     ` Florian Westphal
2025-08-01 15:25 ` [PATCH nf 2/2] netfilter: ctnetlink: remove refcounting in expectation dumpers Florian Westphal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.