Merge branch 'perf-fixes-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 31 Dec 2009 19:56:24 +0000 (11:56 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 31 Dec 2009 19:56:24 +0000 (11:56 -0800)
* 'perf-fixes-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  perf: Fix NULL deref in inheritance code
  perf: Pass appropriate frame pointer to dump_trace()

1  2 
kernel/perf_event.c

diff --combined kernel/perf_event.c
index 1f38270f08c7d62613665ac6cbb07fccef1c51b6,58ed1dae58755bade289cc92644d8542164c65f6..603c0d8b5df17a93c8b9679be42dd8905b5eaf97
@@@ -1617,7 -1617,7 +1617,7 @@@ static struct perf_event_context *find_
                 * offline CPU and activate it when the CPU comes up, but
                 * that's for later.
                 */
 -              if (!cpu_isset(cpu, cpu_online_map))
 +              if (!cpu_online(cpu))
                        return ERR_PTR(-ENODEV);
  
                cpuctx = &per_cpu(perf_cpu_context, cpu);
@@@ -4724,7 -4724,7 +4724,7 @@@ SYSCALL_DEFINE5(perf_event_open
        if (IS_ERR(event))
                goto err_put_context;
  
 -      err = anon_inode_getfd("[perf_event]", &perf_fops, event, 0);
 +      err = anon_inode_getfd("[perf_event]", &perf_fops, event, O_RDWR);
        if (err < 0)
                goto err_free_put_context;
  
@@@ -5148,7 -5148,7 +5148,7 @@@ int perf_event_init_task(struct task_st
                                            GFP_KERNEL);
                        if (!child_ctx) {
                                ret = -ENOMEM;
-                               goto exit;
+                               break;
                        }
  
                        __perf_event_init_context(child_ctx, child);
                }
        }
  
-       if (inherited_all) {
+       if (child_ctx && inherited_all) {
                /*
                 * Mark the child context as a clone of the parent
                 * context, or of whatever the parent is a clone of.
                get_ctx(child_ctx->parent_ctx);
        }
  
- exit:
        mutex_unlock(&parent_ctx->mutex);
  
        perf_unpin_context(parent_ctx);