Commit 519d2567 authored by David Howells's avatar David Howells Committed by Linus Torvalds

RxRPC: Don't attempt to reuse aborted connections

Connections that have seen a connection-level abort should not be reused
as the far end will just abort them again; instead a new connection
should be made.

Connection-level aborts occur due to such things as authentication
failures.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0dd51986
...@@ -444,6 +444,11 @@ int rxrpc_connect_call(struct rxrpc_sock *rx, ...@@ -444,6 +444,11 @@ int rxrpc_connect_call(struct rxrpc_sock *rx,
conn = list_entry(bundle->avail_conns.next, conn = list_entry(bundle->avail_conns.next,
struct rxrpc_connection, struct rxrpc_connection,
bundle_link); bundle_link);
if (conn->state >= RXRPC_CONN_REMOTELY_ABORTED) {
list_del_init(&conn->bundle_link);
bundle->num_conns--;
continue;
}
if (--conn->avail_calls == 0) if (--conn->avail_calls == 0)
list_move(&conn->bundle_link, list_move(&conn->bundle_link,
&bundle->busy_conns); &bundle->busy_conns);
...@@ -461,6 +466,11 @@ int rxrpc_connect_call(struct rxrpc_sock *rx, ...@@ -461,6 +466,11 @@ int rxrpc_connect_call(struct rxrpc_sock *rx,
conn = list_entry(bundle->unused_conns.next, conn = list_entry(bundle->unused_conns.next,
struct rxrpc_connection, struct rxrpc_connection,
bundle_link); bundle_link);
if (conn->state >= RXRPC_CONN_REMOTELY_ABORTED) {
list_del_init(&conn->bundle_link);
bundle->num_conns--;
continue;
}
ASSERTCMP(conn->avail_calls, ==, RXRPC_MAXCALLS); ASSERTCMP(conn->avail_calls, ==, RXRPC_MAXCALLS);
conn->avail_calls = RXRPC_MAXCALLS - 1; conn->avail_calls = RXRPC_MAXCALLS - 1;
ASSERT(conn->channels[0] == NULL && ASSERT(conn->channels[0] == NULL &&
......
...@@ -150,11 +150,15 @@ static int rxrpc_process_event(struct rxrpc_connection *conn, ...@@ -150,11 +150,15 @@ static int rxrpc_process_event(struct rxrpc_connection *conn,
u32 serial; u32 serial;
int loop, ret; int loop, ret;
if (conn->state >= RXRPC_CONN_REMOTELY_ABORTED) if (conn->state >= RXRPC_CONN_REMOTELY_ABORTED) {
kleave(" = -ECONNABORTED [%u]", conn->state);
return -ECONNABORTED; return -ECONNABORTED;
}
serial = ntohl(sp->hdr.serial); serial = ntohl(sp->hdr.serial);
_enter("{%d},{%u,%%%u},", conn->debug_id, sp->hdr.type, serial);
switch (sp->hdr.type) { switch (sp->hdr.type) {
case RXRPC_PACKET_TYPE_ABORT: case RXRPC_PACKET_TYPE_ABORT:
if (skb_copy_bits(skb, 0, &tmp, sizeof(tmp)) < 0) if (skb_copy_bits(skb, 0, &tmp, sizeof(tmp)) < 0)
...@@ -199,6 +203,7 @@ static int rxrpc_process_event(struct rxrpc_connection *conn, ...@@ -199,6 +203,7 @@ static int rxrpc_process_event(struct rxrpc_connection *conn,
return 0; return 0;
default: default:
_leave(" = -EPROTO [%u]", sp->hdr.type);
return -EPROTO; return -EPROTO;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment