aboutsummaryrefslogtreecommitdiff
path: root/kernel/events/uprobes.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2012-11-24 18:15:46 +0100
committerOleg Nesterov <oleg@redhat.com>2013-02-08 17:47:05 +0100
commit1ff6fee5e62c57d5923b805bb4206acb7953f16e (patch)
tree1b573238a506824e34d19b7ae5cba604d00f7b5c /kernel/events/uprobes.c
parente591c8d78e49e6206935cf31c4d2b603bbb29166 (diff)
uprobes: Change filter_chain() to iterate ->consumers list
Now that it safe to use ->consumer_rwsem under ->mmap_sem we can almost finish the implementation of filter_chain(). It still lacks the actual uc->filter(...) call but othewrwise it is ready, just it pretends that ->filter() always returns true. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/events/uprobes.c')
-rw-r--r--kernel/events/uprobes.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 61d0fa6b501..4d045236368 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -614,14 +614,19 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file,
static bool filter_chain(struct uprobe *uprobe)
{
- /*
- * TODO:
- * for_each_consumer(uc)
- * if (uc->filter(...))
- * return true;
- * return false;
- */
- return uprobe->consumers != NULL;
+ struct uprobe_consumer *uc;
+ bool ret = false;
+
+ down_read(&uprobe->consumer_rwsem);
+ for (uc = uprobe->consumers; uc; uc = uc->next) {
+ /* TODO: ret = uc->filter(...) */
+ ret = true;
+ if (ret)
+ break;
+ }
+ up_read(&uprobe->consumer_rwsem);
+
+ return ret;
}
static int