Skip to content

Commit 0a6b292

Browse files
Dan Carpenterjrjohansen
authored andcommitted
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: 73688d1 ("apparmor: refactor prepare_ns() and make usable from different views") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: John Johansen <[email protected]>
1 parent 24b87a1 commit 0a6b292

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

security/apparmor/policy_ns.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ static struct aa_ns *__aa_create_ns(struct aa_ns *parent, const char *name,
255255

256256
ns = alloc_ns(parent->base.hname, name);
257257
if (!ns)
258-
return NULL;
258+
return ERR_PTR(-ENOMEM);
259259
ns->level = parent->level + 1;
260260
mutex_lock_nested(&ns->lock, ns->level);
261261
error = __aafs_ns_mkdir(ns, ns_subns_dir(parent), name, dir);

0 commit comments

Comments
 (0)