Skip to content

Commit

Permalink
apparmor: fix an error code in __aa_create_ns()
Browse files Browse the repository at this point in the history
We should return error pointers in this function.  Returning NULL
results in a NULL dereference in the caller.

Fixes: 73688d1 ("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>
  • Loading branch information
Dan Carpenter authored and John Johansen committed Aug 21, 2018
1 parent 24b87a1 commit 0a6b292
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion security/apparmor/policy_ns.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0a6b292

Please sign in to comment.