]> git.baikalelectronics.ru Git - kernel.git/commit
tty: n_gsm: fix tty registration before control channel open
authorDaniel Starke <daniel.starke@siemens.com>
Fri, 1 Jul 2022 06:16:45 +0000 (08:16 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:24:04 +0000 (14:24 +0200)
commite02222b12a817ed401d933d10b9129a7fc6f74f0
tree90a7565acbfac9f62f393f31df332617aa3c616c
parentc731f8d7fa2c7b44e82a3151ef53ac7abcb4d51e
tty: n_gsm: fix tty registration before control channel open

[ Upstream commit 27c8d1facc5586ecc02056c7c1aac7466867784f ]

The current implementation registers/deregisters the user ttys at mux
attach/detach. That means that the user devices are available before any
control channel is open. However, user channel initialization requires an
open control channel. Furthermore, the user is not informed if the mux
restarts due to configuration changes.
Put the registration/deregistration procedure into separate function to
improve readability.
Move registration to mux activation and deregistration to mux cleanup to
keep the user devices only open as long as a control channel exists. The
user will be informed via the device driver if the mux was reconfigured in
a way that required a mux re-activation.
This makes it necessary to add T2 initialization to gsmld_open() for the
ldisc open code path (not the reconfiguration code path) to avoid deletion
of an uninitialized T2 at mux cleanup.

Fixes: bee16e52a3cf ("tty: n_gsm: expose gsmtty device nodes at ldisc open time")
Signed-off-by: Daniel Starke <daniel.starke@siemens.com>
Link: https://lore.kernel.org/r/20220701061652.39604-2-daniel.starke@siemens.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/n_gsm.c