mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08: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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user