public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	linux-next@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] events: always do slow path when trying to find a pmu
Date: Wed, 20 Feb 2013 09:16:45 -0800	[thread overview]
Message-ID: <20130220171645.GB3570@htj.dyndns.org> (raw)
In-Reply-To: <1361380176-15081-1-git-send-email-andriy.shevchenko@linux.intel.com>

On Wed, Feb 20, 2013 at 07:09:36PM +0200, Andy Shevchenko wrote:
> The guilty commit is cc5b5f6 "events: convert to idr_alloc()" together with
> f49318a "idr: implement lookup hint". In our case the idr_alloc is never called, but idr_find is. The hint field is never initialized and could not be dereferenced.

Ah, right, ->hint is uninitialized at the beginning.

> The proposed fix uses the idr_slowpath call which reflects old behaviour.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reported-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> ---
>  kernel/events/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 624e53f..20421ea 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -6076,7 +6076,7 @@ struct pmu *perf_init_event(struct perf_event *event)
>  	idx = srcu_read_lock(&pmus_srcu);
>  
>  	rcu_read_lock();
> -	pmu = idr_find(&pmu_idr, event->attr.type);
> +	pmu = idr_find_slowpath(&pmu_idr, event->attr.type);

But I don't think this is the right thing to do.  I'm working on
proper fix for idr_find().  Will post soon.

Thanks!

-- 
tejun

  reply	other threads:[~2013-02-20 17:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-20 17:09 [PATCH] events: always do slow path when trying to find a pmu Andy Shevchenko
2013-02-20 17:16 ` Tejun Heo [this message]
2013-02-20 17:24   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130220171645.GB3570@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mingo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox