summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
Diffstat (limited to 'security')
-rw-r--r--security/apparmor/lib.c24
1 files changed, 3 insertions, 21 deletions
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
@@ -111,19 +111,6 @@ void *__aa_kvmalloc(size_t size, gfp_t flags)
111} 111}
112 112
113/** 113/**
114 * do_vfree - workqueue routine for freeing vmalloced memory
115 * @work: data to be freed
116 *
117 * The work_struct is overlaid to the data being freed, as at the point
118 * the work is scheduled the data is no longer valid, be its freeing
119 * needs to be delayed until safe.
120 */
121static void do_vfree(struct work_struct *work)
122{
123 vfree(work);
124}
125
126/**
127 * kvfree - free an allocation do by kvmalloc 114 * kvfree - free an allocation do by kvmalloc
128 * @buffer: buffer to free (MAYBE_NULL) 115 * @buffer: buffer to free (MAYBE_NULL)
129 * 116 *
@@ -131,13 +118,8 @@ static void do_vfree(struct work_struct *work)
131 */ 118 */
132void kvfree(void *buffer) 119void kvfree(void *buffer)
133{ 120{
134 if (is_vmalloc_addr(buffer)) { 121 if (is_vmalloc_addr(buffer))
135 /* Data is no longer valid so just use the allocated space 122 vfree(buffer);
136 * as the work_struct 123 else
137 */
138 struct work_struct *work = (struct work_struct *) buffer;
139 INIT_WORK(work, do_vfree);
140 schedule_work(work);
141 } else
142 kfree(buffer); 124 kfree(buffer);
143} 125}