aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2014-11-05 13:11:41 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-06 17:57:27 -0500
commit9191aaaa82d3149767125d58b2d260a3749d9f5e (patch)
treec551a4b7588fb105c12c45fad1eec2dddff1541d /drivers/tty
parent3f40f5b2a22110754ce469f5722bade8aeb241e5 (diff)
tty: Allow safe access to termios for set_ldisc() handlers
Allow a tty driver to safely access termios settings while handling the set_ldisc() notification. UART drivers use the set_ldisc() notification to check if the N_PPS line discipline is being enabled; if so, modem status interrupts may also need to be enabled. Conversely, modem status interrupts may need to be disabled if switching away from the N_PPS line discipline. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/tty_ldisc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index b66a81d0549e..3737f55272d2 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -572,8 +572,11 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
572 tty_ldisc_restore(tty, old_ldisc); 572 tty_ldisc_restore(tty, old_ldisc);
573 } 573 }
574 574
575 if (tty->ldisc->ops->num != old_ldisc->ops->num && tty->ops->set_ldisc) 575 if (tty->ldisc->ops->num != old_ldisc->ops->num && tty->ops->set_ldisc) {
576 down_read(&tty->termios_rwsem);
576 tty->ops->set_ldisc(tty); 577 tty->ops->set_ldisc(tty);
578 up_read(&tty->termios_rwsem);
579 }
577 580
578 /* At this point we hold a reference to the new ldisc and a 581 /* At this point we hold a reference to the new ldisc and a
579 reference to the old ldisc, or we hold two references to 582 reference to the old ldisc, or we hold two references to