]> git.karo-electronics.de Git - karo-tx-linux.git/commit
perf_event: Switch to internal refcount, fix race with close()
authorAl Viro <viro@ZenIV.linux.org.uk>
Mon, 20 Aug 2012 13:59:25 +0000 (14:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Oct 2012 16:47:24 +0000 (09:47 -0700)
commit71f08eb07187bb598e7da95d46458478846efc72
treeb2ac2f03c55f69a91a49fe23e9e758e8d614f234
parentd982d2f4e90cc354b5428d8d951784e0a3007bf3
perf_event: Switch to internal refcount, fix race with close()

commit a6fa941d94b411bbd2b6421ffbde6db3c93e65ab upstream.

Don't mess with file refcounts (or keep a reference to file, for
that matter) in perf_event.  Use explicit refcount of its own
instead.  Deal with the race between the final reference to event
going away and new children getting created for it by use of
atomic_long_inc_not_zero() in inherit_event(); just have the
latter free what it had allocated and return NULL, that works
out just fine (children of siblings of something doomed are
created as singletons, same as if the child of leader had been
created and immediately killed).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20120820135925.GG23464@ZenIV.linux.org.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/perf_event.h
kernel/events/core.c