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

From: Peter Zijlstra
Date: Tue Mar 29 2016 - 08:55:47 EST


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;
}