apparmor: use kvfree_sensitive to free data->data
commit 2bc73505a5cd2a18a7a542022722f136c19e3b87 upstream. Inside unpack_profile() data->data is allocated using kvmemdup() so it should be freed with the corresponding kvfree_sensitive(). Also add missing data->data release for rhashtable insertion failure path in unpack_profile(). Found by Linux Verification Center (linuxtesting.org). Fixes: e025be0f26d5 ("apparmor: support querying extended trusted helper extra data") Cc: stable@vger.kernel.org Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru> Signed-off-by: John Johansen <john.johansen@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
da0a9d1d3a
commit
241edbd0eb
2 changed files with 2 additions and 1 deletions
|
@ -187,7 +187,7 @@ static void aa_free_data(void *ptr, void *arg)
|
|||
{
|
||||
struct aa_data *data = ptr;
|
||||
|
||||
kfree_sensitive(data->data);
|
||||
kvfree_sensitive(data->data, data->size);
|
||||
kfree_sensitive(data->key);
|
||||
kfree_sensitive(data);
|
||||
}
|
||||
|
|
|
@ -915,6 +915,7 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)
|
|||
|
||||
if (rhashtable_insert_fast(profile->data, &data->head,
|
||||
profile->data->p)) {
|
||||
kvfree_sensitive(data->data, data->size);
|
||||
kfree_sensitive(data->key);
|
||||
kfree_sensitive(data);
|
||||
info = "failed to insert data to table";
|
||||
|
|
Loading…
Reference in a new issue