Re: [PATCH 1/4] perf core: Introduce new ioctl options to pause and resume ring buffer

Peter Zijlstra
2016-03-29T12:55:44Z

On Tue, Mar 29, 2016 at 02:54:23PM +0200, Peter Zijlstra wrote:
> +++ b/kernel/events/core.c
> @@ -4346,7 +4346,7 @@ static long _perf_ioctl(struct perf_even
>
> rcu_read_lock();
> rb = rcu_dereference(event->rb);
> - if (!event->rb) {
> + if (!event->rb || !event->nr_pages) {
> rcu_read_unlock();
> return -EINVAL;
> }

Clearly that should've been:

--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4346,7 +4346,7 @@ static long _perf_ioctl(struct perf_even

rcu_read_lock();
rb = rcu_dereference(event->rb);
- if (!event->rb || !event->nr_pages) {
+ if (!rb || !rb->nr_pages) {
rcu_read_unlock();
return -EINVAL;
}