summaryrefslogtreecommitdiffstats
path: root/crypto/zstd.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@kernel.org>2025-07-08 17:59:54 -0700
committerHerbert Xu <herbert@gondor.apana.org.au>2025-07-18 20:52:00 +1000
commit962ddc5a7a4b04c007bba0f3e7298cda13c62efd (patch)
tree541459cb226120bc1f3c7e18ef7ee82da63eebbf /crypto/zstd.c
parentcrypto: x86/aegis - Add missing error checks (diff)
downloadlinux-962ddc5a7a4b04c007bba0f3e7298cda13c62efd.tar.gz
linux-962ddc5a7a4b04c007bba0f3e7298cda13c62efd.zip
crypto: acomp - Fix CFI failure due to type punning
To avoid a crash when control flow integrity is enabled, make the workspace ("stream") free function use a consistent type, and call it through a function pointer that has that same type. Fixes: 42d9f6c77479 ("crypto: acomp - Move scomp stream allocation code into acomp") Cc: stable@vger.kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/zstd.c')
-rw-r--r--crypto/zstd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/zstd.c b/crypto/zstd.c
index ebeadc1f3b5f..c2a19cb0879d 100644
--- a/crypto/zstd.c
+++ b/crypto/zstd.c
@@ -54,9 +54,14 @@ static void *zstd_alloc_stream(void)
return ctx;
}
+static void zstd_free_stream(void *ctx)
+{
+ kvfree(ctx);
+}
+
static struct crypto_acomp_streams zstd_streams = {
.alloc_ctx = zstd_alloc_stream,
- .cfree_ctx = kvfree,
+ .free_ctx = zstd_free_stream,
};
static int zstd_init(struct crypto_acomp *acomp_tfm)