Skip to content

Commit 4241a70

Browse files
dhowellsPaolo Abeni
authored andcommitted
rxrpc: Fix the rxrpc_connection attend queue handling
The rxrpc_connection attend queue is never used because conn::attend_link is never initialised and so is always NULL'd out and thus always appears to be busy. This requires the following fix: (1) Fix this the attend queue problem by initialising conn::attend_link. And, consequently, two further fixes for things masked by the above bug: (2) Fix rxrpc_input_conn_event() to handle being invoked with a NULL sk_buff pointer - something that can now happen with the above change. (3) Fix the RXRPC_SKB_MARK_SERVICE_CONN_SECURED message to carry a pointer to the connection and a ref on it. Signed-off-by: David Howells <dhowells@redhat.com> cc: Marc Dionne <marc.dionne@auristor.com> cc: Jakub Kicinski <kuba@kernel.org> cc: "David S. Miller" <davem@davemloft.net> cc: Eric Dumazet <edumazet@google.com> cc: Paolo Abeni <pabeni@redhat.com> cc: Simon Horman <horms@kernel.org> cc: linux-afs@lists.infradead.org cc: netdev@vger.kernel.org Fixes: f2cce89 ("rxrpc: Implement a mechanism to send an event notification to a connection") Link: https://patch.msgid.link/20250203110307.7265-3-dhowells@redhat.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent d3ed6de commit 4241a70

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

include/trace/events/rxrpc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@
219219
EM(rxrpc_conn_get_conn_input, "GET inp-conn") \
220220
EM(rxrpc_conn_get_idle, "GET idle ") \
221221
EM(rxrpc_conn_get_poke_abort, "GET pk-abort") \
222+
EM(rxrpc_conn_get_poke_secured, "GET secured ") \
222223
EM(rxrpc_conn_get_poke_timer, "GET poke ") \
223224
EM(rxrpc_conn_get_service_conn, "GET svc-conn") \
224225
EM(rxrpc_conn_new_client, "NEW client ") \

net/rxrpc/conn_event.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ static int rxrpc_process_event(struct rxrpc_connection *conn,
272272
* we've already received the packet, put it on the
273273
* front of the queue.
274274
*/
275+
sp->conn = rxrpc_get_connection(conn, rxrpc_conn_get_poke_secured);
275276
skb->mark = RXRPC_SKB_MARK_SERVICE_CONN_SECURED;
276277
rxrpc_get_skb(skb, rxrpc_skb_get_conn_secured);
277278
skb_queue_head(&conn->local->rx_queue, skb);
@@ -437,14 +438,16 @@ void rxrpc_input_conn_event(struct rxrpc_connection *conn, struct sk_buff *skb)
437438
if (test_and_clear_bit(RXRPC_CONN_EV_ABORT_CALLS, &conn->events))
438439
rxrpc_abort_calls(conn);
439440

440-
switch (skb->mark) {
441-
case RXRPC_SKB_MARK_SERVICE_CONN_SECURED:
442-
if (conn->state != RXRPC_CONN_SERVICE)
443-
break;
441+
if (skb) {
442+
switch (skb->mark) {
443+
case RXRPC_SKB_MARK_SERVICE_CONN_SECURED:
444+
if (conn->state != RXRPC_CONN_SERVICE)
445+
break;
444446

445-
for (loop = 0; loop < RXRPC_MAXCALLS; loop++)
446-
rxrpc_call_is_secure(conn->channels[loop].call);
447-
break;
447+
for (loop = 0; loop < RXRPC_MAXCALLS; loop++)
448+
rxrpc_call_is_secure(conn->channels[loop].call);
449+
break;
450+
}
448451
}
449452

450453
/* Process delayed ACKs whose time has come. */

net/rxrpc/conn_object.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ struct rxrpc_connection *rxrpc_alloc_connection(struct rxrpc_net *rxnet,
6767
INIT_WORK(&conn->destructor, rxrpc_clean_up_connection);
6868
INIT_LIST_HEAD(&conn->proc_link);
6969
INIT_LIST_HEAD(&conn->link);
70+
INIT_LIST_HEAD(&conn->attend_link);
7071
mutex_init(&conn->security_lock);
7172
mutex_init(&conn->tx_data_alloc_lock);
7273
skb_queue_head_init(&conn->rx_queue);

0 commit comments

Comments
 (0)