提交 5af75917 编写于 作者: M Mike Galbraith 提交者: Ingo Molnar

perfcounters: fix use after free in perf_release()

running...

  while true; do
    foo -d 1 -f 1 -c 100000 & sleep 1
    kerneltop -d 1 -f 1 -e 1 -c 25000 -p `pidof foo`
  done

  while true; do
    killall foo; killall kerneltop; sleep 2
  done

...in two shells with SLUB_DEBUG enabled produces flood of:
BUG task_struct: Poison overwritten.

Fix the use-after-free bug in perf_release().
Signed-off-by: NMike Galbraith <efault@gmx.de>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 ffc04672
......@@ -1145,12 +1145,12 @@ static int perf_release(struct inode *inode, struct file *file)
mutex_lock(&counter->mutex);
perf_counter_remove_from_context(counter);
put_context(ctx);
mutex_unlock(&counter->mutex);
mutex_unlock(&ctx->mutex);
kfree(counter);
put_context(ctx);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册