diff options
| author | John Johansen <john.johansen@canonical.com> | 2025-08-03 22:07:52 -0700 |
|---|---|---|
| committer | John Johansen <john.johansen@canonical.com> | 2026-01-29 01:27:54 -0800 |
| commit | e16eee7895502bc3c07043169940b005d44bba8f (patch) | |
| tree | e4d923e66d2cab8b77ba6d1b048a00d77eefcfc7 /security | |
| parent | 74b7105e53e80a4072bd3e1a50be7aa15e3f0a01 (diff) | |
apparmor: guard against free routines being called with a NULL
aa_free_data() and free_attachment() don't guard against having
a NULL parameter passed to them. Fix this.
Reviewed-by: Ryan Lee <ryan.lee@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security')
| -rw-r--r-- | security/apparmor/policy.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c index f2cef22ed729..a64cfd24cedc 100644 --- a/security/apparmor/policy.c +++ b/security/apparmor/policy.c @@ -232,6 +232,9 @@ static void aa_free_data(void *ptr, void *arg) { struct aa_data *data = ptr; + if (!ptr) + return; + kvfree_sensitive(data->data, data->size); kfree_sensitive(data->key); kfree_sensitive(data); @@ -241,6 +244,9 @@ static void free_attachment(struct aa_attachment *attach) { int i; + if (!attach) + return; + for (i = 0; i < attach->xattr_count; i++) kfree_sensitive(attach->xattrs[i]); kfree_sensitive(attach->xattrs); |
