Commit | Line | Data |
---|---|---|
17926a79 DH |
1 | /* connection-level event handling |
2 | * | |
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | |
4 | * Written by David Howells (dhowells@redhat.com) | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version | |
9 | * 2 of the License, or (at your option) any later version. | |
10 | */ | |
11 | ||
9b6d5398 JP |
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
13 | ||
17926a79 DH |
14 | #include <linux/module.h> |
15 | #include <linux/net.h> | |
16 | #include <linux/skbuff.h> | |
17 | #include <linux/errqueue.h> | |
17926a79 DH |
18 | #include <net/sock.h> |
19 | #include <net/af_rxrpc.h> | |
20 | #include <net/ip.h> | |
21 | #include "ar-internal.h" | |
22 | ||
18bfeba5 DH |
23 | /* |
24 | * Retransmit terminal ACK or ABORT of the previous call. | |
25 | */ | |
f5c17aae | 26 | static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, |
3136ef49 DH |
27 | struct sk_buff *skb, |
28 | unsigned int channel) | |
18bfeba5 | 29 | { |
3136ef49 | 30 | struct rxrpc_skb_priv *sp = skb ? rxrpc_skb(skb) : NULL; |
18bfeba5 DH |
31 | struct rxrpc_channel *chan; |
32 | struct msghdr msg; | |
5fc62f6a | 33 | struct kvec iov[3]; |
18bfeba5 DH |
34 | struct { |
35 | struct rxrpc_wire_header whdr; | |
36 | union { | |
5fc62f6a DH |
37 | __be32 abort_code; |
38 | struct rxrpc_ackpacket ack; | |
18bfeba5 DH |
39 | }; |
40 | } __attribute__((packed)) pkt; | |
5fc62f6a | 41 | struct rxrpc_ackinfo ack_info; |
18bfeba5 | 42 | size_t len; |
6b47fe1d | 43 | int ret, ioc; |
5fc62f6a | 44 | u32 serial, mtu, call_id, padding; |
18bfeba5 DH |
45 | |
46 | _enter("%d", conn->debug_id); | |
47 | ||
3136ef49 | 48 | chan = &conn->channels[channel]; |
18bfeba5 DH |
49 | |
50 | /* If the last call got moved on whilst we were waiting to run, just | |
51 | * ignore this packet. | |
52 | */ | |
53 | call_id = READ_ONCE(chan->last_call); | |
54 | /* Sync with __rxrpc_disconnect_call() */ | |
55 | smp_rmb(); | |
3136ef49 | 56 | if (skb && call_id != sp->hdr.callNumber) |
18bfeba5 DH |
57 | return; |
58 | ||
59 | msg.msg_name = &conn->params.peer->srx.transport; | |
60 | msg.msg_namelen = conn->params.peer->srx.transport_len; | |
61 | msg.msg_control = NULL; | |
62 | msg.msg_controllen = 0; | |
63 | msg.msg_flags = 0; | |
64 | ||
5fc62f6a DH |
65 | iov[0].iov_base = &pkt; |
66 | iov[0].iov_len = sizeof(pkt.whdr); | |
67 | iov[1].iov_base = &padding; | |
68 | iov[1].iov_len = 3; | |
69 | iov[2].iov_base = &ack_info; | |
70 | iov[2].iov_len = sizeof(ack_info); | |
71 | ||
3136ef49 | 72 | pkt.whdr.epoch = htonl(conn->proto.epoch); |
fb1967a6 | 73 | pkt.whdr.cid = htonl(conn->proto.cid | channel); |
3136ef49 | 74 | pkt.whdr.callNumber = htonl(call_id); |
18bfeba5 DH |
75 | pkt.whdr.seq = 0; |
76 | pkt.whdr.type = chan->last_type; | |
77 | pkt.whdr.flags = conn->out_clientflag; | |
78 | pkt.whdr.userStatus = 0; | |
79 | pkt.whdr.securityIndex = conn->security_ix; | |
80 | pkt.whdr._rsvd = 0; | |
68d6d1ae | 81 | pkt.whdr.serviceId = htons(conn->service_id); |
18bfeba5 DH |
82 | |
83 | len = sizeof(pkt.whdr); | |
84 | switch (chan->last_type) { | |
85 | case RXRPC_PACKET_TYPE_ABORT: | |
5fc62f6a DH |
86 | pkt.abort_code = htonl(chan->last_abort); |
87 | iov[0].iov_len += sizeof(pkt.abort_code); | |
88 | len += sizeof(pkt.abort_code); | |
89 | ioc = 1; | |
18bfeba5 DH |
90 | break; |
91 | ||
92 | case RXRPC_PACKET_TYPE_ACK: | |
93 | mtu = conn->params.peer->if_mtu; | |
94 | mtu -= conn->params.peer->hdrsize; | |
95 | pkt.ack.bufferSpace = 0; | |
3136ef49 DH |
96 | pkt.ack.maxSkew = htons(skb ? skb->priority : 0); |
97 | pkt.ack.firstPacket = htonl(chan->last_seq + 1); | |
98 | pkt.ack.previousPacket = htonl(chan->last_seq); | |
99 | pkt.ack.serial = htonl(skb ? sp->hdr.serial : 0); | |
100 | pkt.ack.reason = skb ? RXRPC_ACK_DUPLICATE : RXRPC_ACK_IDLE; | |
18bfeba5 | 101 | pkt.ack.nAcks = 0; |
5fc62f6a DH |
102 | ack_info.rxMTU = htonl(rxrpc_rx_mtu); |
103 | ack_info.maxMTU = htonl(mtu); | |
104 | ack_info.rwind = htonl(rxrpc_rx_window_size); | |
105 | ack_info.jumbo_max = htonl(rxrpc_rx_jumbo_max); | |
57494343 | 106 | pkt.whdr.flags |= RXRPC_SLOW_START_OK; |
5fc62f6a DH |
107 | padding = 0; |
108 | iov[0].iov_len += sizeof(pkt.ack); | |
109 | len += sizeof(pkt.ack) + 3 + sizeof(ack_info); | |
110 | ioc = 3; | |
18bfeba5 | 111 | break; |
5fc62f6a DH |
112 | |
113 | default: | |
114 | return; | |
18bfeba5 DH |
115 | } |
116 | ||
117 | /* Resync with __rxrpc_disconnect_call() and check that the last call | |
118 | * didn't get advanced whilst we were filling out the packets. | |
119 | */ | |
120 | smp_rmb(); | |
121 | if (READ_ONCE(chan->last_call) != call_id) | |
122 | return; | |
123 | ||
18bfeba5 DH |
124 | serial = atomic_inc_return(&conn->serial); |
125 | pkt.whdr.serial = htonl(serial); | |
126 | ||
127 | switch (chan->last_type) { | |
128 | case RXRPC_PACKET_TYPE_ABORT: | |
64753092 | 129 | _proto("Tx ABORT %%%u { %d } [re]", serial, conn->abort_code); |
18bfeba5 DH |
130 | break; |
131 | case RXRPC_PACKET_TYPE_ACK: | |
4764c0da | 132 | trace_rxrpc_tx_ack(chan->call_debug_id, serial, |
f3f8337c DH |
133 | ntohl(pkt.ack.firstPacket), |
134 | ntohl(pkt.ack.serial), | |
135 | pkt.ack.reason, 0); | |
18bfeba5 DH |
136 | _proto("Tx ACK %%%u [re]", serial); |
137 | break; | |
138 | } | |
139 | ||
6b47fe1d | 140 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, ioc, len); |
330bdcfa | 141 | conn->params.peer->last_tx_at = ktime_get_seconds(); |
6b47fe1d | 142 | if (ret < 0) |
4764c0da DH |
143 | trace_rxrpc_tx_fail(chan->call_debug_id, serial, ret, |
144 | rxrpc_tx_point_call_final_resend); | |
145 | else | |
146 | trace_rxrpc_tx_packet(chan->call_debug_id, &pkt.whdr, | |
147 | rxrpc_tx_point_call_final_resend); | |
6b47fe1d | 148 | |
18bfeba5 | 149 | _leave(""); |
18bfeba5 DH |
150 | } |
151 | ||
17926a79 DH |
152 | /* |
153 | * pass a connection-level abort onto all calls on that connection | |
154 | */ | |
f5c17aae | 155 | static void rxrpc_abort_calls(struct rxrpc_connection *conn, |
39ce6755 DH |
156 | enum rxrpc_call_completion compl, |
157 | rxrpc_serial_t serial) | |
17926a79 DH |
158 | { |
159 | struct rxrpc_call *call; | |
248f219c | 160 | int i; |
17926a79 | 161 | |
64753092 | 162 | _enter("{%d},%x", conn->debug_id, conn->abort_code); |
17926a79 | 163 | |
a1399f8b | 164 | spin_lock(&conn->channel_lock); |
17926a79 | 165 | |
a1399f8b DH |
166 | for (i = 0; i < RXRPC_MAXCALLS; i++) { |
167 | call = rcu_dereference_protected( | |
168 | conn->channels[i].call, | |
169 | lockdep_is_held(&conn->channel_lock)); | |
ccbd3dbe | 170 | if (call) { |
5a42976d | 171 | if (compl == RXRPC_CALL_LOCALLY_ABORTED) |
a25e21f0 DH |
172 | trace_rxrpc_abort(call->debug_id, |
173 | "CON", call->cid, | |
5a42976d | 174 | call->call_id, 0, |
64753092 DH |
175 | conn->abort_code, |
176 | conn->error); | |
39ce6755 DH |
177 | else |
178 | trace_rxrpc_rx_abort(call, serial, | |
179 | conn->abort_code); | |
248f219c | 180 | if (rxrpc_set_call_completion(call, compl, |
64753092 DH |
181 | conn->abort_code, |
182 | conn->error)) | |
248f219c | 183 | rxrpc_notify_socket(call); |
17926a79 | 184 | } |
17926a79 DH |
185 | } |
186 | ||
a1399f8b | 187 | spin_unlock(&conn->channel_lock); |
17926a79 DH |
188 | _leave(""); |
189 | } | |
190 | ||
191 | /* | |
192 | * generate a connection-level abort | |
193 | */ | |
194 | static int rxrpc_abort_connection(struct rxrpc_connection *conn, | |
3a92789a | 195 | int error, u32 abort_code) |
17926a79 | 196 | { |
0d12f8a4 | 197 | struct rxrpc_wire_header whdr; |
17926a79 DH |
198 | struct msghdr msg; |
199 | struct kvec iov[2]; | |
200 | __be32 word; | |
201 | size_t len; | |
0d12f8a4 | 202 | u32 serial; |
17926a79 DH |
203 | int ret; |
204 | ||
205 | _enter("%d,,%u,%u", conn->debug_id, error, abort_code); | |
206 | ||
207 | /* generate a connection-level abort */ | |
208 | spin_lock_bh(&conn->state_lock); | |
f5c17aae | 209 | if (conn->state >= RXRPC_CONN_REMOTELY_ABORTED) { |
17926a79 DH |
210 | spin_unlock_bh(&conn->state_lock); |
211 | _leave(" = 0 [already dead]"); | |
212 | return 0; | |
213 | } | |
214 | ||
64753092 DH |
215 | conn->error = error; |
216 | conn->abort_code = abort_code; | |
f5c17aae DH |
217 | conn->state = RXRPC_CONN_LOCALLY_ABORTED; |
218 | spin_unlock_bh(&conn->state_lock); | |
219 | ||
85f32278 DH |
220 | msg.msg_name = &conn->params.peer->srx.transport; |
221 | msg.msg_namelen = conn->params.peer->srx.transport_len; | |
17926a79 DH |
222 | msg.msg_control = NULL; |
223 | msg.msg_controllen = 0; | |
224 | msg.msg_flags = 0; | |
225 | ||
19ffa01c DH |
226 | whdr.epoch = htonl(conn->proto.epoch); |
227 | whdr.cid = htonl(conn->proto.cid); | |
0d12f8a4 DH |
228 | whdr.callNumber = 0; |
229 | whdr.seq = 0; | |
230 | whdr.type = RXRPC_PACKET_TYPE_ABORT; | |
231 | whdr.flags = conn->out_clientflag; | |
232 | whdr.userStatus = 0; | |
233 | whdr.securityIndex = conn->security_ix; | |
234 | whdr._rsvd = 0; | |
68d6d1ae | 235 | whdr.serviceId = htons(conn->service_id); |
17926a79 | 236 | |
64753092 | 237 | word = htonl(conn->abort_code); |
17926a79 | 238 | |
0d12f8a4 DH |
239 | iov[0].iov_base = &whdr; |
240 | iov[0].iov_len = sizeof(whdr); | |
17926a79 DH |
241 | iov[1].iov_base = &word; |
242 | iov[1].iov_len = sizeof(word); | |
243 | ||
244 | len = iov[0].iov_len + iov[1].iov_len; | |
245 | ||
0d12f8a4 | 246 | serial = atomic_inc_return(&conn->serial); |
39ce6755 | 247 | rxrpc_abort_calls(conn, RXRPC_CALL_LOCALLY_ABORTED, serial); |
0d12f8a4 | 248 | whdr.serial = htonl(serial); |
64753092 | 249 | _proto("Tx CONN ABORT %%%u { %d }", serial, conn->abort_code); |
17926a79 | 250 | |
85f32278 | 251 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); |
17926a79 | 252 | if (ret < 0) { |
6b47fe1d | 253 | trace_rxrpc_tx_fail(conn->debug_id, serial, ret, |
4764c0da | 254 | rxrpc_tx_point_conn_abort); |
17926a79 DH |
255 | _debug("sendmsg failed: %d", ret); |
256 | return -EAGAIN; | |
257 | } | |
258 | ||
4764c0da DH |
259 | trace_rxrpc_tx_packet(conn->debug_id, &whdr, rxrpc_tx_point_conn_abort); |
260 | ||
330bdcfa | 261 | conn->params.peer->last_tx_at = ktime_get_seconds(); |
ace45bec | 262 | |
17926a79 DH |
263 | _leave(" = 0"); |
264 | return 0; | |
265 | } | |
266 | ||
267 | /* | |
268 | * mark a call as being on a now-secured channel | |
248f219c | 269 | * - must be called with BH's disabled. |
17926a79 | 270 | */ |
5eaa65b2 | 271 | static void rxrpc_call_is_secure(struct rxrpc_call *call) |
17926a79 DH |
272 | { |
273 | _enter("%p", call); | |
274 | if (call) { | |
248f219c DH |
275 | write_lock_bh(&call->state_lock); |
276 | if (call->state == RXRPC_CALL_SERVER_SECURING) { | |
277 | call->state = RXRPC_CALL_SERVER_ACCEPTING; | |
278 | rxrpc_notify_socket(call); | |
279 | } | |
280 | write_unlock_bh(&call->state_lock); | |
17926a79 DH |
281 | } |
282 | } | |
283 | ||
284 | /* | |
285 | * connection-level Rx packet processor | |
286 | */ | |
287 | static int rxrpc_process_event(struct rxrpc_connection *conn, | |
288 | struct sk_buff *skb, | |
289 | u32 *_abort_code) | |
290 | { | |
291 | struct rxrpc_skb_priv *sp = rxrpc_skb(skb); | |
0d12f8a4 DH |
292 | __be32 wtmp; |
293 | u32 abort_code; | |
17926a79 DH |
294 | int loop, ret; |
295 | ||
519d2567 | 296 | if (conn->state >= RXRPC_CONN_REMOTELY_ABORTED) { |
248f219c | 297 | _leave(" = -ECONNABORTED [%u]", conn->state); |
17926a79 | 298 | return -ECONNABORTED; |
519d2567 | 299 | } |
17926a79 | 300 | |
0d12f8a4 | 301 | _enter("{%d},{%u,%%%u},", conn->debug_id, sp->hdr.type, sp->hdr.serial); |
519d2567 | 302 | |
17926a79 | 303 | switch (sp->hdr.type) { |
18bfeba5 DH |
304 | case RXRPC_PACKET_TYPE_DATA: |
305 | case RXRPC_PACKET_TYPE_ACK: | |
3136ef49 DH |
306 | rxrpc_conn_retransmit_call(conn, skb, |
307 | sp->hdr.cid & RXRPC_CHANNELMASK); | |
18bfeba5 DH |
308 | return 0; |
309 | ||
4d4a6ac7 DH |
310 | case RXRPC_PACKET_TYPE_BUSY: |
311 | /* Just ignore BUSY packets for now. */ | |
312 | return 0; | |
313 | ||
17926a79 | 314 | case RXRPC_PACKET_TYPE_ABORT: |
775e5b71 | 315 | if (skb_copy_bits(skb, sizeof(struct rxrpc_wire_header), |
fb46f6ee DH |
316 | &wtmp, sizeof(wtmp)) < 0) { |
317 | trace_rxrpc_rx_eproto(NULL, sp->hdr.serial, | |
318 | tracepoint_string("bad_abort")); | |
17926a79 | 319 | return -EPROTO; |
fb46f6ee | 320 | } |
0d12f8a4 DH |
321 | abort_code = ntohl(wtmp); |
322 | _proto("Rx ABORT %%%u { ac=%d }", sp->hdr.serial, abort_code); | |
17926a79 | 323 | |
64753092 DH |
324 | conn->error = -ECONNABORTED; |
325 | conn->abort_code = abort_code; | |
17926a79 | 326 | conn->state = RXRPC_CONN_REMOTELY_ABORTED; |
39ce6755 | 327 | rxrpc_abort_calls(conn, RXRPC_CALL_REMOTELY_ABORTED, sp->hdr.serial); |
17926a79 DH |
328 | return -ECONNABORTED; |
329 | ||
330 | case RXRPC_PACKET_TYPE_CHALLENGE: | |
e0e4d82f DH |
331 | return conn->security->respond_to_challenge(conn, skb, |
332 | _abort_code); | |
17926a79 DH |
333 | |
334 | case RXRPC_PACKET_TYPE_RESPONSE: | |
17926a79 DH |
335 | ret = conn->security->verify_response(conn, skb, _abort_code); |
336 | if (ret < 0) | |
337 | return ret; | |
338 | ||
339 | ret = conn->security->init_connection_security(conn); | |
340 | if (ret < 0) | |
341 | return ret; | |
342 | ||
a263629d HX |
343 | ret = conn->security->prime_packet_security(conn); |
344 | if (ret < 0) | |
345 | return ret; | |
346 | ||
a1399f8b | 347 | spin_lock(&conn->channel_lock); |
17926a79 DH |
348 | spin_lock(&conn->state_lock); |
349 | ||
bba304db DH |
350 | if (conn->state == RXRPC_CONN_SERVICE_CHALLENGING) { |
351 | conn->state = RXRPC_CONN_SERVICE; | |
248f219c | 352 | spin_unlock(&conn->state_lock); |
17926a79 | 353 | for (loop = 0; loop < RXRPC_MAXCALLS; loop++) |
dee46364 DH |
354 | rxrpc_call_is_secure( |
355 | rcu_dereference_protected( | |
a1399f8b DH |
356 | conn->channels[loop].call, |
357 | lockdep_is_held(&conn->channel_lock))); | |
248f219c DH |
358 | } else { |
359 | spin_unlock(&conn->state_lock); | |
17926a79 DH |
360 | } |
361 | ||
a1399f8b | 362 | spin_unlock(&conn->channel_lock); |
17926a79 DH |
363 | return 0; |
364 | ||
365 | default: | |
fb46f6ee DH |
366 | trace_rxrpc_rx_eproto(NULL, sp->hdr.serial, |
367 | tracepoint_string("bad_conn_pkt")); | |
17926a79 DH |
368 | return -EPROTO; |
369 | } | |
370 | } | |
371 | ||
372 | /* | |
373 | * set up security and issue a challenge | |
374 | */ | |
375 | static void rxrpc_secure_connection(struct rxrpc_connection *conn) | |
376 | { | |
377 | u32 abort_code; | |
378 | int ret; | |
379 | ||
380 | _enter("{%d}", conn->debug_id); | |
381 | ||
382 | ASSERT(conn->security_ix != 0); | |
383 | ||
19ffa01c | 384 | if (!conn->params.key) { |
17926a79 DH |
385 | _debug("set up security"); |
386 | ret = rxrpc_init_server_conn_security(conn); | |
387 | switch (ret) { | |
388 | case 0: | |
389 | break; | |
390 | case -ENOENT: | |
391 | abort_code = RX_CALL_DEAD; | |
392 | goto abort; | |
393 | default: | |
394 | abort_code = RXKADNOAUTH; | |
395 | goto abort; | |
396 | } | |
397 | } | |
398 | ||
17926a79 DH |
399 | if (conn->security->issue_challenge(conn) < 0) { |
400 | abort_code = RX_CALL_DEAD; | |
401 | ret = -ENOMEM; | |
402 | goto abort; | |
403 | } | |
404 | ||
405 | _leave(""); | |
406 | return; | |
407 | ||
408 | abort: | |
409 | _debug("abort %d, %d", ret, abort_code); | |
3a92789a | 410 | rxrpc_abort_connection(conn, ret, abort_code); |
17926a79 DH |
411 | _leave(" [aborted]"); |
412 | } | |
413 | ||
3136ef49 DH |
414 | /* |
415 | * Process delayed final ACKs that we haven't subsumed into a subsequent call. | |
416 | */ | |
417 | static void rxrpc_process_delayed_final_acks(struct rxrpc_connection *conn) | |
418 | { | |
419 | unsigned long j = jiffies, next_j; | |
420 | unsigned int channel; | |
421 | bool set; | |
422 | ||
423 | again: | |
424 | next_j = j + LONG_MAX; | |
425 | set = false; | |
426 | for (channel = 0; channel < RXRPC_MAXCALLS; channel++) { | |
427 | struct rxrpc_channel *chan = &conn->channels[channel]; | |
428 | unsigned long ack_at; | |
429 | ||
430 | if (!test_bit(RXRPC_CONN_FINAL_ACK_0 + channel, &conn->flags)) | |
431 | continue; | |
432 | ||
433 | smp_rmb(); /* vs rxrpc_disconnect_client_call */ | |
434 | ack_at = READ_ONCE(chan->final_ack_at); | |
435 | ||
436 | if (time_before(j, ack_at)) { | |
437 | if (time_before(ack_at, next_j)) { | |
438 | next_j = ack_at; | |
439 | set = true; | |
440 | } | |
441 | continue; | |
442 | } | |
443 | ||
444 | if (test_and_clear_bit(RXRPC_CONN_FINAL_ACK_0 + channel, | |
445 | &conn->flags)) | |
446 | rxrpc_conn_retransmit_call(conn, NULL, channel); | |
447 | } | |
448 | ||
449 | j = jiffies; | |
450 | if (time_before_eq(next_j, j)) | |
451 | goto again; | |
452 | if (set) | |
453 | rxrpc_reduce_conn_timer(conn, next_j); | |
454 | } | |
455 | ||
17926a79 DH |
456 | /* |
457 | * connection-level event processor | |
458 | */ | |
459 | void rxrpc_process_connection(struct work_struct *work) | |
460 | { | |
461 | struct rxrpc_connection *conn = | |
462 | container_of(work, struct rxrpc_connection, processor); | |
17926a79 DH |
463 | struct sk_buff *skb; |
464 | u32 abort_code = RX_PROTOCOL_ERROR; | |
465 | int ret; | |
466 | ||
363deeab | 467 | rxrpc_see_connection(conn); |
17926a79 | 468 | |
2c4579e4 | 469 | if (test_and_clear_bit(RXRPC_CONN_EV_CHALLENGE, &conn->events)) |
17926a79 | 470 | rxrpc_secure_connection(conn); |
17926a79 | 471 | |
3136ef49 DH |
472 | /* Process delayed ACKs whose time has come. */ |
473 | if (conn->flags & RXRPC_CONN_FINAL_ACK_MASK) | |
474 | rxrpc_process_delayed_final_acks(conn); | |
475 | ||
17926a79 DH |
476 | /* go through the conn-level event packets, releasing the ref on this |
477 | * connection that each one has when we've finished with it */ | |
478 | while ((skb = skb_dequeue(&conn->rx_queue))) { | |
71f3ca40 | 479 | rxrpc_see_skb(skb, rxrpc_skb_rx_seen); |
17926a79 DH |
480 | ret = rxrpc_process_event(conn, skb, &abort_code); |
481 | switch (ret) { | |
482 | case -EPROTO: | |
483 | case -EKEYEXPIRED: | |
484 | case -EKEYREJECTED: | |
485 | goto protocol_error; | |
8c2f826d | 486 | case -ENOMEM: |
17926a79 DH |
487 | case -EAGAIN: |
488 | goto requeue_and_leave; | |
489 | case -ECONNABORTED: | |
490 | default: | |
71f3ca40 | 491 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); |
17926a79 DH |
492 | break; |
493 | } | |
494 | } | |
495 | ||
496 | out: | |
497 | rxrpc_put_connection(conn); | |
498 | _leave(""); | |
499 | return; | |
500 | ||
501 | requeue_and_leave: | |
502 | skb_queue_head(&conn->rx_queue, skb); | |
503 | goto out; | |
504 | ||
505 | protocol_error: | |
3a92789a | 506 | if (rxrpc_abort_connection(conn, ret, abort_code) < 0) |
17926a79 | 507 | goto requeue_and_leave; |
71f3ca40 | 508 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); |
17926a79 DH |
509 | goto out; |
510 | } |