Skip to content

Commit

Permalink
apparmor: no need to delay vfree()
Browse files Browse the repository at this point in the history
vfree() can be called from interrupt contexts now

Signed-off-by: Al Viro <[email protected]>
Acked-by: John Johansen <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
Al Viro authored and James Morris committed May 12, 2013
1 parent bd71164 commit b5b3ee6
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions security/apparmor/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}

0 comments on commit b5b3ee6

Please sign in to comment.