tty: n_gsm: increase malformed counter for malformed control frames
authorDaniel Starke <daniel.starke@siemens.com>
Thu, 17 Aug 2023 09:32:27 +0000 (11:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Aug 2023 13:21:24 +0000 (15:21 +0200)
The malformed counter in gsm_mux is already increased in case of errors
detected in gsm_queue() and gsm1_receive(). gsm_dlci_command() also
detects a case for a malformed frame but does not increase the malformed
counter yet.

Fix this by also increasing the gsm_mux malformed counter in case of a
malformed frame in gsm_dlci_command().
Note that the malformed counter is not yet exposed and only set internally.

Signed-off-by: Daniel Starke <daniel.starke@siemens.com>
Link: https://lore.kernel.org/r/20230817093231.2317-5-daniel.starke@siemens.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_gsm.c

index 68276a7..2dc5bf1 100644 (file)
@@ -2455,8 +2455,10 @@ static void gsm_dlci_command(struct gsm_dlci *dlci, const u8 *data, int len)
        data += dlen;
 
        /* Malformed command? */
-       if (clen > len)
+       if (clen > len) {
+               dlci->gsm->malformed++;
                return;
+       }
 
        if (command & 1)
                gsm_control_message(dlci->gsm, command, data, clen);