Skip to content

Commit

Permalink
tty: n_gsm: fix wrong tty control line for flow control
Browse files Browse the repository at this point in the history
commit c19d935 upstream.

tty flow control is handled via gsmtty_throttle() and gsmtty_unthrottle().
Both functions propagate the outgoing hardware flow control state to the
remote side via MSC (modem status command) frames. The local state is taken
from the RTS (ready to send) flag of the tty. However, RTS gets mapped to
DTR (data terminal ready), which is wrong.
This patch corrects this by mapping RTS to RTS.

Fixes: e1eaea4 ("tty: n_gsm line discipline")
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Starke <daniel.starke@siemens.com>
Link: https://lore.kernel.org/r/20220218073123.2121-5-daniel.starke@siemens.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
dstarke-siemens authored and gregkh committed Mar 2, 2022
1 parent 1f0641d commit e4c8cb9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/tty/n_gsm.c
Expand Up @@ -3178,9 +3178,9 @@ static void gsmtty_throttle(struct tty_struct *tty)
if (dlci->state == DLCI_CLOSED)
return;
if (C_CRTSCTS(tty))
dlci->modem_tx &= ~TIOCM_DTR;
dlci->modem_tx &= ~TIOCM_RTS;
dlci->throttled = true;
/* Send an MSC with DTR cleared */
/* Send an MSC with RTS cleared */
gsmtty_modem_update(dlci, 0);
}

Expand All @@ -3190,9 +3190,9 @@ static void gsmtty_unthrottle(struct tty_struct *tty)
if (dlci->state == DLCI_CLOSED)
return;
if (C_CRTSCTS(tty))
dlci->modem_tx |= TIOCM_DTR;
dlci->modem_tx |= TIOCM_RTS;
dlci->throttled = false;
/* Send an MSC with DTR set */
/* Send an MSC with RTS set */
gsmtty_modem_update(dlci, 0);
}

Expand Down

0 comments on commit e4c8cb9

Please sign in to comment.