Commit b97638e0 authored by Vinay Kumar Yadav's avatar Vinay Kumar Yadav Committed by Greg Kroah-Hartman
Browse files

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.

- Improved commit message.

Fixes: 17a7d24a

 ("crypto: chtls - generic handling of data and hdr")
Signed-off-by: default avatarVinay Kumar Yadav <>

Signed-off-by: default avatarJakub Kicinski <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent eb592f2a
......@@ -1585,6 +1585,7 @@ static int chtls_pt_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
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 @@ static int chtls_pt_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
chtls_free_skb(sk, skb);
hws->copied_seq = 0;
if (copied >= target &&
next_skb = skb_peek(&sk->sk_receive_queue);
if (copied >= target && !next_skb)
if (ULP_SKB_CB(next_skb)->flags & ULPCB_FLAG_TLS_HDR)
} while (len > 0);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment