Re: [PATCH net] net/x25: don't call lock_sock() from softirq in x25_kill_by_neigh()
From: Martin Schiller
Date: Mon Nov 23 2026 - 02:58:13 EST
Hi Thang,
On Thu, 01 Oct 2026 17:01:18 +0200, Nguyen Ngoc Thang wrote:
Take the socket spinlock instead, the same way the x25 timers and receive
path already do. If the socket is not owned by user, disconnect it right
away. If it is, mark it with X25_KILL_FLAG and let a new release_cb do
the disconnect when the owner releases the socket.
This is the approach I'd like to take, rather than deferring the whole
cleanup to a workqueue as proposed since. syzbot still hits the bug,
now also as https://syzkaller.appspot.com/bug?extid=300375dfd44665f063a6
The two new findings of the AI review hold up in practice. I tested
with two lapbether devices on a veth pair and a sender stalled in
x25_sendmsg() via userfaultfd, so that the socket is owned when the
link event arrives:
- after a RESTART, a CALL REQUEST on the old LCI is queued to the
flagged socket's backlog and never reaches the listener;
- the flagged socket still transmits: a DATA packet on its old LCI
after the restart, and after a LAPB disconnect it brings the link
back up (SABM) before release_cb runs.
Skipping flagged sockets in __x25_find_socket() and returning early
from x25_kick() and x25_write_internal() for them fixes both. Those two
functions cover everything a socket transmits, and the deferred
x25_disconnect() only changes local state. Clearing the flag in
x25_make_new() takes care of the inheritance issue.
The x25_sendmsg()/x25_output() issue is pre-existing and independent;
I have a separate patch for it.
I have these changes on top of your patch, together with the separate
fix, and the series passes the tests above with lockdep and
DEBUG_ATOMIC_SLEEP. Unless you'd like to send the v2 yourself, I'll
post it in a few days, with you as the author of the main patch.
pw-bot: changes-requested