summaryrefslogtreecommitdiffstats
path: root/drivers/tty/synclinkmp.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2014-01-02 13:07:40 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-07 17:05:21 -0800
commitb8c98ae49e8d53344b1d62417eea05ebc3cdbd78 (patch)
treed50982086efec947214cc960d123afc616429dc9 /drivers/tty/synclinkmp.c
parent591cee0a35632031cd925392a1bce507dcfe9ea8 (diff)
downloadlinux-b8c98ae49e8d53344b1d62417eea05ebc3cdbd78.tar.bz2
tty: synclink: avoid sleep_on race
The four variants of the synclink driver use the same code in their open() callback to wait for a port in process of being closed, using interruptible_sleep_on, which is racy and going away soon. Making things worse, these functions hold the BTM while doing so, which means that if we ever enter this code path, we cannot actually continue since the other thread that is in process of closing the port can no longer get the BTM. This addresses both issues by using wait_event_interruptible_tty() instead. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/synclinkmp.c')
-rw-r--r--drivers/tty/synclinkmp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c
index dc6e96996ead..144202eef6fe 100644
--- a/drivers/tty/synclinkmp.c
+++ b/drivers/tty/synclinkmp.c
@@ -754,8 +754,8 @@ static int open(struct tty_struct *tty, struct file *filp)
/* If port is closing, signal caller to try again */
if (tty_hung_up_p(filp) || info->port.flags & ASYNC_CLOSING){
- if (info->port.flags & ASYNC_CLOSING)
- interruptible_sleep_on(&info->port.close_wait);
+ wait_event_interruptible_tty(tty, info->port.close_wait,
+ !(info->port.flags & ASYNC_CLOSING));
retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ?
-EAGAIN : -ERESTARTSYS);
goto cleanup;