lkml.org 
[lkml]   [2022]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.15 161/177] tty: n_gsm: fix malformed counter for out of frame data
    Date
    From: Daniel Starke <daniel.starke@siemens.com>

    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>
    ---
    drivers/tty/n_gsm.c | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)

    --- a/drivers/tty/n_gsm.c
    +++ b/drivers/tty/n_gsm.c
    @@ -1976,7 +1976,8 @@ static void gsm1_receive(struct gsm_mux
    }
    /* 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

    \
     
     \ /
      Last update: 2022-05-04 19:40    [W:4.201 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site