From: Al Viro Date: Mon, 6 May 2013 02:10:35 +0000 (+0100) Subject: apparmor: no need to delay vfree() X-Git-Tag: firefly_0821_release~176^2~5790^2~12 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b5b3ee6c;p=firefly-linux-kernel-4.4.55.git apparmor: no need to delay vfree() vfree() can be called from interrupt contexts now Signed-off-by: Al Viro Acked-by: John Johansen Signed-off-by: James Morris --- diff --git a/security/apparmor/lib.c b/security/apparmor/lib.c index d40bc592180d..fcfe0233574c 100644 --- a/security/apparmor/lib.c +++ b/security/apparmor/lib.c @@ -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); }