]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
af_alg: Reorder resource release to avoid use-after-free
authorTim Small <tim@seoss.co.uk>
Mon, 17 Mar 2025 12:06:09 +0000 (12:06 +0000)
committerJouni Malinen <j@w1.fi>
Tue, 18 Mar 2025 20:42:01 +0000 (22:42 +0200)
Fixes: 206516e8c2bd ("af_alg: Crypto wrappers for Linux kernel crypto (AF_ALG)")
Signed-off-by: Tim Small <tim@seoss.co.uk>
src/crypto/crypto_linux.c

index 9278e279795f791a33bdbede078137a2dd5d6808..5d4f6be9324ee2a389397de64447481932050435 100644 (file)
@@ -363,8 +363,8 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
        }
 
        if (*len < ctx->mac_len) {
-               crypto_hash_deinit(ctx);
                *len = ctx->mac_len;
+               crypto_hash_deinit(ctx);
                return -1;
        }
        *len = ctx->mac_len;