From: Jakub Kicinski Date: Fri, 10 Jan 2020 12:38:32 +0000 (-0800) Subject: net/tls: fix async operation X-Git-Tag: baikal/mips/sdk5.9~14532^2~41 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=9c4e566835114ee9deb9fdc18854be29ab02538e;p=kernel.git net/tls: fix async operation Mallesham reports the TLS with async accelerator was broken by commit 14210c49b09b ("net/tls: free the record on encryption error") because encryption can return -EINPROGRESS in such setups, which should not be treated as an error. The error is also present in the BPF path (likely copied from there). Reported-by: Mallesham Jatharakonda Fixes: 635a8c9b3da8 ("tls: add bpf support to sk_msg handling") Fixes: 14210c49b09b ("net/tls: free the record on encryption error") Signed-off-by: Jakub Kicinski Reviewed-by: Simon Horman Signed-off-by: David S. Miller --- diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 1bf886269ede4..5c7c00429f8e0 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -770,7 +770,7 @@ static int bpf_exec_tx_verdict(struct sk_msg *msg, struct sock *sk, psock = sk_psock_get(sk); if (!psock || !policy) { err = tls_push_record(sk, flags, record_type); - if (err) { + if (err && err != -EINPROGRESS) { *copied -= sk_msg_free(sk, msg); tls_free_open_rec(sk); } @@ -799,7 +799,7 @@ more_data: switch (psock->eval) { case __SK_PASS: err = tls_push_record(sk, flags, record_type); - if (err < 0) { + if (err && err != -EINPROGRESS) { *copied -= sk_msg_free(sk, msg); tls_free_open_rec(sk); goto out_err;