From 258eac5b2d3f597b9e1d1577b3d8d0dee2c95d64 Mon Sep 17 00:00:00 2001 From: John Johansen Date: Wed, 15 Jun 2016 09:57:55 +0300 Subject: [PATCH 2/7] apparmor: fix: don't check for vmalloc_addr if kvzalloc() failed Signed-off-by: John Johansen --- security/apparmor/apparmorfs.c | 4 ++-- security/apparmor/match.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index ff76113..0e2cbde 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -1212,7 +1212,7 @@ static int aa_mk_null_file(struct dentry *parent) if (error) return error; - mutex_lock(&parent->d_inode->i_mutex); + inode_lock(d_inode(parent)); dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME)); if (IS_ERR(dentry)) { error = PTR_ERR(dentry); @@ -1238,7 +1238,7 @@ static int aa_mk_null_file(struct dentry *parent) out1: dput(dentry); out: - mutex_unlock(&parent->d_inode->i_mutex); + inode_unlock(d_inode(parent)); simple_release_fs(&mount, &count); return error; } diff --git a/security/apparmor/match.c b/security/apparmor/match.c index 68e4a26..45270ff 100644 --- a/security/apparmor/match.c +++ b/security/apparmor/match.c @@ -102,14 +102,14 @@ static struct table_header *unpack_table(char *blob, size_t bsize) u32, be32_to_cpu); else goto fail; + /* if table was vmalloced make sure the page tables are synced + * before it is used, as it goes live to all cpus. + */ + if (is_vmalloc_addr(table)) + vm_unmap_aliases(); } out: - /* if table was vmalloced make sure the page tables are synced - * before it is used, as it goes live to all cpus. - */ - if (is_vmalloc_addr(table)) - vm_unmap_aliases(); return table; fail: kvfree(table); -- 2.7.4