diff options
author | James Morris <james.l.morris@oracle.com> | 2013-05-12 21:28:38 +1000 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2013-05-12 21:28:38 +1000 |
commit | bd71164abc141ea696014e3e23c561b0d7f1b434 (patch) | |
tree | 3b9c64698800566197bf4ecec604ba8bb1228bd3 /security/apparmor/lib.c | |
parent | f722406faae2d073cc1d01063d1123c35425939e (diff) | |
parent | 2654bfbc2bd0e1e64f0b257c21da23f6cec32c6c (diff) | |
download | blackbird-op-linux-bd71164abc141ea696014e3e23c561b0d7f1b434.tar.gz blackbird-op-linux-bd71164abc141ea696014e3e23c561b0d7f1b434.zip |
Merge tag 'aa-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor into ra-next
Diffstat (limited to 'security/apparmor/lib.c')
-rw-r--r-- | security/apparmor/lib.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/security/apparmor/lib.c b/security/apparmor/lib.c index 7430298116d6..d40bc592180d 100644 --- a/security/apparmor/lib.c +++ b/security/apparmor/lib.c @@ -45,8 +45,10 @@ char *aa_split_fqname(char *fqname, char **ns_name) *ns_name = skip_spaces(&name[1]); if (split) { /* overwrite ':' with \0 */ - *split = 0; - name = skip_spaces(split + 1); + *split++ = 0; + if (strncmp(split, "//", 2) == 0) + split += 2; + name = skip_spaces(split); } else /* a ns name without a following profile is allowed */ name = NULL; @@ -75,15 +77,16 @@ void aa_info_message(const char *str) } /** - * kvmalloc - do allocation preferring kmalloc but falling back to vmalloc - * @size: size of allocation + * __aa_kvmalloc - do allocation preferring kmalloc but falling back to vmalloc + * @size: how many bytes of memory are required + * @flags: the type of memory to allocate (see kmalloc). * * Return: allocated buffer or NULL if failed * * It is possible that policy being loaded from the user is larger than * what can be allocated by kmalloc, in those cases fall back to vmalloc. */ -void *kvmalloc(size_t size) +void *__aa_kvmalloc(size_t size, gfp_t flags) { void *buffer = NULL; @@ -92,14 +95,17 @@ void *kvmalloc(size_t size) /* do not attempt kmalloc if we need more than 16 pages at once */ if (size <= (16*PAGE_SIZE)) - buffer = kmalloc(size, GFP_NOIO | __GFP_NOWARN); + buffer = kmalloc(size, flags | GFP_NOIO | __GFP_NOWARN); if (!buffer) { /* see kvfree for why size must be at least work_struct size * when allocated via vmalloc */ if (size < sizeof(struct work_struct)) size = sizeof(struct work_struct); - buffer = vmalloc(size); + if (flags & __GFP_ZERO) + buffer = vzalloc(size); + else + buffer = vmalloc(size); } return buffer; } |