Files
linux/include/net
Jakub Kicinski 006a5035b4 inet: frags: flush pending skbs in fqdir_pre_exit()
We have been seeing occasional deadlocks on pernet_ops_rwsem since
September in NIPA. The stuck task was usually modprobe (often loading
a driver like ipvlan), trying to take the lock as a Writer.
lockdep does not track readers for rwsems so the read wasn't obvious
from the reports.

On closer inspection the Reader holding the lock was conntrack looping
forever in nf_conntrack_cleanup_net_list(). Based on past experience
with occasional NIPA crashes I looked thru the tests which run before
the crash and noticed that the crash follows ip_defrag.sh. An immediate
red flag. Scouring thru (de)fragmentation queues reveals skbs sitting
around, holding conntrack references.

The problem is that since conntrack depends on nf_defrag_ipv6,
nf_defrag_ipv6 will load first. Since nf_defrag_ipv6 loads first its
netns exit hooks run _after_ conntrack's netns exit hook.

Flush all fragment queue SKBs during fqdir_pre_exit() to release
conntrack references before conntrack cleanup runs. Also flush
the queues in timer expiry handlers when they discover fqdir->dead
is set, in case packet sneaks in while we're running the pre_exit
flush.

The commit under Fixes is not exactly the culprit, but I think
previously the timer firing would eventually unblock the spinning
conntrack.

Fixes: d5dd88794a ("inet: fix various use-after-free in defrags units")
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20251207010942.1672972-4-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-12-10 01:15:27 -08:00
..
2024-10-08 15:33:49 -07:00
2024-12-09 14:44:59 -08:00
2025-09-02 15:52:24 -07:00
2025-11-03 17:40:46 -08:00
2025-04-24 17:03:45 -07:00
2025-07-08 18:05:25 -07:00
2025-07-07 16:55:54 -07:00
2025-03-24 10:26:53 +00:00
2025-12-01 16:45:07 -08:00
2024-05-08 10:35:09 +01:00
2024-08-26 09:37:23 -07:00
2025-08-29 19:36:31 -07:00
2024-11-13 18:49:50 -08:00
2024-08-26 09:37:23 -07:00
2025-08-26 17:34:31 -07:00
2025-09-03 15:16:49 -07:00
2025-11-14 18:00:08 -08:00
2024-05-07 01:35:55 +02:00
2024-08-26 09:37:23 -07:00
2025-09-22 11:38:43 -07:00
2024-02-28 11:19:41 +00:00
2025-08-26 17:34:31 -07:00
2024-12-06 17:43:08 -08:00
2024-08-26 09:37:23 -07:00
2025-11-10 10:38:37 +01:00
2025-04-15 08:21:46 -07:00
2023-07-14 20:39:30 -07:00
2025-09-18 12:32:06 +02:00
2024-08-26 09:37:23 -07:00
2024-08-26 09:37:23 -07:00
2025-09-03 15:08:20 -07:00
2025-04-11 18:58:10 -07:00
2025-07-04 09:32:35 +02:00
2025-04-11 18:58:10 -07:00
2024-05-30 18:29:38 -07:00
2025-09-08 18:06:21 -07:00
2025-11-25 19:28:29 -08:00
2023-10-04 11:49:20 -07:00
2025-11-14 18:00:08 -08:00
2025-07-11 11:00:57 -07:00
2023-07-28 14:07:59 -07:00
2023-09-14 16:16:36 +02:00