diff options
Diffstat (limited to 'drivers/char/tty_io.c')
-rw-r--r-- | drivers/char/tty_io.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index a27160ba21d7..daeb8f766971 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -2498,7 +2498,7 @@ static int tiocgwinsz(struct tty_struct *tty, struct winsize __user *arg) | |||
2498 | /** | 2498 | /** |
2499 | * tty_do_resize - resize event | 2499 | * tty_do_resize - resize event |
2500 | * @tty: tty being resized | 2500 | * @tty: tty being resized |
2501 | * @real_tty: real tty (if using a pty/tty pair) | 2501 | * @real_tty: real tty (not the same as tty if using a pty/tty pair) |
2502 | * @rows: rows (character) | 2502 | * @rows: rows (character) |
2503 | * @cols: cols (character) | 2503 | * @cols: cols (character) |
2504 | * | 2504 | * |
@@ -2512,7 +2512,8 @@ int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, | |||
2512 | struct pid *pgrp, *rpgrp; | 2512 | struct pid *pgrp, *rpgrp; |
2513 | unsigned long flags; | 2513 | unsigned long flags; |
2514 | 2514 | ||
2515 | mutex_lock(&tty->termios_mutex); | 2515 | /* For a PTY we need to lock the tty side */ |
2516 | mutex_lock(&real_tty->termios_mutex); | ||
2516 | if (!memcmp(ws, &tty->winsize, sizeof(*ws))) | 2517 | if (!memcmp(ws, &tty->winsize, sizeof(*ws))) |
2517 | goto done; | 2518 | goto done; |
2518 | /* Get the PID values and reference them so we can | 2519 | /* Get the PID values and reference them so we can |
@@ -2533,7 +2534,7 @@ int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, | |||
2533 | tty->winsize = *ws; | 2534 | tty->winsize = *ws; |
2534 | real_tty->winsize = *ws; | 2535 | real_tty->winsize = *ws; |
2535 | done: | 2536 | done: |
2536 | mutex_unlock(&tty->termios_mutex); | 2537 | mutex_unlock(&real_tty->termios_mutex); |
2537 | return 0; | 2538 | return 0; |
2538 | } | 2539 | } |
2539 | 2540 | ||