diff options
| author | Daniel Starke <daniel.starke@siemens.com> | 2022-04-14 02:42:12 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-05-12 12:20:22 +0200 |
| commit | 567ac05123a08c48403713305165214a885a66d3 (patch) | |
| tree | 045d2fb5f8a5d95b9e4a8eced610e43ea65d5546 | |
| parent | 0114092582cf4695135e3ecc41f134cb196158cb (diff) | |
| download | linux-567ac05123a08c48403713305165214a885a66d3.tar.gz linux-567ac05123a08c48403713305165214a885a66d3.tar.bz2 linux-567ac05123a08c48403713305165214a885a66d3.zip | |
tty: n_gsm: fix malformed counter for out of frame data
commit a24b4b2f660b7ddf3f484b37600bba382cb28a9d upstream.
The gsm_mux field 'malformed' represents the number of malformed frames
received. However, gsm1_receive() also increases this counter for any out
of frame byte.
Fix this by ignoring out of frame data for the malformed counter.
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-7-daniel.starke@siemens.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/tty/n_gsm.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 4d22d4bd8bfc..d8343dbfb11d 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1959,7 +1959,8 @@ static void gsm1_receive(struct gsm_mux *gsm, unsigned char c) } /* Any partial frame was a runt so go back to start */ if (gsm->state != GSM_START) { - gsm->malformed++; + if (gsm->state != GSM_SEARCH) + gsm->malformed++; gsm->state = GSM_START; } /* A SOF in GSM_START means we are still reading idling or |
