aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/tty/serial/serial_core.c4
-rw-r--r--drivers/tty/tty_ldisc.c1
-rw-r--r--drivers/tty/tty_mutex.c12
-rw-r--r--drivers/tty/vt/selection.c4
-rw-r--r--include/linux/tty.h2
5 files changed, 2 insertions, 21 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 4786232bc532..44c29631b724 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1245,8 +1245,6 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1245 struct uart_port *uport; 1245 struct uart_port *uport;
1246 unsigned long flags; 1246 unsigned long flags;
1247 1247
1248 BUG_ON(!tty_locked());
1249
1250 if (!state) 1248 if (!state)
1251 return; 1249 return;
1252 1250
@@ -1411,7 +1409,6 @@ static void uart_hangup(struct tty_struct *tty)
1411 struct tty_port *port = &state->port; 1409 struct tty_port *port = &state->port;
1412 unsigned long flags; 1410 unsigned long flags;
1413 1411
1414 BUG_ON(!tty_locked());
1415 pr_debug("uart_hangup(%d)\n", state->uart_port->line); 1412 pr_debug("uart_hangup(%d)\n", state->uart_port->line);
1416 1413
1417 mutex_lock(&port->mutex); 1414 mutex_lock(&port->mutex);
@@ -1498,7 +1495,6 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
1498 struct tty_port *port; 1495 struct tty_port *port;
1499 int retval, line = tty->index; 1496 int retval, line = tty->index;
1500 1497
1501 BUG_ON(!tty_locked());
1502 pr_debug("uart_open(%d) called\n", line); 1498 pr_debug("uart_open(%d) called\n", line);
1503 1499
1504 /* 1500 /*
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index ef925d581713..512c49f98e85 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -450,7 +450,6 @@ static int tty_ldisc_open(struct tty_struct *tty, struct tty_ldisc *ld)
450 if (ld->ops->open) { 450 if (ld->ops->open) {
451 int ret; 451 int ret;
452 /* BTM here locks versus a hangup event */ 452 /* BTM here locks versus a hangup event */
453 WARN_ON(!tty_locked());
454 ret = ld->ops->open(tty); 453 ret = ld->ops->open(tty);
455 if (ret) 454 if (ret)
456 clear_bit(TTY_LDISC_OPEN, &tty->flags); 455 clear_bit(TTY_LDISC_OPEN, &tty->flags);
diff --git a/drivers/tty/tty_mutex.c b/drivers/tty/tty_mutex.c
index 3b2bb7719442..9ff986c32a21 100644
--- a/drivers/tty/tty_mutex.c
+++ b/drivers/tty/tty_mutex.c
@@ -15,30 +15,18 @@
15 * Don't use in new code. 15 * Don't use in new code.
16 */ 16 */
17static DEFINE_MUTEX(big_tty_mutex); 17static DEFINE_MUTEX(big_tty_mutex);
18struct task_struct *__big_tty_mutex_owner;
19EXPORT_SYMBOL_GPL(__big_tty_mutex_owner);
20 18
21/* 19/*
22 * Getting the big tty mutex. 20 * Getting the big tty mutex.
23 */ 21 */
24void __lockfunc tty_lock(void) 22void __lockfunc tty_lock(void)
25{ 23{
26 struct task_struct *task = current;
27
28 WARN_ON(__big_tty_mutex_owner == task);
29
30 mutex_lock(&big_tty_mutex); 24 mutex_lock(&big_tty_mutex);
31 __big_tty_mutex_owner = task;
32} 25}
33EXPORT_SYMBOL(tty_lock); 26EXPORT_SYMBOL(tty_lock);
34 27
35void __lockfunc tty_unlock(void) 28void __lockfunc tty_unlock(void)
36{ 29{
37 struct task_struct *task = current;
38
39 WARN_ON(__big_tty_mutex_owner != task);
40 __big_tty_mutex_owner = NULL;
41
42 mutex_unlock(&big_tty_mutex); 30 mutex_unlock(&big_tty_mutex);
43} 31}
44EXPORT_SYMBOL(tty_unlock); 32EXPORT_SYMBOL(tty_unlock);
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
index fb864e7fcd13..7a0a12ae5458 100644
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -301,6 +301,8 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t
301/* Insert the contents of the selection buffer into the 301/* Insert the contents of the selection buffer into the
302 * queue of the tty associated with the current console. 302 * queue of the tty associated with the current console.
303 * Invoked by ioctl(). 303 * Invoked by ioctl().
304 *
305 * Locking: always called with BTM from vt_ioctl
304 */ 306 */
305int paste_selection(struct tty_struct *tty) 307int paste_selection(struct tty_struct *tty)
306{ 308{
@@ -310,8 +312,6 @@ int paste_selection(struct tty_struct *tty)
310 struct tty_ldisc *ld; 312 struct tty_ldisc *ld;
311 DECLARE_WAITQUEUE(wait, current); 313 DECLARE_WAITQUEUE(wait, current);
312 314
313 /* always called with BTM from vt_ioctl */
314 WARN_ON(!tty_locked());
315 315
316 console_lock(); 316 console_lock();
317 poke_blanked_console(); 317 poke_blanked_console();
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 44bc0c5617e1..6d5eceb165be 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -600,8 +600,6 @@ extern long vt_compat_ioctl(struct tty_struct *tty,
600/* functions for preparation of BKL removal */ 600/* functions for preparation of BKL removal */
601extern void __lockfunc tty_lock(void) __acquires(tty_lock); 601extern void __lockfunc tty_lock(void) __acquires(tty_lock);
602extern void __lockfunc tty_unlock(void) __releases(tty_lock); 602extern void __lockfunc tty_unlock(void) __releases(tty_lock);
603extern struct task_struct *__big_tty_mutex_owner;
604#define tty_locked() (current == __big_tty_mutex_owner)
605 603
606/* 604/*
607 * wait_event_interruptible_tty -- wait for a condition with the tty lock held 605 * wait_event_interruptible_tty -- wait for a condition with the tty lock held