aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/tty_ioctl.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index d6353d89b451..851cfcd2702a 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -21,6 +21,7 @@
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/bitops.h> 22#include <linux/bitops.h>
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/smp_lock.h>
24 25
25#include <asm/io.h> 26#include <asm/io.h>
26#include <asm/uaccess.h> 27#include <asm/uaccess.h>
@@ -61,11 +62,13 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout)
61 return; 62 return;
62 if (!timeout) 63 if (!timeout)
63 timeout = MAX_SCHEDULE_TIMEOUT; 64 timeout = MAX_SCHEDULE_TIMEOUT;
65 lock_kernel();
64 if (wait_event_interruptible_timeout(tty->write_wait, 66 if (wait_event_interruptible_timeout(tty->write_wait,
65 !tty->driver->chars_in_buffer(tty), timeout) < 0) 67 !tty->driver->chars_in_buffer(tty), timeout) >= 0) {
66 return; 68 if (tty->driver->wait_until_sent)
67 if (tty->driver->wait_until_sent) 69 tty->driver->wait_until_sent(tty, timeout);
68 tty->driver->wait_until_sent(tty, timeout); 70 }
71 unlock_kernel();
69} 72}
70EXPORT_SYMBOL(tty_wait_until_sent); 73EXPORT_SYMBOL(tty_wait_until_sent);
71 74