summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Starke <daniel.starke@siemens.com>2022-04-14 02:42:15 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-05-09 09:05:08 +0200
commit17b86db43c009cbbc99b8d5983ecee69edce4a8f (patch)
tree9d400f494f82cfd748026e6197fb6914c1a10215
parenta2baa907c2818131cd05cca3c33cff955993f2b4 (diff)
tty: n_gsm: fix missing explicit ldisc flush
commit 17eac652028501df7ea296b1d9b9c134db262b7d upstream. In gsm_cleanup_mux() the muxer is closed down and all queues are removed. However, removing the queues is done without explicit control of the underlying buffers. Flush those before freeing up our queues to ensure that all outgoing queues are cleared consistently. Otherwise, a new mux connection establishment attempt may time out while the underlying tty is still busy sending out the remaining data from the previous connection. Fixes: e1eaea46bb40 ("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/20220414094225.4527-10-daniel.starke@siemens.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/n_gsm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 77bb93262c65..95ce423d0a3d 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -2079,6 +2079,7 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, bool disc)
gsm_dlci_release(gsm->dlci[i]);
mutex_unlock(&gsm->mutex);
/* Now wipe the queues */
+ tty_ldisc_flush(gsm->tty);
list_for_each_entry_safe(txq, ntxq, &gsm->tx_list, list)
kfree(txq);
INIT_LIST_HEAD(&gsm->tx_list);