2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-10 08:45:20 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-10 10:55:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-17 08:54:57 +01:00
|
|
|
|
2022-10-10 10:55:24 +01:00
|
|
|
|
2024-10-01 14:26:58 +01:00
|
|
|
|
2022-10-10 10:55:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-01 14:26:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-10 10:55:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-17 08:54:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-01 14:26:58 +01:00
|
|
|
|
2022-10-10 10:55:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-10 11:47:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
|
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
|
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
2024-02-01 10:29:36 +00:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
|
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-01 10:29:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-10 10:55:24 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
2022-10-20 22:36:20 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
2022-10-06 15:43:51 +01:00
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
|
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
|
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 15:43:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
2022-10-06 15:43:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
2022-10-20 22:36:20 +01:00
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2022-10-20 22:36:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
|
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
|
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
|
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-04 07:46:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-08 14:33:50 +01:00
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
2022-10-20 22:36:20 +01:00
|
|
|
|
|
|
|
|
|
2022-10-19 09:45:43 +01:00
|
|
|
|
2022-10-08 14:33:50 +01:00
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
|
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
2022-10-08 14:33:50 +01:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-08 14:33:50 +01:00
|
|
|
|
2020-01-23 13:13:41 +00:00
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
|
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
2022-10-08 14:33:50 +01:00
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
2020-01-23 13:01:33 +00:00
|
|
|
|
2022-10-10 08:45:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-20 09:08:34 +01:00
|
|
|
|
2022-10-10 08:45:20 +01:00
|
|
|
|
|
|
|
|
|
2022-10-10 15:51:39 +01:00
|
|
|
|
2022-10-10 08:45:20 +01:00
|
|
|
|
2022-10-17 08:54:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rxrpc: Fix I/O thread stop
The rxrpc I/O thread checks to see if there's any work it needs to do, and
if not, checks kthread_should_stop() before scheduling, and if it should
stop, breaks out of the loop and tries to clean up and exit.
This can, however, race with socket destruction, wherein outstanding calls
are aborted and released from the socket and then the socket unuses the
local endpoint, causing kthread_stop() to be issued. The abort is deferred
to the I/O thread and the event can by issued between the I/O thread
checking if there's any work to be done (such as processing call aborts)
and the stop being seen.
This results in the I/O thread stopping processing of events whilst call
cleanup events are still outstanding, leading to connections or other
objects still being around and uncleaned up, which can result in assertions
being triggered, e.g.:
rxrpc: AF_RXRPC: Leaked client conn 00000000e8009865 {2}
------------[ cut here ]------------
kernel BUG at net/rxrpc/conn_client.c:64!
Fix this by retrieving the kthread_should_stop() indication, then checking
to see if there's more work to do, and going back round the loop if there
is, and breaking out of the loop only if there wasn't.
This was triggered by a syzbot test that produced some other symptom[1].
Fixes: a275da62e8c1 ("rxrpc: Create a per-local endpoint receive queue and I/O thread")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/r/0000000000002b4a9f05ef2b616f@google.com/ [1]
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-12-15 16:20:38 +00:00
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
|
|
|
|
|
2022-10-10 08:45:20 +01:00
|
|
|
|
rxrpc: Fix I/O thread startup getting skipped
When starting a kthread, the __kthread_create_on_node() function, as called
from kthread_run(), waits for a completion to indicate that the task_struct
(or failure state) of the new kernel thread is available before continuing.
This does not wait, however, for the thread function to be invoked and,
indeed, will skip it if kthread_stop() gets called before it gets there.
If this happens, though, kthread_run() will have returned successfully,
indicating that the thread was started and returning the task_struct
pointer. The actual error indication is returned by kthread_stop().
Note that this is ambiguous, as the caller cannot tell whether the -EINTR
error code came from kthread() or from the thread function.
This was encountered in the new rxrpc I/O thread, where if the system is
being pounded hard by, say, syzbot, the check of KTHREAD_SHOULD_STOP can be
delayed long enough for kthread_stop() to get called when rxrpc releases a
socket - and this causes an oops because the I/O thread function doesn't
get started and thus doesn't remove the rxrpc_local struct from the
local_endpoints list.
Fix this by using a completion to wait for the thread to actually enter
rxrpc_io_thread(). This makes sure the thread can't be prematurely
stopped and makes sure the relied-upon cleanup is done.
Fixes: a275da62e8c1 ("rxrpc: Create a per-local endpoint receive queue and I/O thread")
Reported-by: syzbot+3538a6a72efa8b059c38@syzkaller.appspotmail.com
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Hillf Danton <hdanton@sina.com>
Link: https://lore.kernel.org/r/000000000000229f1505ef2b6159@google.com/
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-12-15 16:20:13 +00:00
|
|
|
|
|
|
|
|
|
2022-10-10 08:45:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-20 09:08:34 +01:00
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-04 07:47:07 +00:00
|
|
|
|
2022-10-20 09:08:34 +01:00
|
|
|
|
|
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
|
|
|
|
|
2022-10-21 08:54:03 +01:00
|
|
|
|
2022-10-10 10:55:24 +01:00
|
|
|
|
|
|
|
|
|
2022-10-06 15:43:51 +01:00
|
|
|
|
2022-10-06 21:45:42 +01:00
|
|
|
|
|
|
|
|
|
2022-10-06 15:43:51 +01:00
|
|
|
|
|
|
|
|
|
2022-10-10 10:55:24 +01:00
|
|
|
|
2022-10-10 11:47:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-21 08:54:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-20 09:08:34 +01:00
|
|
|
|
2022-10-10 10:55:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-10 08:45:20 +01:00
|
|
|
|
|
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
2024-12-04 07:47:01 +00:00
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
2024-12-04 07:47:01 +00:00
|
|
|
|
2022-10-17 08:54:57 +01:00
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-12 20:58:15 +00:00
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
2024-12-12 20:58:15 +00:00
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
|
|
|
|
|
2022-10-10 08:45:20 +01:00
|
|
|
|
|
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-04 07:47:01 +00:00
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
2024-12-04 07:47:01 +00:00
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-12 20:58:15 +00:00
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
2024-12-12 20:58:15 +00:00
|
|
|
|
2024-12-04 07:46:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-10 08:45:20 +01:00
|
|
|
|
rxrpc: Fix I/O thread stop
The rxrpc I/O thread checks to see if there's any work it needs to do, and
if not, checks kthread_should_stop() before scheduling, and if it should
stop, breaks out of the loop and tries to clean up and exit.
This can, however, race with socket destruction, wherein outstanding calls
are aborted and released from the socket and then the socket unuses the
local endpoint, causing kthread_stop() to be issued. The abort is deferred
to the I/O thread and the event can by issued between the I/O thread
checking if there's any work to be done (such as processing call aborts)
and the stop being seen.
This results in the I/O thread stopping processing of events whilst call
cleanup events are still outstanding, leading to connections or other
objects still being around and uncleaned up, which can result in assertions
being triggered, e.g.:
rxrpc: AF_RXRPC: Leaked client conn 00000000e8009865 {2}
------------[ cut here ]------------
kernel BUG at net/rxrpc/conn_client.c:64!
Fix this by retrieving the kthread_should_stop() indication, then checking
to see if there's more work to do, and going back round the loop if there
is, and breaking out of the loop only if there wasn't.
This was triggered by a syzbot test that produced some other symptom[1].
Fixes: a275da62e8c1 ("rxrpc: Create a per-local endpoint receive queue and I/O thread")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/r/0000000000002b4a9f05ef2b616f@google.com/ [1]
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-12-15 16:20:38 +00:00
|
|
|
|
2022-10-10 15:51:39 +01:00
|
|
|
|
2022-10-20 09:08:34 +01:00
|
|
|
|
2022-10-19 09:45:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-10 08:45:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rxrpc: Fix I/O thread stop
The rxrpc I/O thread checks to see if there's any work it needs to do, and
if not, checks kthread_should_stop() before scheduling, and if it should
stop, breaks out of the loop and tries to clean up and exit.
This can, however, race with socket destruction, wherein outstanding calls
are aborted and released from the socket and then the socket unuses the
local endpoint, causing kthread_stop() to be issued. The abort is deferred
to the I/O thread and the event can by issued between the I/O thread
checking if there's any work to be done (such as processing call aborts)
and the stop being seen.
This results in the I/O thread stopping processing of events whilst call
cleanup events are still outstanding, leading to connections or other
objects still being around and uncleaned up, which can result in assertions
being triggered, e.g.:
rxrpc: AF_RXRPC: Leaked client conn 00000000e8009865 {2}
------------[ cut here ]------------
kernel BUG at net/rxrpc/conn_client.c:64!
Fix this by retrieving the kthread_should_stop() indication, then checking
to see if there's more work to do, and going back round the loop if there
is, and breaking out of the loop only if there wasn't.
This was triggered by a syzbot test that produced some other symptom[1].
Fixes: a275da62e8c1 ("rxrpc: Create a per-local endpoint receive queue and I/O thread")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/r/0000000000002b4a9f05ef2b616f@google.com/ [1]
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-12-15 16:20:38 +00:00
|
|
|
|
2022-10-10 08:45:20 +01:00
|
|
|
|
2022-10-17 08:54:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-04 07:46:31 +00:00
|
|
|
|
2022-10-17 08:54:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-10 08:45:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-01 14:26:58 +01:00
|
|
|
|
2022-10-10 08:45:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|