diff options
author | Nick Piggin <npiggin@suse.de> | 2008-02-06 04:37:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-06 13:41:04 -0500 |
commit | b0940003f25dd3d2c54c4879809a432a35197f54 (patch) | |
tree | 13337fe5d5a758f4bf89510e81554a25fce19053 /drivers/char | |
parent | 5bd91f18be2fc0dd0384fbfca6d3cdd79a8050dd (diff) |
vt: bitlock fix
vt is missing a memory barrier to close the critical section. Use a real
spinlock for this.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/vt.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 7a5badfb7d84..367be9175061 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -2400,13 +2400,15 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) | |||
2400 | { | 2400 | { |
2401 | struct vc_data *vc = vc_cons[fg_console].d; | 2401 | struct vc_data *vc = vc_cons[fg_console].d; |
2402 | unsigned char c; | 2402 | unsigned char c; |
2403 | static unsigned long printing; | 2403 | static DEFINE_SPINLOCK(printing_lock); |
2404 | const ushort *start; | 2404 | const ushort *start; |
2405 | ushort cnt = 0; | 2405 | ushort cnt = 0; |
2406 | ushort myx; | 2406 | ushort myx; |
2407 | 2407 | ||
2408 | /* console busy or not yet initialized */ | 2408 | /* console busy or not yet initialized */ |
2409 | if (!printable || test_and_set_bit(0, &printing)) | 2409 | if (!printable) |
2410 | return; | ||
2411 | if (!spin_trylock(&printing_lock)) | ||
2410 | return; | 2412 | return; |
2411 | 2413 | ||
2412 | if (kmsg_redirect && vc_cons_allocated(kmsg_redirect - 1)) | 2414 | 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 | notify_update(vc); | 2483 | notify_update(vc); |
2482 | 2484 | ||
2483 | quit: | 2485 | quit: |
2484 | clear_bit(0, &printing); | 2486 | spin_unlock(&printing_lock); |
2485 | } | 2487 | } |
2486 | 2488 | ||
2487 | static struct tty_driver *vt_console_device(struct console *c, int *index) | 2489 | static struct tty_driver *vt_console_device(struct console *c, int *index) |