From patchwork Tue Aug 23 09:05:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Johansen X-Patchwork-Id: 661777 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3sJPgp1dc6z9sBc; Tue, 23 Aug 2016 19:06:30 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1bc7f9-0006JS-7o; Tue, 23 Aug 2016 09:06:27 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1bc7ez-0006GD-VE for kernel-team@lists.ubuntu.com; Tue, 23 Aug 2016 09:06:17 +0000 Received: from static-50-53-49-26.bvtn.or.frontiernet.net ([50.53.49.26] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1bc7ez-0006Tn-Cc for kernel-team@lists.ubuntu.com; Tue, 23 Aug 2016 09:06:17 +0000 From: John Johansen To: kernel-team@lists.ubuntu.com Subject: [PATCH 02/14] UBUNTU: SAUCE: apparmor: fix stack trace when removing namespace with profiles Date: Tue, 23 Aug 2016 02:05:42 -0700 Message-Id: <1471943154-14507-3-git-send-email-john.johansen@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471943154-14507-1-git-send-email-john.johansen@canonical.com> References: <1471943154-14507-1-git-send-email-john.johansen@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com BugLink: http://bugs.launchpad.net/bugs/1593874 Signed-off-by: John Johansen --- security/apparmor/policy_ns.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/security/apparmor/policy_ns.c b/security/apparmor/policy_ns.c index d06e664..19adb24 100644 --- a/security/apparmor/policy_ns.c +++ b/security/apparmor/policy_ns.c @@ -259,9 +259,13 @@ static void destroy_ns(struct aa_ns *ns) /* release all sub namespaces */ __ns_list_release(&ns->sub_ns); - if (ns->parent) + if (ns->parent) { + unsigned long flags; + write_lock_irqsave(&ns->labels.lock, flags); __aa_proxy_redirect(ns_unconfined(ns), ns_unconfined(ns->parent)); + write_unlock_irqrestore(&ns->labels.lock, flags); + } __aa_fs_ns_rmdir(ns); mutex_unlock(&ns->lock); }