tty: Fix unsafe vt paste_selection()
Convert the tty_buffer_flush() exclusion mechanism to a
public interface - tty_buffer_lock/unlock_exclusive() - and use
the interface to safely write the paste selection to the line
discipline.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 991575f..7a9a3b0 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -67,8 +67,8 @@
struct tty_bufhead {
struct tty_buffer *head; /* Queue head */
struct work_struct work;
- struct mutex flush_mutex;
- unsigned int flushpending:1;
+ struct mutex lock;
+ atomic_t priority;
struct tty_buffer sentinel;
struct llist_head free; /* Free queue head */
atomic_t memory_used; /* In-use buffers excluding free list */