tty: n_gsm: fix malformed counter for out of frame data

JIRA: https://issues.redhat.com/browse/RHEL-24205

commit a24b4b2f660b7ddf3f484b37600bba382cb28a9d
Author: Daniel Starke <daniel.starke@siemens.com>
Date:   Thu Apr 14 02:42:12 2022 -0700

    tty: n_gsm: fix malformed counter for out of frame data

    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: e1eaea46bb ("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>

Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
This commit is contained in:
Andrew Halaney 2024-02-21 12:17:53 -06:00 committed by Derek Barbosa
parent ce8a3a960a
commit bcbad27e26
1 changed files with 2 additions and 1 deletions

View File

@ -2734,7 +2734,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