Daniel Starke 70d7f1427a tty: n_gsm: fix missing receive state reset after mode switch
The current implementation uses either gsm0_receive() or gsm1_receive()
depending on whether the user configured the mux in basic or advanced
option mode. Both functions share some state values over the same logical
elements of the frame. However, both frame types differ in their nature.
gsm0_receive() uses non-transparency framing, whereas gsm1_receive() uses
transparency mechanism. Switching between both modes leaves the receive
function in an undefined state when done during frame reception.

Fix this by splitting both states. Add gsm0_receive_state_check_and_fix()
and gsm1_receive_state_check_and_fix() to ensure that gsm->state is reset
after a change of gsm->receive.

Note that gsm->state is only accessed in:
- gsm0_receive()
- gsm1_receive()
- gsm_error()

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/20240424054842.7741-2-daniel.starke@siemens.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-05-04 18:13:26 +02:00
..
2024-02-27 06:22:13 +01:00
2024-02-06 14:35:38 +00:00
2024-03-21 12:44:10 -07:00
2023-12-08 12:02:38 +01:00
2023-12-08 12:02:38 +01:00
2023-12-08 12:02:38 +01:00
2023-08-11 21:12:47 +02:00
2023-12-08 12:02:38 +01:00
2023-08-11 21:12:46 +02:00
2024-01-18 11:43:55 -08:00
2022-09-22 16:12:34 +02:00
2023-12-08 12:02:37 +01:00