Skip to content

Commit 3fe16ed

Browse files
vvfedorenkokuba-moo
authored andcommitted
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: 692d7b5 ("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>
1 parent fc70f5b commit 3fe16ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/tls/tls_sw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1913,7 +1913,7 @@ int tls_sw_recvmsg(struct sock *sk,
19131913
* another message type
19141914
*/
19151915
msg->msg_flags |= MSG_EOR;
1916-
if (ctx->control != TLS_RECORD_TYPE_DATA)
1916+
if (control != TLS_RECORD_TYPE_DATA)
19171917
goto recv_end;
19181918
} else {
19191919
break;

0 commit comments

Comments
 (0)