David Howells db099c625b rxrpc: Fix timeout of a call that hasn't yet been granted a channel
afs_make_call() calls rxrpc_kernel_begin_call() to begin a call (which may
get stalled in the background waiting for a connection to become
available); it then calls rxrpc_kernel_set_max_life() to set the timeouts -
but that starts the call timer so the call timer might then expire before
we get a connection assigned - leading to the following oops if the call
stalled:

	BUG: kernel NULL pointer dereference, address: 0000000000000000
	...
	CPU: 1 PID: 5111 Comm: krxrpcio/0 Not tainted 6.3.0-rc7-build3+ #701
	RIP: 0010:rxrpc_alloc_txbuf+0xc0/0x157
	...
	Call Trace:
	 <TASK>
	 rxrpc_send_ACK+0x50/0x13b
	 rxrpc_input_call_event+0x16a/0x67d
	 rxrpc_io_thread+0x1b6/0x45f
	 ? _raw_spin_unlock_irqrestore+0x1f/0x35
	 ? rxrpc_input_packet+0x519/0x519
	 kthread+0xe7/0xef
	 ? kthread_complete_and_exit+0x1b/0x1b
	 ret_from_fork+0x22/0x30

Fix this by noting the timeouts in struct rxrpc_call when the call is
created.  The timer will be started when the first packet is transmitted.

It shouldn't be possible to trigger this directly from userspace through
AF_RXRPC as sendmsg() will return EBUSY if the call is in the
waiting-for-conn state if it dropped out of the wait due to a signal.

Fixes: 9d35d880e0e4 ("rxrpc: Move client call connection to the I/O thread")
Reported-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-05-01 07:43:19 +01:00
..
2023-04-24 13:35:23 -07:00
2023-02-20 14:10:36 -08:00
2023-04-26 09:13:44 -07:00
2023-03-06 09:57:12 +01:00
2023-04-24 13:35:23 -07:00
2023-02-21 11:07:23 -08:00
2023-02-27 10:04:49 -08:00
2023-04-26 16:07:23 -07:00
2023-04-24 14:25:39 -07:00
2023-03-01 08:42:27 -08:00
\n
2023-04-26 09:07:46 -07:00
2023-04-26 12:40:31 -07:00
2023-04-26 09:42:10 -07:00
2023-04-24 19:14:20 -07:00
2023-04-26 09:28:15 -07:00
2023-04-06 13:39:50 -04:00
2023-04-24 19:20:27 -07:00
2023-04-24 13:35:23 -07:00
2023-04-03 11:16:57 +02:00
2023-03-06 09:57:12 +01:00
2023-04-24 19:28:49 -07:00
2022-12-23 11:55:54 -08:00
2023-03-14 12:56:30 -06:00
\n
2023-04-26 09:07:46 -07:00
2023-03-12 20:03:41 -04:00
2023-04-26 12:40:31 -07:00
2023-03-30 08:51:48 +02:00
2023-01-31 15:01:20 +01:00
2023-04-26 08:51:51 -07:00
2023-04-05 18:06:23 -07:00
2022-10-10 19:45:17 -07:00
2023-04-25 12:22:11 -07:00
2023-02-20 11:53:11 -08:00
2023-03-30 08:51:48 +02:00
2022-10-10 14:21:11 -07:00
2023-02-20 14:10:36 -08:00
2023-01-19 09:24:30 +01:00
2023-03-12 20:03:48 -04:00
2023-04-24 19:14:20 -07:00
2023-04-06 14:53:38 +02:00
2023-03-06 09:59:20 +01:00
2023-02-20 11:53:11 -08:00
2023-02-20 11:53:11 -08:00
2023-03-06 09:59:20 +01:00