Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753269AbcC2Mzo (ORCPT ); Tue, 29 Mar 2016 08:55:44 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:55456 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751826AbcC2Mzk (ORCPT ); Tue, 29 Mar 2016 08:55:40 -0400 Date: Tue, 29 Mar 2016 14:55:31 +0200 From: Peter Zijlstra To: Wang Nan Cc: Alexei Starovoitov , Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, Brendan Gregg , He Kuang , Jiri Olsa , Masami Hiramatsu , Namhyung Kim , pi3orama@163.com, Zefan Li Subject: Re: [PATCH 1/4] perf core: Introduce new ioctl options to pause and resume ring buffer Message-ID: <20160329125531.GA11035@twins.programming.kicks-ass.net> References: <1459147292-239310-1-git-send-email-wangnan0@huawei.com> <1459147292-239310-2-git-send-email-wangnan0@huawei.com> <20160329125423.GJ3408@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160329125423.GJ3408@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 668 Lines: 25 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; }