From: John Johansen Date: Sun, 25 Sep 2022 22:36:45 +0000 (-0700) Subject: apparmor: make sure the decompression ctx is promperly initialized X-Git-Tag: v6.2-rc1~86^2~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=14d37a7f14569adbf7a019710762271fa2a9e739;p=thirdparty%2Fkernel%2Flinux.git apparmor: make sure the decompression ctx is promperly initialized The decompress ctx was not properly initialized when reading raw profile data back to userspace. Reported-by: kernel test robot Fixes: 52ccc20c652b ("apparmor: use zstd compression for profile data") Signed-off-by: John Johansen --- diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index f6d83ffde3c42..ddd64b8ebf05e 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -1327,7 +1327,11 @@ static int decompress_zstd(char *src, size_t slen, char *dst, size_t dlen) ret = -ENOMEM; goto cleanup; } - + ctx = zstd_init_dctx(wksp, wksp_len); + if (ctx == NULL) { + ret = -ENOMEM; + goto cleanup; + } out_len = zstd_decompress_dctx(ctx, dst, dlen, src, slen); if (zstd_is_error(out_len)) { ret = -EINVAL;