apparmor: fix error handling for copy_from_user in policy_update

copy_from_user does not return an error code and the check should be
setting the error code.

Fixes: 8b236f99edf8 ("apparmor: Initial support for compressed policies")
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen 2026-07-01 05:54:20 -07:00
parent 9f1e40193e
commit 1bc94d09e1

View File

@ -552,10 +552,10 @@ static struct aa_loaddata *aa_get_data_from_compressed(const char __user *userbu
*compressed_data = kvmalloc(buffer_size, GFP_KERNEL);
if (!*compressed_data)
return ERR_PTR(-ENOMEM);
error = copy_from_user(*compressed_data, userbuf, buffer_size);
if (error)
if (copy_from_user(*compressed_data, userbuf, buffer_size)) {
error = -EFAULT;
goto fail;
}
error = zstd_get_frame_header(&header, *compressed_data, buffer_size);
if (error || header.frameContentSize == ZSTD_CONTENTSIZE_UNKNOWN ||
header.frameContentSize == ZSTD_CONTENTSIZE_ERROR) {