mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
crypto: acomp - Fix CFI failure due to type punning
commit962ddc5a7aupstream. 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:42d9f6c774("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> [Giovanni: Backport to 6.16.y. Removed logic in crypto/zstd.c as commitf5ad93ffb5("crypto: zstd - convert to acomp") is not going to be backported to stable.] Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
31eb1b5e3f
commit
7ec68c5946
@@ -48,9 +48,14 @@ static void *deflate_alloc_stream(void)
|
|||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void deflate_free_stream(void *ctx)
|
||||||
|
{
|
||||||
|
kvfree(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
static struct crypto_acomp_streams deflate_streams = {
|
static struct crypto_acomp_streams deflate_streams = {
|
||||||
.alloc_ctx = deflate_alloc_stream,
|
.alloc_ctx = deflate_alloc_stream,
|
||||||
.cfree_ctx = kvfree,
|
.free_ctx = deflate_free_stream,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int deflate_compress_one(struct acomp_req *req,
|
static int deflate_compress_one(struct acomp_req *req,
|
||||||
|
|||||||
@@ -63,10 +63,7 @@ struct crypto_acomp_stream {
|
|||||||
struct crypto_acomp_streams {
|
struct crypto_acomp_streams {
|
||||||
/* These must come first because of struct scomp_alg. */
|
/* These must come first because of struct scomp_alg. */
|
||||||
void *(*alloc_ctx)(void);
|
void *(*alloc_ctx)(void);
|
||||||
union {
|
|
||||||
void (*free_ctx)(void *);
|
void (*free_ctx)(void *);
|
||||||
void (*cfree_ctx)(const void *);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct crypto_acomp_stream __percpu *streams;
|
struct crypto_acomp_stream __percpu *streams;
|
||||||
struct work_struct stream_work;
|
struct work_struct stream_work;
|
||||||
|
|||||||
Reference in New Issue
Block a user