aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2016-05-02 09:09:01 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2016-05-10 07:24:47 -0400
commit0c756914920fc13061222d12fbbe85990df64928 (patch)
treea30e9bf0f357a96fec8be39cc80b7eb4deef27f3
parent7e36eff1eece29eaa37501806ded0e0fb88e61ee (diff)
s390/3270: hangup the 3270 tty after a disconnect
The disconnect and later reconnect of a 3270 terminal does not do a tty hangup. The current session is resumed which is a security issue. Do a tty hangup after a unit check has been received. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--drivers/s390/char/tty3270.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c
index 402eff3c1634..0a9f219fdc7c 100644
--- a/drivers/s390/char/tty3270.c
+++ b/drivers/s390/char/tty3270.c
@@ -92,6 +92,7 @@ struct tty3270 {
92 unsigned char inattr; /* Visible/invisible input. */ 92 unsigned char inattr; /* Visible/invisible input. */
93 int throttle, attn; /* tty throttle/unthrottle. */ 93 int throttle, attn; /* tty throttle/unthrottle. */
94 struct tasklet_struct readlet; /* Tasklet to issue read request. */ 94 struct tasklet_struct readlet; /* Tasklet to issue read request. */
95 struct tasklet_struct hanglet; /* Tasklet to hang up the tty. */
95 struct kbd_data *kbd; /* key_maps stuff. */ 96 struct kbd_data *kbd; /* key_maps stuff. */
96 97
97 /* Escape sequence parsing. */ 98 /* Escape sequence parsing. */
@@ -646,6 +647,16 @@ tty3270_issue_read(struct tty3270 *tp, int lock)
646} 647}
647 648
648/* 649/*
650 * Hang up the tty
651 */
652static void
653tty3270_hangup_tasklet(struct tty3270 *tp)
654{
655 tty_port_tty_hangup(&tp->port, true);
656 raw3270_put_view(&tp->view);
657}
658
659/*
649 * Switch to the tty view. 660 * Switch to the tty view.
650 */ 661 */
651static int 662static int
@@ -678,11 +689,14 @@ tty3270_irq(struct tty3270 *tp, struct raw3270_request *rq, struct irb *irb)
678 } 689 }
679 690
680 if (rq) { 691 if (rq) {
681 if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) 692 if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) {
682 rq->rc = -EIO; 693 rq->rc = -EIO;
683 else 694 raw3270_get_view(&tp->view);
695 tasklet_schedule(&tp->hanglet);
696 } else {
684 /* Normal end. Copy residual count. */ 697 /* Normal end. Copy residual count. */
685 rq->rescnt = irb->scsw.cmd.count; 698 rq->rescnt = irb->scsw.cmd.count;
699 }
686 } else if (irb->scsw.cmd.dstat & DEV_STAT_DEV_END) { 700 } else if (irb->scsw.cmd.dstat & DEV_STAT_DEV_END) {
687 /* Interrupt without an outstanding request -> update all */ 701 /* Interrupt without an outstanding request -> update all */
688 tp->update_flags = TTY_UPDATE_ALL; 702 tp->update_flags = TTY_UPDATE_ALL;
@@ -739,6 +753,9 @@ tty3270_alloc_view(void)
739 tasklet_init(&tp->readlet, 753 tasklet_init(&tp->readlet,
740 (void (*)(unsigned long)) tty3270_read_tasklet, 754 (void (*)(unsigned long)) tty3270_read_tasklet,
741 (unsigned long) tp->read); 755 (unsigned long) tp->read);
756 tasklet_init(&tp->hanglet,
757 (void (*)(unsigned long)) tty3270_hangup_tasklet,
758 (unsigned long) tp);
742 INIT_WORK(&tp->resize_work, tty3270_resize_work); 759 INIT_WORK(&tp->resize_work, tty3270_resize_work);
743 760
744 return tp; 761 return tp;
@@ -1812,7 +1829,22 @@ tty3270_unthrottle(struct tty_struct * tty)
1812static void 1829static void
1813tty3270_hangup(struct tty_struct *tty) 1830tty3270_hangup(struct tty_struct *tty)
1814{ 1831{
1815 // FIXME: implement 1832 struct tty3270 *tp;
1833
1834 tp = tty->driver_data;
1835 if (!tp)
1836 return;
1837 spin_lock_bh(&tp->view.lock);
1838 tp->cx = tp->saved_cx = 0;
1839 tp->cy = tp->saved_cy = 0;
1840 tp->highlight = tp->saved_highlight = TAX_RESET;
1841 tp->f_color = tp->saved_f_color = TAC_RESET;
1842 tty3270_blank_screen(tp);
1843 while (tp->nr_lines < tp->view.rows - 2)
1844 tty3270_blank_line(tp);
1845 tp->update_flags = TTY_UPDATE_ALL;
1846 spin_unlock_bh(&tp->view.lock);
1847 tty3270_set_timer(tp, 1);
1816} 1848}
1817 1849
1818static void 1850static void