Skip to content

Commit 30a7a7b

Browse files
Dave Watsongregkh
authored andcommitted
tls: Stricter error checking in zerocopy sendmsg path
commit 32da122 upstream. In the zerocopy sendmsg() path, there are error checks to revert the zerocopy if we get any error code. syzkaller has discovered that tls_push_record can return -ECONNRESET, which is fatal, and happens after the point at which it is safe to revert the iter, as we've already passed the memory to do_tcp_sendpages. Previously this code could return -ENOMEM and we would want to revert the iter, but AFAIK this no longer returns ENOMEM after a447da7 ("tls: fix waitall behavior in tls_sw_recvmsg"), so we fail for all error codes. Reported-by: syzbot+c226690f7b3126c5ee04@syzkaller.appspotmail.com Reported-by: syzbot+709f2810a6a05f11d4d3@syzkaller.appspotmail.com Signed-off-by: Dave Watson <davejwatson@fb.com> Fixes: 3c4d755 ("tls: kernel TLS support") Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d9bb71d commit 30a7a7b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/tls/tls_sw.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
449449
ret = tls_push_record(sk, msg->msg_flags, record_type);
450450
if (!ret)
451451
continue;
452-
if (ret == -EAGAIN)
452+
if (ret < 0)
453453
goto send_end;
454454

455455
copied -= try_to_copy;

0 commit comments

Comments
 (0)