diff options
| author | John Johansen <john.johansen@canonical.com> | 2026-07-01 05:54:20 -0700 |
|---|---|---|
| committer | John Johansen <john.johansen@canonical.com> | 2026-08-10 22:49:41 -0700 |
| commit | 1bc94d09e1a94fe3f94cce025e0799dea24f2888 (patch) | |
| tree | 0b03e160b6ac92cecbb55c9b853480b7309bf8bf | |
| parent | 9f1e40193eef7f047e6b77cfb4b4cafdecd7a123 (diff) | |
| download | linux-stable-1bc94d09e1a94fe3f94cce025e0799dea24f2888.tar.gz linux-stable-1bc94d09e1a94fe3f94cce025e0799dea24f2888.zip | |
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>
| -rw-r--r-- | security/apparmor/apparmorfs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index ac0a181e5ceb..22317817d1f5 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -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) { |
