[PATCH RFC 03/38] netfilter: xt_recent: don't remove the proc entries under a spinlock
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Tue Nov 3 06:47:31 PST 2026
> recent_proc_net_exit() removes the proc entries of all tables with
> recent_lock held. remove_proc_entry() waits until nobody calls into the
> entry anymore, and reading one of them takes recent_lock in
> recent_seq_start() while procfs has the entry pinned. So when a reader
> gets there while the network namespace goes away, the exit path sleeps
> with a spinlock held and bh disabled, waiting for a reader that spins
> on that very lock:
>
> BUG: sleeping function called from invalid context at kernel/sched/completion.c:116
> in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 12, name: kworker/u16:0
> locks held by kworker/u16:0/12: 4, last CPU#2:
> #2: (pernet_ops_rwsem){++++}-{4:4}, at: cleanup_net+0xbf/0x860
> #3: (recent_lock){+...}-{3:3}, at: recent_net_exit+0x3d/0x170 [xt_recent]
> Workqueue: netns cleanup_net
> Call Trace:
> [ ... ]
> with a proc entry pinned takes it. So take recent_mutex instead.
>
> Fixes: 665e205c16c1 ("netfilter: xt_recent: fix namespace destroy path")
> Cc: stable at vger.kernel.org
> Signed-off-by: Christian Brauner (Amutable) <brauner at kernel.org>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261102-work-procfs-bugfixes-v1-0-59422ed3e465@kernel.org?part=3
More information about the kexec
mailing list