Commit 519d25679e8ae7433c758b9e74b19144f61b90f8

Authored by David Howells
Committed by Linus Torvalds
1 parent 0dd5198672

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: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 16 additions and 1 deletions Side-by-side Diff

net/rxrpc/ar-connection.c
... ... @@ -444,6 +444,11 @@
444 444 conn = list_entry(bundle->avail_conns.next,
445 445 struct rxrpc_connection,
446 446 bundle_link);
  447 + if (conn->state >= RXRPC_CONN_REMOTELY_ABORTED) {
  448 + list_del_init(&conn->bundle_link);
  449 + bundle->num_conns--;
  450 + continue;
  451 + }
447 452 if (--conn->avail_calls == 0)
448 453 list_move(&conn->bundle_link,
449 454 &bundle->busy_conns);
... ... @@ -461,6 +466,11 @@
461 466 conn = list_entry(bundle->unused_conns.next,
462 467 struct rxrpc_connection,
463 468 bundle_link);
  469 + if (conn->state >= RXRPC_CONN_REMOTELY_ABORTED) {
  470 + list_del_init(&conn->bundle_link);
  471 + bundle->num_conns--;
  472 + continue;
  473 + }
464 474 ASSERTCMP(conn->avail_calls, ==, RXRPC_MAXCALLS);
465 475 conn->avail_calls = RXRPC_MAXCALLS - 1;
466 476 ASSERT(conn->channels[0] == NULL &&
net/rxrpc/ar-connevent.c
... ... @@ -150,11 +150,15 @@
150 150 u32 serial;
151 151 int loop, ret;
152 152  
153   - if (conn->state >= RXRPC_CONN_REMOTELY_ABORTED)
  153 + if (conn->state >= RXRPC_CONN_REMOTELY_ABORTED) {
  154 + kleave(" = -ECONNABORTED [%u]", conn->state);
154 155 return -ECONNABORTED;
  156 + }
155 157  
156 158 serial = ntohl(sp->hdr.serial);
157 159  
  160 + _enter("{%d},{%u,%%%u},", conn->debug_id, sp->hdr.type, serial);
  161 +
158 162 switch (sp->hdr.type) {
159 163 case RXRPC_PACKET_TYPE_ABORT:
160 164 if (skb_copy_bits(skb, 0, &tmp, sizeof(tmp)) < 0)
... ... @@ -199,6 +203,7 @@
199 203 return 0;
200 204  
201 205 default:
  206 + _leave(" = -EPROTO [%u]", sp->hdr.type);
202 207 return -EPROTO;
203 208 }
204 209 }