[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1238653770.6655.62.camel@bookworm>
Date: Thu, 02 Apr 2009 01:29:30 -0500
From: Tom Zanussi <tzanussi@...il.com>
To: linux-kernel <linux-kernel@...r.kernel.org>
Cc: Ingo Molnar <mingo@...e.hu>, Steven Rostedt <rostedt@...dmis.org>,
fweisbec@...il.com
Subject: [PATCH] tracing/filters: disallow concurrent/multiple
setting/enabling of filters
This patch disallows setting/enabling or multiple concurrent setting
and/or reading of event filters.
Signed-off-by: Tom Zanussi <tzanussi@...il.com>
---
kernel/trace/trace_events.c | 30 ++++++++++++++++++++++++++----
1 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index be9299a..eb7ee65 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -481,7 +481,10 @@ event_filter_read(struct file *filp, char __user *ubuf, size_t cnt,
trace_seq_init(s);
+ mutex_lock(&event_mutex);
filter_print_preds(call->preds, s);
+ mutex_unlock(&event_mutex);
+
r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len);
kfree(s);
@@ -514,20 +517,28 @@ event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,
return err;
}
+ mutex_lock(&event_mutex);
if (pred->clear) {
filter_free_preds(call);
filter_free_pred(pred);
- return cnt;
+ err = cnt;
+ goto out;
}
if (filter_add_pred(call, pred)) {
filter_free_pred(pred);
- return -EINVAL;
+ err = -EINVAL;
+ goto out;
}
+ mutex_unlock(&event_mutex);
*ppos += cnt;
return cnt;
+
+out:
+ mutex_unlock(&event_mutex);
+ return err;
}
static ssize_t
@@ -547,7 +558,10 @@ subsystem_filter_read(struct file *filp, char __user *ubuf, size_t cnt,
trace_seq_init(s);
+ mutex_lock(&event_mutex);
filter_print_preds(system->preds, s);
+ mutex_unlock(&event_mutex);
+
r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len);
kfree(s);
@@ -580,21 +594,29 @@ subsystem_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,
return err;
}
+ mutex_lock(&event_mutex);
if (pred->clear) {
filter_free_subsystem_preds(system);
filter_free_pred(pred);
- return cnt;
+ err = cnt;
+ goto out;
}
if (filter_add_subsystem_pred(system, pred)) {
filter_free_subsystem_preds(system);
filter_free_pred(pred);
- return -EINVAL;
+ err = -EINVAL;
+ goto out;
}
+ mutex_unlock(&event_mutex);
*ppos += cnt;
return cnt;
+
+out:
+ mutex_unlock(&event_mutex);
+ return err;
}
static const struct seq_operations show_event_seq_ops = {
--
1.5.6.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists