diff options
author | Jakub Kicinski <kuba@kernel.org> | 2022-04-08 11:31:33 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-04-10 17:32:12 +0100 |
commit | b1a2c1786330286f4b31c4bb9fd1d5ac8bb09807 (patch) | |
tree | 5a9beb176f0aeb08689d5598082fb30fae51697b /net | |
parent | 465ea73535675ed3eb39e54a3631998f0c64e8d7 (diff) |
tls: rx: clear ctx->recv_pkt earlier
Whatever we do in the loop the skb should not remain on as
ctx->recv_pkt afterwards. We can clear that pointer and
restart strparser earlier.
This adds overhead of extra linking and unlinking to rx_list
but that's not large (upcoming change will switch to unlocked
skb list operations).
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/tls/tls_sw.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 3aa8fe1c6e77..71d8082647c8 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -1826,6 +1826,10 @@ int tls_sw_recvmsg(struct sock *sk, if (err <= 0) goto recv_end; + ctx->recv_pkt = NULL; + __strp_unpause(&ctx->strp); + skb_queue_tail(&ctx->rx_list, skb); + if (async) { /* TLS 1.2-only, to_decrypt must be text length */ chunk = min_t(int, to_decrypt, len); @@ -1840,10 +1844,9 @@ int tls_sw_recvmsg(struct sock *sk, if (err != __SK_PASS) { rxm->offset = rxm->offset + rxm->full_len; rxm->full_len = 0; + skb_unlink(skb, &ctx->rx_list); if (err == __SK_DROP) consume_skb(skb); - ctx->recv_pkt = NULL; - __strp_unpause(&ctx->strp); continue; } } @@ -1869,14 +1872,9 @@ pick_next_record: len -= chunk; /* For async or peek case, queue the current skb */ - if (async || is_peek || retain_skb) { - skb_queue_tail(&ctx->rx_list, skb); - ctx->recv_pkt = NULL; - __strp_unpause(&ctx->strp); - } else { + if (!(async || is_peek || retain_skb)) { + skb_unlink(skb, &ctx->rx_list); consume_skb(skb); - ctx->recv_pkt = NULL; - __strp_unpause(&ctx->strp); /* Return full control message to * userspace before trying to parse |