From: John Johansen <john.johansen@canonical.com>
To: linux-kernel@vger.kernel.org
Cc: linux-security-module@vger.kernel.org
Subject: [PATCH 4/4] AppArmor: Fix locking from removal of profile namespace
Date: Fri, 27 Aug 2010 18:33:29 -0700 [thread overview]
Message-ID: <1282959209-5431-5-git-send-email-john.johansen@canonical.com> (raw)
In-Reply-To: <1282959209-5431-1-git-send-email-john.johansen@canonical.com>
The locking for profile namespace removal is wrong, when removing a
profile namespace, it needs to be removed from its parent's list.
Lock the parent of namespace list instead of the namespace being removed.
Signed-off-by: John Johansen <john.johansen@canonical.com>
---
security/apparmor/policy.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
index 3cdc1ad..52cc865 100644
--- a/security/apparmor/policy.c
+++ b/security/apparmor/policy.c
@@ -1151,12 +1151,14 @@ ssize_t aa_remove_profiles(char *fqname, size_t size)
/* released below */
ns = aa_get_namespace(root);
- write_lock(&ns->lock);
if (!name) {
/* remove namespace - can only happen if fqname[0] == ':' */
+ write_lock(&ns->parent->lock);
__remove_namespace(ns);
+ write_unlock(&ns->parent->lock);
} else {
/* remove profile */
+ write_lock(&ns->lock);
profile = aa_get_profile(__lookup_profile(&ns->base, name));
if (!profile) {
error = -ENOENT;
@@ -1165,8 +1167,8 @@ ssize_t aa_remove_profiles(char *fqname, size_t size)
}
name = profile->base.hname;
__remove_profile(profile);
+ write_unlock(&ns->lock);
}
- write_unlock(&ns->lock);
/* don't fail removal if audit fails */
(void) audit_policy(OP_PROF_RM, GFP_KERNEL, name, info, error);
--
1.7.0.4
prev parent reply other threads:[~2010-08-28 1:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-28 1:33 [Patch 0/4] AppArmor post 2.6.36 merge fixups John Johansen
2010-08-28 1:33 ` [PATCH 1/4] AppArmor: Drop hack to remove appended " (deleted)" string John Johansen
2010-08-28 1:33 ` [PATCH 2/4] AppArmor: Fix security_task_setrlimit logic for 2.6.36 changes John Johansen
2010-08-28 17:10 ` John Johansen
2010-08-28 18:15 ` Jiri Slaby
2010-08-28 20:35 ` John Johansen
2010-08-28 20:48 ` Jiri Slaby
2010-08-30 16:53 ` John Johansen
2010-08-30 21:33 ` Jiri Slaby
2010-09-06 17:10 ` John Johansen
2010-08-28 1:33 ` [PATCH 3/4] AppArmor: Fix splitting an fqname into separate namespace and profile names John Johansen
2010-08-28 1:33 ` John Johansen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1282959209-5431-5-git-send-email-john.johansen@canonical.com \
--to=john.johansen@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®