mirror of
https://github.com/S3NEO/android_kernel_samsung_msm8226.git
synced 2024-11-07 03:47:13 +00:00
nick kvfree() from apparmor
too many places open-code it Conflicts: mm/util.c Bug: 17871993 Change-Id: I007f4b663d7af564b2ce4009f5e13eeeeb82929a Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Git-commit: 39f1f78d53b9bcbca91967380c5f0f2305a5c55f Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git [jgebben@codeaurora.org: Remove redundant apparmor code not present upstream] Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org> Signed-off-by: Naveen Ramaraj <nramaraj@codeaurora.org> Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
This commit is contained in:
parent
e0e9af16c0
commit
f442812b2c
4 changed files with 15 additions and 32 deletions
|
@ -344,6 +344,8 @@ static inline int is_vmalloc_or_module_addr(const void *x)
|
|||
}
|
||||
#endif
|
||||
|
||||
extern void kvfree(const void *addr);
|
||||
|
||||
static inline void compound_lock(struct page *page)
|
||||
{
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
|
|
13
mm/util.c
13
mm/util.c
|
@ -4,6 +4,10 @@
|
|||
#include <linux/export.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/swap.h>
|
||||
#include <linux/swapops.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
@ -391,6 +395,15 @@ out:
|
|||
return res;
|
||||
}
|
||||
|
||||
void kvfree(const void *addr)
|
||||
{
|
||||
if (is_vmalloc_addr(addr))
|
||||
vfree(addr);
|
||||
else
|
||||
kfree(addr);
|
||||
}
|
||||
EXPORT_SYMBOL(kvfree);
|
||||
|
||||
/* Tracepoints definitions. */
|
||||
EXPORT_TRACEPOINT_SYMBOL(kmalloc);
|
||||
EXPORT_TRACEPOINT_SYMBOL(kmem_cache_alloc);
|
||||
|
|
|
@ -65,7 +65,6 @@ extern int apparmor_initialized __initdata;
|
|||
char *aa_split_fqname(char *args, char **ns_name);
|
||||
void aa_info_message(const char *str);
|
||||
void *kvmalloc(size_t size);
|
||||
void kvfree(void *buffer);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -104,34 +104,3 @@ void *kvmalloc(size_t size)
|
|||
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)
|
||||
*
|
||||
* Free a buffer allocated by kvmalloc
|
||||
*/
|
||||
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
|
||||
kfree(buffer);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue