aboutsummaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorMing Lei <ming.lei@canonical.com>2011-06-29 19:06:25 +0800
committerJohn Rigby <john.rigby@linaro.org>2011-11-16 14:24:51 -0700
commit83d038113e05cbad935e795653042da0d5ad0c4e (patch)
tree90cd91664a4c3adf1325857aee55845b131a8623 /security
parentb57777afed63c011baea18782d65d837562bceb7 (diff)
downloadlinux-linaro-precise-83d038113e05cbad935e795653042da0d5ad0c4e.tar.gz
UBUNTU: SAUCE: fix yama_ptracer_del lockdep warning
yama_ptracer_del can be called in softirq context, so ptracer_relations_lock may be held in softirq context. This patch replaces spin_[un]lock with spin_[un]lock_bh for &ptracer_relations_lock to fix reported lockdep warning and avoid possible dealock. BugLink: http://bugs.launchpad.net/bugs/791019 Signed-off-by: Ming Lei <ming.lei@canonical.com> Acked-by: Tim Gardner <tim.gardner@canonical.com> Acked-by: Stefan Bader <stefan.bader@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Diffstat (limited to 'security')
-rw-r--r--security/yama/yama_lsm.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c
index 9389282d36a..4127150c402 100644
--- a/security/yama/yama_lsm.c
+++ b/security/yama/yama_lsm.c
@@ -46,7 +46,7 @@ static int yama_ptracer_add(struct task_struct *tracer,
struct ptrace_relation *entry, *relation = NULL;
added = kmalloc(sizeof(*added), GFP_KERNEL);
- spin_lock(&ptracer_relations_lock);
+ spin_lock_bh(&ptracer_relations_lock);
list_for_each_entry(entry, &ptracer_relations, node)
if (entry->tracee == tracee) {
relation = entry;
@@ -64,7 +64,7 @@ static int yama_ptracer_add(struct task_struct *tracer,
relation->tracer = tracer;
unlock_out:
- spin_unlock(&ptracer_relations_lock);
+ spin_unlock_bh(&ptracer_relations_lock);
if (added && added != relation)
kfree(added);
@@ -82,7 +82,7 @@ static void yama_ptracer_del(struct task_struct *tracer,
struct ptrace_relation *relation;
struct list_head *list, *safe;
- spin_lock(&ptracer_relations_lock);
+ spin_lock_bh(&ptracer_relations_lock);
list_for_each_safe(list, safe, &ptracer_relations) {
relation = list_entry(list, struct ptrace_relation, node);
if (relation->tracee == tracee ||
@@ -91,7 +91,7 @@ static void yama_ptracer_del(struct task_struct *tracer,
kfree(relation);
}
}
- spin_unlock(&ptracer_relations_lock);
+ spin_unlock_bh(&ptracer_relations_lock);
}
/**
@@ -208,7 +208,7 @@ static int ptracer_exception_found(struct task_struct *tracer,
struct ptrace_relation *relation;
struct task_struct *parent = NULL;
- spin_lock(&ptracer_relations_lock);
+ spin_lock_bh(&ptracer_relations_lock);
rcu_read_lock();
read_lock(&tasklist_lock);
@@ -224,7 +224,7 @@ static int ptracer_exception_found(struct task_struct *tracer,
if (task_is_descendant(parent, tracer))
rc = 1;
- spin_unlock(&ptracer_relations_lock);
+ spin_unlock_bh(&ptracer_relations_lock);
return rc;
}