diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c index 611c790bc6d0..111f0844b0d6 100644 --- a/net/rxrpc/conn_event.c +++ b/net/rxrpc/conn_event.c @@ -272,8 +272,19 @@ static int rxrpc_process_event(struct rxrpc_connection *conn, bool secured = false; int ret; - if (conn->state == RXRPC_CONN_ABORTED) + if (conn->state == RXRPC_CONN_ABORTED) { + /* A CHALLENGE packet queued for processing carries a ref on the + * connection (see rxrpc_post_challenge()). That ref has to be + * dropped here because the caller frees the skb as soon as we + * return. + */ + if (sp->hdr.type == RXRPC_PACKET_TYPE_CHALLENGE && + sp->chall.conn) { + rxrpc_put_connection(conn, rxrpc_conn_put_challenge_input); + sp->chall.conn = NULL; + } return -ECONNABORTED; + } _enter("{%d},{%u,%%%u},", conn->debug_id, sp->hdr.type, sp->hdr.serial);