aboutsummaryrefslogtreecommitdiffstats
path: root/net/tls/tls_main.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-05-11 20:53:22 -0400
committerDavid S. Miller <davem@davemloft.net>2018-05-11 20:53:22 -0400
commitb2d6cee117f708d493c020f9f355297321507be7 (patch)
tree2c6975b47034de78fc899b4191260bb2704efc0f /net/tls/tls_main.c
parentb753a9faaf9aef1338c28ebd9ace6d749428788b (diff)
parent4bc871984f7cb5b2dec3ae64b570cb02f9ce2227 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
The bpf syscall and selftests conflicts were trivial overlapping changes. The r8169 change involved moving the added mdelay from 'net' into a different function. A TLS close bug fix overlapped with the splitting of the TLS state into separate TX and RX parts. I just expanded the tests in the bug fix from "ctx->conf == X" into "ctx->tx_conf == X && ctx->rx_conf == X". Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tls/tls_main.c')
-rw-r--r--net/tls/tls_main.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
index 4b57ddd72f34..301f22430469 100644
--- a/net/tls/tls_main.c
+++ b/net/tls/tls_main.c
@@ -135,6 +135,7 @@ retry:
135 offset -= sg->offset; 135 offset -= sg->offset;
136 ctx->partially_sent_offset = offset; 136 ctx->partially_sent_offset = offset;
137 ctx->partially_sent_record = (void *)sg; 137 ctx->partially_sent_record = (void *)sg;
138 ctx->in_tcp_sendpages = false;
138 return ret; 139 return ret;
139 } 140 }
140 141
@@ -248,16 +249,14 @@ static void tls_sk_proto_close(struct sock *sk, long timeout)
248 struct tls_context *ctx = tls_get_ctx(sk); 249 struct tls_context *ctx = tls_get_ctx(sk);
249 long timeo = sock_sndtimeo(sk, 0); 250 long timeo = sock_sndtimeo(sk, 0);
250 void (*sk_proto_close)(struct sock *sk, long timeout); 251 void (*sk_proto_close)(struct sock *sk, long timeout);
252 bool free_ctx = false;
251 253
252 lock_sock(sk); 254 lock_sock(sk);
253 sk_proto_close = ctx->sk_proto_close; 255 sk_proto_close = ctx->sk_proto_close;
254 256
255 if (ctx->tx_conf == TLS_HW_RECORD && ctx->rx_conf == TLS_HW_RECORD) 257 if ((ctx->tx_conf == TLS_HW_RECORD && ctx->rx_conf == TLS_HW_RECORD) ||
256 goto skip_tx_cleanup; 258 (ctx->tx_conf == TLS_BASE && ctx->rx_conf == TLS_BASE)) {
257 259 free_ctx = true;
258 if (ctx->tx_conf == TLS_BASE && ctx->rx_conf == TLS_BASE) {
259 kfree(ctx);
260 ctx = NULL;
261 goto skip_tx_cleanup; 260 goto skip_tx_cleanup;
262 } 261 }
263 262
@@ -305,8 +304,7 @@ skip_tx_cleanup:
305 /* free ctx for TLS_HW_RECORD, used by tcp_set_state 304 /* free ctx for TLS_HW_RECORD, used by tcp_set_state
306 * for sk->sk_prot->unhash [tls_hw_unhash] 305 * for sk->sk_prot->unhash [tls_hw_unhash]
307 */ 306 */
308 if (ctx && ctx->tx_conf == TLS_HW_RECORD && 307 if (free_ctx)
309 ctx->rx_conf == TLS_HW_RECORD)
310 kfree(ctx); 308 kfree(ctx);
311} 309}
312 310