mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-08 14:23:19 +00:00
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: 73688d1ed0
("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>
This commit is contained in:
parent
24b87a16fe
commit
0a6b29230e
@ -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);
|
ns = alloc_ns(parent->base.hname, name);
|
||||||
if (!ns)
|
if (!ns)
|
||||||
return NULL;
|
return ERR_PTR(-ENOMEM);
|
||||||
ns->level = parent->level + 1;
|
ns->level = parent->level + 1;
|
||||||
mutex_lock_nested(&ns->lock, ns->level);
|
mutex_lock_nested(&ns->lock, ns->level);
|
||||||
error = __aafs_ns_mkdir(ns, ns_subns_dir(parent), name, dir);
|
error = __aafs_ns_mkdir(ns, ns_subns_dir(parent), name, dir);
|
||||||
|
Loading…
Reference in New Issue
Block a user