Merge branch 'tip/perf/urgent-3' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / kernel / trace / trace.c
index ed1032d..9ec59f5 100644 (file)
@@ -741,13 +741,6 @@ __acquires(kernel_lock)
                return -1;
        }
 
-       /*
-        * When this gets called we hold the BKL which means that
-        * preemption is disabled. Various trace selftests however
-        * need to disable and enable preemption for successful tests.
-        * So we drop the BKL here and grab it after the tests again.
-        */
-       unlock_kernel();
        mutex_lock(&trace_types_lock);
 
        tracing_selftest_running = true;
@@ -829,7 +822,6 @@ __acquires(kernel_lock)
 #endif
 
  out_unlock:
-       lock_kernel();
        return ret;
 }
 
@@ -3471,6 +3463,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
                                        size_t cnt, loff_t *fpos)
 {
        char *buf;
+       size_t written;
 
        if (tracing_disabled)
                return -EINVAL;
@@ -3492,11 +3485,15 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
        } else
                buf[cnt] = '\0';
 
-       cnt = mark_printk("%s", buf);
+       written = mark_printk("%s", buf);
        kfree(buf);
-       *fpos += cnt;
+       *fpos += written;
 
-       return cnt;
+       /* don't tell userspace we wrote more - it might confuse them */
+       if (written > cnt)
+               written = cnt;
+
+       return written;
 }
 
 static int tracing_clock_show(struct seq_file *m, void *v)