Commit b0940003 authored by Nick Piggin's avatar Nick Piggin Committed by Linus Torvalds

vt: bitlock fix

vt is missing a memory barrier to close the critical section.  Use a real
spinlock for this.
Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5bd91f18
...@@ -2400,13 +2400,15 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) ...@@ -2400,13 +2400,15 @@ static void vt_console_print(struct console *co, const char *b, unsigned count)
{ {
struct vc_data *vc = vc_cons[fg_console].d; struct vc_data *vc = vc_cons[fg_console].d;
unsigned char c; unsigned char c;
static unsigned long printing; static DEFINE_SPINLOCK(printing_lock);
const ushort *start; const ushort *start;
ushort cnt = 0; ushort cnt = 0;
ushort myx; ushort myx;
/* console busy or not yet initialized */ /* console busy or not yet initialized */
if (!printable || test_and_set_bit(0, &printing)) if (!printable)
return;
if (!spin_trylock(&printing_lock))
return; return;
if (kmsg_redirect && vc_cons_allocated(kmsg_redirect - 1)) if (kmsg_redirect && vc_cons_allocated(kmsg_redirect - 1))
...@@ -2481,7 +2483,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) ...@@ -2481,7 +2483,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count)
notify_update(vc); notify_update(vc);
quit: quit:
clear_bit(0, &printing); spin_unlock(&printing_lock);
} }
static struct tty_driver *vt_console_device(struct console *c, int *index) static struct tty_driver *vt_console_device(struct console *c, int *index)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment