RE: [PATCH 06/19] kernel: convert perf_event_context.refcount from atomic_t to refcount_t

2017-02-20 Thread Reshetova, Elena
> On Mon, Feb 20, 2017 at 12:18:55PM +0200, Elena Reshetova wrote: > > +++ b/kernel/events/core.c > > @@ -1108,7 +1108,7 @@ static void perf_event_ctx_deactivate(struct > perf_event_context *ctx) > > > > static void get_ctx(struct perf_event_context *ctx) > > { > > - WARN_ON(!atomic_inc_not_ze

Re: [PATCH 06/19] kernel: convert perf_event_context.refcount from atomic_t to refcount_t

2017-02-20 Thread Peter Zijlstra
On Mon, Feb 20, 2017 at 12:18:55PM +0200, Elena Reshetova wrote: > +++ b/kernel/events/core.c > @@ -1108,7 +1108,7 @@ static void perf_event_ctx_deactivate(struct > perf_event_context *ctx) > > static void get_ctx(struct perf_event_context *ctx) > { > - WARN_ON(!atomic_inc_not_zero(&ctx->r

[PATCH 06/19] kernel: convert perf_event_context.refcount from atomic_t to refcount_t

2017-02-20 Thread Elena Reshetova
refcount_t type and corresponding API should be used instead of atomic_t when the variable is used as a reference counter. This allows to avoid accidental refcounter overflows that might lead to use-after-free situations. Signed-off-by: Elena Reshetova Signed-off-by: Hans Liljestrand Signed-off-