projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8f04b85
)
perf: Fix NULL deref
author
Peter Zijlstra
<
[email protected]
>
Wed, 27 Jan 2016 20:59:04 +0000
(21:59 +0100)
committer
Ingo Molnar
<
[email protected]
>
Fri, 29 Jan 2016 07:35:24 +0000
(08:35 +0100)
Dan reported:
1229 if (ctx->task == TASK_TOMBSTONE ||
1230 !atomic_inc_not_zero(&ctx->refcount)) {
1231 raw_spin_unlock(&ctx->lock);
1232 ctx = NULL;
^^^^^^^^^^
ctx is NULL.
1233 }
1234
1235 WARN_ON_ONCE(ctx->task != task);
^^^^^^^^^^^^^^^^^
The patch adds a NULL dereference.
Reported-by: Dan Carpenter <
[email protected]
>
Signed-off-by: Peter Zijlstra (Intel) <
[email protected]
>
Cc: Arnaldo Carvalho de Melo <
[email protected]
>
Cc: David Ahern <
[email protected]
>
Cc: Jiri Olsa <
[email protected]
>
Cc: Linus Torvalds <
[email protected]
>
Cc: Namhyung Kim <
[email protected]
>
Cc: Peter Zijlstra <
[email protected]
>
Cc: Stephane Eranian <
[email protected]
>
Cc: Thomas Gleixner <
[email protected]
>
Cc: Vince Weaver <
[email protected]
>
Fixes: 63b6da39bb38 ("perf: Fix perf_event_exit_task() race")
Signed-off-by: Ingo Molnar <
[email protected]
>
kernel/events/core.c
patch
|
blob
|
history
diff --git
a/kernel/events/core.c
b/kernel/events/core.c
index 1d243fadfd1249bb78dbcf6a94796ab94caf82ee..fe97f95f204ecd81d564eaf36f28d527f334befb 100644
(file)
--- a/
kernel/events/core.c
+++ b/
kernel/events/core.c
@@
-1230,9
+1230,9
@@
retry:
!atomic_inc_not_zero(&ctx->refcount)) {
raw_spin_unlock(&ctx->lock);
ctx = NULL;
+ } else {
+ WARN_ON_ONCE(ctx->task != task);
}
-
- WARN_ON_ONCE(ctx->task != task);
}
rcu_read_unlock();
if (!ctx)