Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1015963pxb; Fri, 15 Apr 2022 18:26:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWz9t1XTk9heynCW2sEGjQbtugBtIQ9FKtIxxgKi4Z2ZTTJlkiVCYjRIX1CMgc2umAJ1IW X-Received: by 2002:a17:902:ce06:b0:156:8118:9e9a with SMTP id k6-20020a170902ce0600b0015681189e9amr1628212plg.169.1650072400463; Fri, 15 Apr 2022 18:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650072400; cv=none; d=google.com; s=arc-20160816; b=A2QF/XfM+wh3g8biyJ1XgrHm0gTG1j3tD2i5V5WAWssOS0wTY21tDhPntS9nbj3HPx v3GsAYVS0wlrTmnPTM0C3q37WA5XUs467fZoPtXNEOp/tsAfNaPaNZsHVVwiuskmnonW 1ooGNKXeuFl0oYOAeTpERCaz3kVe7TDL68fXQap+uCB5LzzHS/aq4rxVXCTG5zcxAIE9 sC9i2a3y0RbJdRDqlLirk1vAQNIGYOLZFhbUTybFS4nUk6wgppjOFK2mkWI+McaxN/14 3cvh1+x7KZQ4/A0zzg1Ax40tVKw2mQWD4xHwaBa9TdQA2nRTI2u2dyXyjJ+SR0p/+T64 YHzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PmuuDV740uCNQukuMAoWBIjNjCFKB+C5JJGKlHYkuWI=; b=t0qNN1twcf3dTe4KoUTxy1Zmtcy69BEVWFiCKK3LhxrvVQPee9Fr8TfNoxSjvquVNw eiS7gVp2+adP55VTvqygliFh5fk6kJc+poAOFXJlJYe7yasyiRtLSVO9XfZE8Fmp3XCR uaXtvBQFMVDtT97klTHT5mNkmwuWg+d7DsSmS4ssc3VKT6FR7JpUHbOP5XtWgiQrJca7 XdfFSU03FK++BLcjwEgADUE5YFkXAC2WDj0d2bh+YPAN3vRukWRnEnnrFjQ8K3EDdiBD ITZq4Lnt6Yxi+hRk/uWJFIX2Et9KN7Ie04QzApCLPbcT4IKquTbeHLeD150JO6WwY7jt jQlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=ljb49c20; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u70-20020a638549000000b0039908cd5f57si2834339pgd.783.2022.04.15.18.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 18:26:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=ljb49c20; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 444BD381A4; Fri, 15 Apr 2022 17:57:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236913AbiDNJqi (ORCPT + 99 others); Thu, 14 Apr 2022 05:46:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241903AbiDNJqP (ORCPT ); Thu, 14 Apr 2022 05:46:15 -0400 X-Greylist: delayed 62 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 14 Apr 2022 02:43:51 PDT Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net [185.136.65.225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15C556E4CB for ; Thu, 14 Apr 2022 02:43:51 -0700 (PDT) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 20220414094243e567e6bf905897610b for ; Thu, 14 Apr 2022 11:42:47 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=daniel.starke@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=PmuuDV740uCNQukuMAoWBIjNjCFKB+C5JJGKlHYkuWI=; b=ljb49c20slK5M+E8mf7EeMG+UZBGcYNoKwNrByEPkkME7XwkZ0b/+9TXbawyLyOyoD5rdE C34Oraz8BLNgwrY8aqb6W2axn5vshAFGFA1d6z9vplxQFUnBeVgZyKUUGY8OYD7KYMW6BI9F 2+1rGcjHzJbr8eiCRFVYx9HMpgLG8=; From: "D. Starke" To: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: linux-kernel@vger.kernel.org, Daniel Starke Subject: [PATCH 07/20] tty: n_gsm: fix malformed counter for out of frame data Date: Thu, 14 Apr 2022 02:42:12 -0700 Message-Id: <20220414094225.4527-7-daniel.starke@siemens.com> In-Reply-To: <20220414094225.4527-1-daniel.starke@siemens.com> References: <20220414094225.4527-1-daniel.starke@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-314044:519-21489:flowmailer X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Starke 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 --- drivers/tty/n_gsm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 4ce18b42c37a..2e3da8a4697e 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2044,7 +2044,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 -- 2.25.1