]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drop_monitor: perform u64_stats updates under IRQ-disabled section
authorEric Dumazet <edumazet@google.com>
Wed, 22 Jul 2026 14:17:43 +0000 (14:17 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 23 Jul 2026 18:00:01 +0000 (11:00 -0700)
commitfd098a23bf8fda7eae48db9b06e7c34fc4d228fa
treefbb9ba05adfee82280aafd2d27c891dcc6e3ce81
parent7089f7ab99c89f443c92d8fcc585e63f2727f0b3
drop_monitor: perform u64_stats updates under IRQ-disabled section

In net_dm_packet_trace_kfree_skb_hit() and net_dm_hw_trap_packet_probe(),
u64_stats_update_begin() / u64_stats_inc() / u64_stats_update_end() were
called after spin_unlock_irqrestore(&...drop_queue.lock, flags), when local
IRQs had already been re-enabled.

Tracepoint probes can execute in IRQ or softirq context. On 32-bit
architectures, u64_stats_update_begin() disables preemption but not interrupts,
relying on seqcount writes. If a nested interrupt occurs on the same CPU during
the 64-bit stats update, the reentrant seqcount update can corrupt the
seqcount state or stats value.

Fix this by performing the 64-bit per-CPU stats update before releasing
drop_queue.lock via spin_unlock_irqrestore(), ensuring local interrupts remain
disabled during the u64_stats update.

Fixes: e9feb58020f9 ("drop_monitor: Expose tail drop counter")
Fixes: 5e58109b1ea4 ("drop_monitor: Add support for packet alert mode for hardware drops")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260722141743.3266924-3-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/drop_monitor.c