From: Martin Belanger tls_sw_read_sock() leaves a non-data record on the receive list and returns -EINVAL. The same function returns -EINVAL when an sk_psock is attached, and an actor may return it for other reasons, so callers cannot determine whether a control record is waiting. Return -EPROTO instead. The record can then be read with recvmsg() and a control buffer, which reports its type. Signed-off-by: Martin Belanger Signed-off-by: Hannes Reinecke --- net/tls/tls_sw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index d1ad31986cf2..7ac606900ff8 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -2044,7 +2044,7 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos, /* splice does not support reading control messages */ if (tlm->control != TLS_RECORD_TYPE_DATA) { - err = -EINVAL; + err = -EPROTO; goto splice_requeue; } @@ -2132,7 +2132,7 @@ int tls_sw_read_sock(struct sock *sk, read_descriptor_t *desc, /* read_sock does not support reading control messages */ if (tlm->control != TLS_RECORD_TYPE_DATA) { - err = -EINVAL; + err = -EPROTO; goto read_sock_requeue; } -- 2.51.0