policy_ns.c (5d5182cae40115c03933989473288e54afb39c7c) policy_ns.c (c97204baf840bf850e14ef4f5f43251239ca43b6)
1/*
2 * AppArmor security module
3 *
4 * This file contains AppArmor policy manipulation functions
5 *
6 * Copyright (C) 1998-2008 Novell/SUSE
7 * Copyright 2009-2017 Canonical Ltd.
8 *

--- 182 unchanged lines hidden (view full) ---

191 AA_BUG(!parent);
192 AA_BUG(!name);
193 AA_BUG(!mutex_is_locked(&parent->lock));
194
195 ns = alloc_ns(parent->base.hname, name);
196 if (!ns)
197 return NULL;
198 mutex_lock(&ns->lock);
1/*
2 * AppArmor security module
3 *
4 * This file contains AppArmor policy manipulation functions
5 *
6 * Copyright (C) 1998-2008 Novell/SUSE
7 * Copyright 2009-2017 Canonical Ltd.
8 *

--- 182 unchanged lines hidden (view full) ---

191 AA_BUG(!parent);
192 AA_BUG(!name);
193 AA_BUG(!mutex_is_locked(&parent->lock));
194
195 ns = alloc_ns(parent->base.hname, name);
196 if (!ns)
197 return NULL;
198 mutex_lock(&ns->lock);
199 error = __aa_fs_ns_mkdir(ns, ns_subns_dir(parent), name);
199 error = __aafs_ns_mkdir(ns, ns_subns_dir(parent), name);
200 if (error) {
201 AA_ERROR("Failed to create interface for ns %s\n",
202 ns->base.name);
203 mutex_unlock(&ns->lock);
204 aa_free_ns(ns);
205 return ERR_PTR(error);
206 }
207 ns->parent = aa_get_ns(parent);

--- 71 unchanged lines hidden (view full) ---

279 /* release all profiles in this namespace */
280 __aa_profile_list_release(&ns->base.profiles);
281
282 /* release all sub namespaces */
283 __ns_list_release(&ns->sub_ns);
284
285 if (ns->parent)
286 __aa_update_proxy(ns->unconfined, ns->parent->unconfined);
200 if (error) {
201 AA_ERROR("Failed to create interface for ns %s\n",
202 ns->base.name);
203 mutex_unlock(&ns->lock);
204 aa_free_ns(ns);
205 return ERR_PTR(error);
206 }
207 ns->parent = aa_get_ns(parent);

--- 71 unchanged lines hidden (view full) ---

279 /* release all profiles in this namespace */
280 __aa_profile_list_release(&ns->base.profiles);
281
282 /* release all sub namespaces */
283 __ns_list_release(&ns->sub_ns);
284
285 if (ns->parent)
286 __aa_update_proxy(ns->unconfined, ns->parent->unconfined);
287 __aa_fs_ns_rmdir(ns);
287 __aafs_ns_rmdir(ns);
288 mutex_unlock(&ns->lock);
289}
290
291/**
292 * __aa_remove_ns - remove a namespace and all its children
293 * @ns: namespace to be removed (NOT NULL)
294 *
295 * Requires: ns->parent->lock be held and ns removed from parent.

--- 52 unchanged lines hidden ---
288 mutex_unlock(&ns->lock);
289}
290
291/**
292 * __aa_remove_ns - remove a namespace and all its children
293 * @ns: namespace to be removed (NOT NULL)
294 *
295 * Requires: ns->parent->lock be held and ns removed from parent.

--- 52 unchanged lines hidden ---