[PATCH net 0/2] netlink: fix a dump livelock with a notification queued
From: Jhonata Poma-Hansen via B4 Relay
Date: Fri Oct 23 2026 - 07:27:23 EST
A netlink dump that starts while data is still charged to the reader's
socket fails with ENOBUFS when the reader's receive buffer is small,
even though a minimum size skb would fit. The dump stays marked as
running, every recvmsg() retries it, and a reader that peeks before
reading, as libnl does, spins forever.
I hit this with "iw dev wlan0 scan" on an arm64 board with a 6.6 based
kernel: iw hung at 100% CPU in 5 to 10 scans out of 15. A kprobe trace
showed the scan dump starting with the NEW_SCAN_RESULTS notification
still charged to iw's 16KiB socket, because iw had preempted the sender
before netlink_broadcast() returned.
Patch 1 retries the dump skb with the minimum size before failing.
Patch 2 adds a selftest which starts a link dump with a link
notification queued and reads it like libnl does.
Tested on net 734bef548a96 in a KVM guest: without patch 1 the new test
fails and a standalone reproducer livelocks in 3 runs out of 3; with
it, netlink-dumps passes 5 of 5 and the reproducer completes. The
existing netlink-dumps tests pass with and without the fix.
---
Jhonata Poma-Hansen (2):
netlink: retry a dump skb that does not fit with the minimum size
selftests: net: netlink-dumps: start a dump with a notification queued
net/netlink/af_netlink.c | 11 ++++
tools/testing/selftests/net/netlink-dumps.c | 93 +++++++++++++++++++++++++++++
2 files changed, 104 insertions(+)
---
base-commit: 734bef548a96e8774d6eef5dfa2026c6edc4e80b
change-id: 20261023-netlink-dump-livelock-e83cf13f977a
Best regards,
--
Jhonata Poma-Hansen <jhonata.poma@xxxxxxxxx>