summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorVadim Fedorenko <vfedorenko@novek.ru>2020-11-15 07:16:00 +0300
committerJakub Kicinski <kuba@kernel.org>2020-11-16 17:11:02 -0800
commit3fe16edf6767decd640fa2654308bc64f8d656dc (patch)
tree3bf4493610baaf5474748c8d38e9305d9c0ed256 /net
parentfc70f5bf5e525dde81565f0a30d5e39168062eba (diff)
downloadlinux-3fe16edf6767decd640fa2654308bc64f8d656dc.tar.bz2
net/tls: fix corrupted data in recvmsg
If tcp socket has more data than Encrypted Handshake Message then tls_sw_recvmsg will try to decrypt next record instead of returning full control message to userspace as mentioned in comment. The next message - usually Application Data - gets corrupted because it uses zero copy for decryption that's why the data is not stored in skb for next iteration. Revert check to not decrypt next record if current is not Application Data. Fixes: 692d7b5d1f91 ("tls: Fix recvmsg() to be able to peek across multiple records") Signed-off-by: Vadim Fedorenko <vfedorenko@novek.ru> Link: https://lore.kernel.org/r/1605413760-21153-1-git-send-email-vfedorenko@novek.ru Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/tls/tls_sw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 95ab5545a931..2fe9e2cf8659 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -1913,7 +1913,7 @@ pick_next_record:
* another message type
*/
msg->msg_flags |= MSG_EOR;
- if (ctx->control != TLS_RECORD_TYPE_DATA)
+ if (control != TLS_RECORD_TYPE_DATA)
goto recv_end;
} else {
break;