]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
tty: n_gsm: fix user open not possible at responder until initiator open
authorDaniel Starke <daniel.starke@siemens.com>
Fri, 1 Jul 2022 06:16:44 +0000 (08:16 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 17 Oct 2022 09:56:49 +0000 (11:56 +0200)
commita51f153cf3dfaf67258536dccf68d41a4812623b
tree169896fac81fe591a45e0cdd107d851461898660
parent4b0d6413a2a246d48fe517bef9139f819ad9b665
tty: n_gsm: fix user open not possible at responder until initiator open

BugLink: https://bugs.launchpad.net/bugs/1990162
[ Upstream commit ac77f0077c3265197d378158c85a55eee6d21508 ]

After setting up the control channel on both sides the responder side may
want to open a virtual tty to listen on until the initiator starts an
application on a user channel. The current implementation allows the
open() but no other operation, like termios. These fail with EINVAL.
The responder sided application has no means to detect an open by the
initiator sided application this way. And the initiator sided applications
usually expect the responder sided application to listen on the user
channel upon open.
Set the user channel into half-open state on responder side once a user
application opens the virtual tty to allow IO operations on it.
Furthermore, keep the user channel constipated until the initiator side
opens it to give the responder sided application the chance to detect the
new connection and to avoid data loss if the responder sided application
starts sending before the user channel is open.

Fixes: e1eaea46bb40 ("tty: n_gsm line discipline")
Signed-off-by: Daniel Starke <daniel.starke@siemens.com>
Link: https://lore.kernel.org/r/20220701061652.39604-1-daniel.starke@siemens.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/tty/n_gsm.c