summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-08-02 11:38:23 +0300
committerJohn Johansen <john.johansen@canonical.com>2018-08-21 16:24:56 -0700
commit0a6b29230ec336189bab32498df3f06c8a6944d8 (patch)
tree0ad3a73388010f8214152d9689f6d4a304c09b04
parent24b87a16fee0ebd49b66e8523186ace7ea09ad12 (diff)
downloadlwn-0a6b29230ec336189bab32498df3f06c8a6944d8.tar.gz
lwn-0a6b29230ec336189bab32498df3f06c8a6944d8.zip
apparmor: fix an error code in __aa_create_ns()
We should return error pointers in this function. Returning NULL results in a NULL dereference in the caller. Fixes: 73688d1ed0b8 ("apparmor: refactor prepare_ns() and make usable from different views") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
-rw-r--r--security/apparmor/policy_ns.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/apparmor/policy_ns.c b/security/apparmor/policy_ns.c
index b0f9dc3f765a..1a7cec5d9cac 100644
--- a/security/apparmor/policy_ns.c
+++ b/security/apparmor/policy_ns.c
@@ -255,7 +255,7 @@ static struct aa_ns *__aa_create_ns(struct aa_ns *parent, const char *name,
ns = alloc_ns(parent->base.hname, name);
if (!ns)
- return NULL;
+ return ERR_PTR(-ENOMEM);
ns->level = parent->level + 1;
mutex_lock_nested(&ns->lock, ns->level);
error = __aafs_ns_mkdir(ns, ns_subns_dir(parent), name, dir);