summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDaniel Starke <daniel.starke@siemens.com>2022-04-14 02:42:12 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-05-12 12:14:56 +0200
commit02d2f29e83b4428186518a57ec74fc63b83a9814 (patch)
treee99e081db16a9cba562f46d2cd4f73ecd2d06b49 /drivers
parent478574e54f79c29cc25bf90c8e980075e1f07cf7 (diff)
downloadlinux-02d2f29e83b4428186518a57ec74fc63b83a9814.tar.gz
linux-02d2f29e83b4428186518a57ec74fc63b83a9814.tar.bz2
linux-02d2f29e83b4428186518a57ec74fc63b83a9814.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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/n_gsm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 9c5561588174..5a92c51aaf63 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1977,7 +1977,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