Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Dan Carpenter and committed by
John Johansen
0a6b2923 24b87a16

+1 -1
+1 -1
security/apparmor/policy_ns.c
··· 255 255 256 256 ns = alloc_ns(parent->base.hname, name); 257 257 if (!ns) 258 - return NULL; 258 + return ERR_PTR(-ENOMEM); 259 259 ns->level = parent->level + 1; 260 260 mutex_lock_nested(&ns->lock, ns->level); 261 261 error = __aafs_ns_mkdir(ns, ns_subns_dir(parent), name, dir);