]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/tls: Fix flipped sign in async_wait.err assignment
authorDaniel Jordan <daniel.m.jordan@oracle.com>
Wed, 27 Oct 2021 21:59:21 +0000 (17:59 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Nov 2021 18:46:14 +0000 (19:46 +0100)
commit 1d9d6fd21ad4a28b16ed9ee5432ae738b9dc58aa upstream.

sk->sk_err contains a positive number, yet async_wait.err wants the
opposite.  Fix the missed sign flip, which Jakub caught by inspection.

Fixes: 4e09428b5ad7 ("net/tls: Add support for async encryption of records for performance")
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/tls/tls_sw.c

index 8c9d2055d92b0f0aae838e59c0ebbcf7d0c45649..02821b9140546bc036a19dd921242c3fc5b4d696 100644 (file)
@@ -456,7 +456,7 @@ static void tls_encrypt_done(struct crypto_async_request *req, int err)
 
                /* If err is already set on socket, return the same code */
                if (sk->sk_err) {
-                       ctx->async_wait.err = sk->sk_err;
+                       ctx->async_wait.err = -sk->sk_err;
                } else {
                        ctx->async_wait.err = err;
                        tls_err_abort(sk, err);