summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorVinay Kumar Yadav <vinay.yadav@chelsio.com>2020-10-23 00:35:57 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-11-01 12:47:05 +0100
commit676a2b8478ea04cfa38cddd5dff8981098ace06f (patch)
treecfb04116997ef3f57610559f02ecfb9795b2e403 /drivers
parenta368a6efeeb0e06cb98010f12127e9584faaa95b (diff)
downloadlinux-stable-676a2b8478ea04cfa38cddd5dff8981098ace06f.tar.gz
linux-stable-676a2b8478ea04cfa38cddd5dff8981098ace06f.tar.bz2
linux-stable-676a2b8478ea04cfa38cddd5dff8981098ace06f.zip
chelsio/chtls: fix tls record info to user
[ Upstream commit 4f3391ce8f5a69e7e6d66d0a3fc654eb6dbdc919 ] chtls_pt_recvmsg() receives a skb with tls header and subsequent skb with data, need to finalize the data copy whenever next skb with tls header is available. but here current tls header is overwritten by next available tls header, ends up corrupting user buffer data. fixing it by finalizing current record whenever next skb contains tls header. v1->v2: - Improved commit message. Fixes: 17a7d24aa89d ("crypto: chtls - generic handling of data and hdr") Signed-off-by: Vinay Kumar Yadav <vinay.yadav@chelsio.com> Link: https://lore.kernel.org/r/20201022190556.21308-1-vinay.yadav@chelsio.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/crypto/chelsio/chtls/chtls_io.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/crypto/chelsio/chtls/chtls_io.c b/drivers/crypto/chelsio/chtls/chtls_io.c
index 9fb5ca6682ea..188d871f6b8c 100644
--- a/drivers/crypto/chelsio/chtls/chtls_io.c
+++ b/drivers/crypto/chelsio/chtls/chtls_io.c
@@ -1585,6 +1585,7 @@ skip_copy:
tp->urg_data = 0;
if ((avail + offset) >= skb->len) {
+ struct sk_buff *next_skb;
if (ULP_SKB_CB(skb)->flags & ULPCB_FLAG_TLS_HDR) {
tp->copied_seq += skb->len;
hws->rcvpld = skb->hdr_len;
@@ -1595,8 +1596,10 @@ skip_copy:
chtls_free_skb(sk, skb);
buffers_freed++;
hws->copied_seq = 0;
- if (copied >= target &&
- !skb_peek(&sk->sk_receive_queue))
+ next_skb = skb_peek(&sk->sk_receive_queue);
+ if (copied >= target && !next_skb)
+ break;
+ if (ULP_SKB_CB(next_skb)->flags & ULPCB_FLAG_TLS_HDR)
break;
}
} while (len > 0);