Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5b3ee6c authored by Al Viro's avatar Al Viro Committed by James Morris
Browse files

apparmor: no need to delay vfree()



vfree() can be called from interrupt contexts now

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Acked-by: default avatarJohn Johansen <john.johansen@canonical.com>
Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
parent bd71164a
Loading
Loading
Loading
Loading
+3 −21
Original line number Diff line number Diff line
@@ -110,19 +110,6 @@ void *__aa_kvmalloc(size_t size, gfp_t flags)
	return buffer;
}

/**
 * do_vfree - workqueue routine for freeing vmalloced memory
 * @work: data to be freed
 *
 * The work_struct is overlaid to the data being freed, as at the point
 * the work is scheduled the data is no longer valid, be its freeing
 * needs to be delayed until safe.
 */
static void do_vfree(struct work_struct *work)
{
	vfree(work);
}

/**
 * kvfree - free an allocation do by kvmalloc
 * @buffer: buffer to free (MAYBE_NULL)
@@ -131,13 +118,8 @@ static void do_vfree(struct work_struct *work)
 */
void kvfree(void *buffer)
{
	if (is_vmalloc_addr(buffer)) {
		/* Data is no longer valid so just use the allocated space
		 * as the work_struct
		 */
		struct work_struct *work = (struct work_struct *) buffer;
		INIT_WORK(work, do_vfree);
		schedule_work(work);
	} else
	if (is_vmalloc_addr(buffer))
		vfree(buffer);
	else
		kfree(buffer);
}