From: Alan Cox Date: Wed, 30 Apr 2008 07:53:32 +0000 (-0700) Subject: tty_ioctl: locking for tty_wait_until_sent X-Git-Tag: Ubuntu-5.0.0-8.9~34012 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=0ee9cbb3c705903db9c258047d9ce87096e6a1a1;p=mirror_ubuntu-disco-kernel.git tty_ioctl: locking for tty_wait_until_sent This function still depends on the big kernel lock in some cases. Push locking into the function ready for removal of the BKL from ioctl call paths. Signed-off-by: Alan Cox Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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 @@ #include #include #include +#include #include #include @@ -61,11 +62,13 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout) return; if (!timeout) timeout = MAX_SCHEDULE_TIMEOUT; + lock_kernel(); if (wait_event_interruptible_timeout(tty->write_wait, - !tty->driver->chars_in_buffer(tty), timeout) < 0) - return; - if (tty->driver->wait_until_sent) - tty->driver->wait_until_sent(tty, timeout); + !tty->driver->chars_in_buffer(tty), timeout) >= 0) { + if (tty->driver->wait_until_sent) + tty->driver->wait_until_sent(tty, timeout); + } + unlock_kernel(); } EXPORT_SYMBOL(tty_wait_until_sent);