Commit 4dcdd971 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

tls: rx: treat process_rx_list() errors as transient

process_rx_list() only fails if it can't copy data to user
space. There is no point recording the error onto sk->sk_err
or giving up on the data which was read partially. Treat
the return value like a normal socket partial read.
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1c699ffa
...@@ -1650,7 +1650,7 @@ static int process_rx_list(struct tls_sw_context_rx *ctx, ...@@ -1650,7 +1650,7 @@ static int process_rx_list(struct tls_sw_context_rx *ctx,
err = tls_record_content_type(msg, tlm, control); err = tls_record_content_type(msg, tlm, control);
if (err <= 0) if (err <= 0)
return err; goto out;
if (skip < rxm->full_len) if (skip < rxm->full_len)
break; break;
...@@ -1668,13 +1668,13 @@ static int process_rx_list(struct tls_sw_context_rx *ctx, ...@@ -1668,13 +1668,13 @@ static int process_rx_list(struct tls_sw_context_rx *ctx,
err = tls_record_content_type(msg, tlm, control); err = tls_record_content_type(msg, tlm, control);
if (err <= 0) if (err <= 0)
return err; goto out;
if (!zc || (rxm->full_len - skip) > len) { if (!zc || (rxm->full_len - skip) > len) {
err = skb_copy_datagram_msg(skb, rxm->offset + skip, err = skb_copy_datagram_msg(skb, rxm->offset + skip,
msg, chunk); msg, chunk);
if (err < 0) if (err < 0)
return err; goto out;
} }
len = len - chunk; len = len - chunk;
...@@ -1707,8 +1707,10 @@ static int process_rx_list(struct tls_sw_context_rx *ctx, ...@@ -1707,8 +1707,10 @@ static int process_rx_list(struct tls_sw_context_rx *ctx,
skb = next_skb; skb = next_skb;
} }
err = 0;
return copied; out:
return copied ? : err;
} }
int tls_sw_recvmsg(struct sock *sk, int tls_sw_recvmsg(struct sock *sk,
...@@ -1744,10 +1746,8 @@ int tls_sw_recvmsg(struct sock *sk, ...@@ -1744,10 +1746,8 @@ int tls_sw_recvmsg(struct sock *sk,
/* Process pending decrypted records. It must be non-zero-copy */ /* Process pending decrypted records. It must be non-zero-copy */
err = process_rx_list(ctx, msg, &control, 0, len, false, is_peek); err = process_rx_list(ctx, msg, &control, 0, len, false, is_peek);
if (err < 0) { if (err < 0)
tls_err_abort(sk, err);
goto end; goto end;
}
copied = err; copied = err;
if (len <= copied) if (len <= copied)
...@@ -1899,11 +1899,7 @@ int tls_sw_recvmsg(struct sock *sk, ...@@ -1899,11 +1899,7 @@ int tls_sw_recvmsg(struct sock *sk,
else else
err = process_rx_list(ctx, msg, &control, 0, err = process_rx_list(ctx, msg, &control, 0,
decrypted, true, is_peek); decrypted, true, is_peek);
if (err < 0) { decrypted = max(err, 0);
tls_err_abort(sk, err);
copied = 0;
goto end;
}
} }
copied += decrypted; copied += decrypted;
......
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