diff options
Diffstat (limited to 'net/tls/tls_main.c')
-rw-r--r-- | net/tls/tls_main.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index df921a2904b9..a3cca1ef0098 100644 --- a/net/tls/tls_main.c +++ b/net/tls/tls_main.c | |||
@@ -208,6 +208,26 @@ int tls_push_partial_record(struct sock *sk, struct tls_context *ctx, | |||
208 | return tls_push_sg(sk, ctx, sg, offset, flags); | 208 | return tls_push_sg(sk, ctx, sg, offset, flags); |
209 | } | 209 | } |
210 | 210 | ||
211 | bool tls_free_partial_record(struct sock *sk, struct tls_context *ctx) | ||
212 | { | ||
213 | struct scatterlist *sg; | ||
214 | |||
215 | sg = ctx->partially_sent_record; | ||
216 | if (!sg) | ||
217 | return false; | ||
218 | |||
219 | while (1) { | ||
220 | put_page(sg_page(sg)); | ||
221 | sk_mem_uncharge(sk, sg->length); | ||
222 | |||
223 | if (sg_is_last(sg)) | ||
224 | break; | ||
225 | sg++; | ||
226 | } | ||
227 | ctx->partially_sent_record = NULL; | ||
228 | return true; | ||
229 | } | ||
230 | |||
211 | static void tls_write_space(struct sock *sk) | 231 | static void tls_write_space(struct sock *sk) |
212 | { | 232 | { |
213 | struct tls_context *ctx = tls_get_ctx(sk); | 233 | struct tls_context *ctx = tls_get_ctx(sk); |
@@ -267,6 +287,8 @@ static void tls_sk_proto_close(struct sock *sk, long timeout) | |||
267 | kfree(ctx->tx.rec_seq); | 287 | kfree(ctx->tx.rec_seq); |
268 | kfree(ctx->tx.iv); | 288 | kfree(ctx->tx.iv); |
269 | tls_sw_free_resources_tx(sk); | 289 | tls_sw_free_resources_tx(sk); |
290 | } else if (ctx->tx_conf == TLS_HW) { | ||
291 | tls_device_free_resources_tx(sk); | ||
270 | } | 292 | } |
271 | 293 | ||
272 | if (ctx->rx_conf == TLS_SW) { | 294 | if (ctx->rx_conf == TLS_SW) { |