mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
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>
This commit is contained in:
parent
74b7105e53
commit
e16eee7895
1 changed files with 6 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue