summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2022-09-25 15:36:45 -0700
committerJohn Johansen <john.johansen@canonical.com>2022-10-03 14:49:04 -0700
commit14d37a7f14569adbf7a019710762271fa2a9e739 (patch)
treea1ee45d7c600d0ee33999a905e78a5ff1540e652 /security
parent73c7e91c8bc98a5da94be62a9a4ba2793f86a97b (diff)
downloadlinux-stable-14d37a7f14569adbf7a019710762271fa2a9e739.tar.gz
linux-stable-14d37a7f14569adbf7a019710762271fa2a9e739.tar.bz2
linux-stable-14d37a7f14569adbf7a019710762271fa2a9e739.zip
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 <lkp@intel.com> Fixes: 52ccc20c652b ("apparmor: use zstd compression for profile data") Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security')
-rw-r--r--security/apparmor/apparmorfs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index f6d83ffde3c4..ddd64b8ebf05 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;