summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Starke <daniel.starke@siemens.com>2022-04-14 02:42:14 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-05-09 09:16:32 +0200
commit5c2ac89f540bbfad7ae5156e3356bdf47731e52a (patch)
tree0c1091a94f99e30d2dac9e5a17533f6537807596
parente11311d3f81223f5850b3d0dc5b7def27e1d0b9d (diff)
downloadlinux-stable-5c2ac89f540bbfad7ae5156e3356bdf47731e52a.tar.gz
linux-stable-5c2ac89f540bbfad7ae5156e3356bdf47731e52a.tar.bz2
linux-stable-5c2ac89f540bbfad7ae5156e3356bdf47731e52a.zip
tty: n_gsm: fix wrong DLCI release order
commit deefc58bafb4841df7f0a0d85d89a1c819db9743 upstream. The current DLCI release order starts with the control channel followed by the user channels. Reverse this order to keep the control channel open until all user channels have been released. 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-9-daniel.starke@siemens.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/n_gsm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index cc90b03ce005..6b953dfbb155 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -2146,8 +2146,8 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, bool disc)
/* Finish outstanding timers, making sure they are done */
del_timer_sync(&gsm->t2_timer);
- /* Free up any link layer users */
- for (i = 0; i < NUM_DLCI; i++)
+ /* Free up any link layer users and finally the control channel */
+ for (i = NUM_DLCI - 1; i >= 0; i--)
if (gsm->dlci[i])
gsm_dlci_release(gsm->dlci[i]);
mutex_unlock(&gsm->mutex);