LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Leon Yu <chianglungyu@gmail.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Leon Yu <chianglungyu@gmail.com>,
	linux-kernel@vger.kernel.org, robert@swiecki.net
Subject: Re: [PATCH] perf: fix put_event() ctx leak
Date: Fri, 13 Mar 2015 12:53:27 +0800	[thread overview]
Message-ID: <CAP06WZwPU-E93MkX5rk-bH4CJfoW87K_bvOgBji6z_fepMqs3A@mail.gmail.com> (raw)
In-Reply-To: <1424954613-5034-1-git-send-email-chianglungyu@gmail.com>

On Thu, Feb 26, 2015 at 8:43 PM, Leon Yu <chianglungyu@gmail.com> wrote:
>
> Commit a83fe28e2e45 ("perf: Fix put_event() ctx lock") changed lock logic in
> put_event() by replacing mutex_lock_nested() with perf_event_ctx_lock_nested(),
> but didn't fix subsequent mutex_unlock() with correct counterpart,
> perf_event_ctx_unlock(). ctx is thus leaked as a result of incremented
> refcount in perf_event_ctx_lock_nested().
>
> Signed-off-by: Leon Yu <chianglungyu@gmail.com>
> Fixes: a83fe28e2e45 ("perf: Fix put_event() ctx lock")
> ---
>  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 f04daab..453ef61 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -3591,7 +3591,7 @@ static void put_event(struct perf_event *event)
>         ctx = perf_event_ctx_lock_nested(event, SINGLE_DEPTH_NESTING);
>         WARN_ON_ONCE(ctx->parent_ctx);
>         perf_remove_from_context(event, true);
> -       mutex_unlock(&ctx->mutex);
> +       perf_event_ctx_unlock(event, ctx);
>
>         _free_event(event);
>  }

Gentle ping.

It has been two weeks since previous post, the issue remains un-fixed
and affects some more users [1].
It would be very appreciated if I can get some responses from related
maintainers since we're almost
half way to release.

[1] http://marc.info/?l=linux-kernel&m=142618052120848&w=2

-Leon

  reply	other threads:[~2015-03-13  4:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26 12:43 Leon Yu
2015-03-13  4:53 ` Leon Yu [this message]
2015-03-16 12:06 ` [tip:perf/urgent] perf: Fix context leak in put_event() tip-bot for Leon Yu

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=CAP06WZwPU-E93MkX5rk-bH4CJfoW87K_bvOgBji6z_fepMqs3A@mail.gmail.com \
    --to=chianglungyu@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=robert@swiecki.net \
    --subject='Re: [PATCH] perf: fix put_event() ctx leak' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).