Re: [PATCH] xfrm: disable state hash resize work on netns exit

From: Florian Westphal

Date: Thu Oct 22 2026 - 06:53:14 EST


Eduard Zateev <hackerowskiy@xxxxxxxxx> wrote:
> xfrm_state_fini() flushes state_hash_work before it inspects and frees the
> per-net state hash tables. A concurrent state insertion can queue another
> resize while that flush is in progress. The resize worker may then replace
> and free a table while teardown is still walking it.

Is that correct? Can you explain why we can have a parallel insert
while we tear down the data structures?

If we have such a scenario, what prevents the insertion from happening
after the disable_work_sync, or after the xfrm_hash_free() calls?