summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-06-22 10:58:57 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-06-22 10:58:57 -0700
commita11637194adc8bf2c2022ac89314dbdd1fcd1778 (patch)
treeb761d38ee683a71b7140b4203aee1cd319c5ef0e /kernel
parent636040b4eddf6152b5d0b2d574663809f898953b (diff)
parent6921a575c9f26f7ea274aaea3b78967810ce5513 (diff)
downloadlinux-a11637194adc8bf2c2022ac89314dbdd1fcd1778.tar.gz
linux-a11637194adc8bf2c2022ac89314dbdd1fcd1778.tar.bz2
linux-a11637194adc8bf2c2022ac89314dbdd1fcd1778.zip
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar. * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: ftrace: Make all inline tags also include notrace perf: Use css_tryget() to avoid propping up css refcount perf tools: Fix synthesizing tracepoint names from the perf.data headers perf stat: Fix default output file perf tools: Fix endianity swapping for adds_features bitmask
Diffstat (limited to 'kernel')
-rw-r--r--kernel/events/core.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index f85c0154b333..d7d71d6ec972 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -253,9 +253,9 @@ perf_cgroup_match(struct perf_event *event)
return !event->cgrp || event->cgrp == cpuctx->cgrp;
}
-static inline void perf_get_cgroup(struct perf_event *event)
+static inline bool perf_tryget_cgroup(struct perf_event *event)
{
- css_get(&event->cgrp->css);
+ return css_tryget(&event->cgrp->css);
}
static inline void perf_put_cgroup(struct perf_event *event)
@@ -484,7 +484,11 @@ static inline int perf_cgroup_connect(int fd, struct perf_event *event,
event->cgrp = cgrp;
/* must be done before we fput() the file */
- perf_get_cgroup(event);
+ if (!perf_tryget_cgroup(event)) {
+ event->cgrp = NULL;
+ ret = -ENOENT;
+ goto out;
+ }
/*
* all events in a group must monitor