aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tty_ldisc.c
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-11-30 08:18:35 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-11 18:18:08 -0500
commitf18f9498e90327b9b0e245e191029e6e1996d203 (patch)
treef60ba09838bfce3bac5cecf902e8012348490e62 /drivers/char/tty_ldisc.c
parenteeb89d918c2fa2b809e464136bbafdaec2aacb30 (diff)
tty: Push the lock down further into the ldisc code
Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char/tty_ldisc.c')
-rw-r--r--drivers/char/tty_ldisc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c
index d914e77f7f01..3f653f7d849f 100644
--- a/drivers/char/tty_ldisc.c
+++ b/drivers/char/tty_ldisc.c
@@ -445,8 +445,14 @@ static void tty_set_termios_ldisc(struct tty_struct *tty, int num)
445static int tty_ldisc_open(struct tty_struct *tty, struct tty_ldisc *ld) 445static int tty_ldisc_open(struct tty_struct *tty, struct tty_ldisc *ld)
446{ 446{
447 WARN_ON(test_and_set_bit(TTY_LDISC_OPEN, &tty->flags)); 447 WARN_ON(test_and_set_bit(TTY_LDISC_OPEN, &tty->flags));
448 if (ld->ops->open) 448 if (ld->ops->open) {
449 return ld->ops->open(tty); 449 int ret;
450 /* BKL here locks verus a hangup event */
451 lock_kernel();
452 ret = ld->ops->open(tty);
453 unlock_kernel();
454 return ret;
455 }
450 return 0; 456 return 0;
451} 457}
452 458
@@ -566,6 +572,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
566 return 0; 572 return 0;
567 } 573 }
568 574
575 unlock_kernel();
569 /* 576 /*
570 * Problem: What do we do if this blocks ? 577 * Problem: What do we do if this blocks ?
571 * We could deadlock here 578 * We could deadlock here
@@ -573,7 +580,6 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
573 580
574 tty_wait_until_sent(tty, 0); 581 tty_wait_until_sent(tty, 0);
575 582
576 unlock_kernel();
577 mutex_lock(&tty->ldisc_mutex); 583 mutex_lock(&tty->ldisc_mutex);
578 584
579 /* 585 /*