]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
tty: n_gsm: fix missing explicit ldisc flush
authorDaniel Starke <daniel.starke@siemens.com>
Thu, 14 Apr 2022 09:42:15 +0000 (02:42 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 22 Jun 2022 12:23:05 +0000 (14:23 +0200)
BugLink: https://bugs.launchpad.net/bugs/1978234
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/tty/n_gsm.c

index fc10f500f848c76955903087c18d99330a5ebf6d..bc7f8810ee9e23a6fa30b37a510390e4aae6d68d 100644 (file)
@@ -2087,6 +2087,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);