Skip to content

Commit d069b78

Browse files
Boris Pismennydavem330
authored andcommitted
tls: Fix tls_device receive
Currently, the receive function fails to handle records already decrypted by the device due to the commit mentioned below. This commit advances the TLS record sequence number and prepares the context to handle the next record. Fixes: fedf201 ("net: tls: Refactor control message handling on recv") Signed-off-by: Boris Pismenny <borisp@mellanox.com> Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7754bd6 commit d069b78

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

net/tls/tls_sw.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,23 +1467,26 @@ static int decrypt_skb_update(struct sock *sk, struct sk_buff *skb,
14671467
struct strp_msg *rxm = strp_msg(skb);
14681468
int err = 0;
14691469

1470+
if (!ctx->decrypted) {
14701471
#ifdef CONFIG_TLS_DEVICE
1471-
err = tls_device_decrypted(sk, skb);
1472-
if (err < 0)
1473-
return err;
1472+
err = tls_device_decrypted(sk, skb);
1473+
if (err < 0)
1474+
return err;
14741475
#endif
1475-
if (!ctx->decrypted) {
1476-
err = decrypt_internal(sk, skb, dest, NULL, chunk, zc, async);
1477-
if (err < 0) {
1478-
if (err == -EINPROGRESS)
1479-
tls_advance_record_sn(sk, &tls_ctx->rx,
1480-
version);
1476+
/* Still not decrypted after tls_device */
1477+
if (!ctx->decrypted) {
1478+
err = decrypt_internal(sk, skb, dest, NULL, chunk, zc,
1479+
async);
1480+
if (err < 0) {
1481+
if (err == -EINPROGRESS)
1482+
tls_advance_record_sn(sk, &tls_ctx->rx,
1483+
version);
14811484

1482-
return err;
1485+
return err;
1486+
}
14831487
}
14841488

14851489
rxm->full_len -= padding_length(ctx, tls_ctx, skb);
1486-
14871490
rxm->offset += prot->prepend_size;
14881491
rxm->full_len -= prot->overhead_size;
14891492
tls_advance_record_sn(sk, &tls_ctx->rx, version);

0 commit comments

Comments
 (0)