Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1121823iob; Wed, 4 May 2022 15:16:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzjyoC+BxWiIBIMTcm0SsV2XiA7e5iWQGhiIC0bXYgaUa9Aesn/aJqyWjLaxcm5e81rGDV X-Received: by 2002:a17:90a:4897:b0:1c7:5fce:cbcd with SMTP id b23-20020a17090a489700b001c75fcecbcdmr2056574pjh.45.1651702574248; Wed, 04 May 2022 15:16:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651702574; cv=none; d=google.com; s=arc-20160816; b=RIHrYkU7tAdmdIhzhMnCCHY5ANPZHyYj2n9F5QYS3WqezdOvgpkWvniabLKDqLA5B+ yPirApdd6BDf7g50FVcMsrlMbLL5gyAF7YT16tvkAptnQLjAaxzmjBfxIYfYFf8FmpgB BVoomOC2RZfsUoyPXvDfNu6j+djTcxfrcLC0F+D9VA4A2FcVCe4V9nVnv3PsqfKuAJTO 2CBTiVaaK+/D6tHb4QmTxllxOJ35gA0DpJ6jE9YLi8YuB3o0bwGrf6AovqugkK27PTun 1N9oCUXAuwxt8g1DG5MSVbc/R67m/PF5eeGEatxCqBag6zfMMHZX+pU+6Z73X7GdYQjB fzCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9xgboyAZlXsw9peN3cym7loNSR9F+HRkbEK1m+as0vs=; b=Dq82nmTyyosgoR7KG1XpgQgnc/cfe9nxsgvnnID0FqkYZp6/lLTLIgCX35086E52eQ siyvba+ih33QssLHTTu+hkyHRMzvB/ogONw5kYIQtFXwkXO0sFd/ndUNoDIk1UFlv3u8 TzNSV7O1RW47a4R+omHLcUtc/t/OjNEjsPSFLxQNdFNI+gqHZADQi7OGQZRJEMYN8bFa +XIY6t73QukR8p/gJyE+tX3aSrpGISOWuNr+noKpJLs3gyclLJ3ICni299L08gQgwVpY wpsoC8yJSzKbg0BxIM2JRIAndcdFqlyAX6spM0LiWVpCRI80Z2eXXRCFr0hDvK2pGzq/ SSHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g9N+9nb3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s70-20020a632c49000000b003aafff36f80si21175722pgs.4.2022.05.04.15.15.56; Wed, 04 May 2022 15:16:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g9N+9nb3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358514AbiEDRme (ORCPT + 99 others); Wed, 4 May 2022 13:42:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356508AbiEDRJR (ORCPT ); Wed, 4 May 2022 13:09:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 008C053729; Wed, 4 May 2022 09:55:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 972E7B8279C; Wed, 4 May 2022 16:55:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25267C385A4; Wed, 4 May 2022 16:55:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683309; bh=4yqiFnWqlu0hD/+2oAtEqSwu+BcJydsFs4fp7XEz0L8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g9N+9nb3cgIh4oth3WILWRO6IzphSp69JReTHiYPzPpBY66wMtrrgo5ppo83dzXuu uWm8jNEaHN5y6vvuUHK/7jMpvorAMSnA/aty1T0/Mw0HxBGXf9dZHgwF3wsKjQX9Bf SyRiwbjzBThfDkYNlH7k93L93yne8JplP2wlhexE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke Subject: [PATCH 5.15 161/177] tty: n_gsm: fix malformed counter for out of frame data Date: Wed, 4 May 2022 18:45:54 +0200 Message-Id: <20220504153107.896678169@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 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 Link: https://lore.kernel.org/r/20220414094225.4527-7-daniel.starke@siemens.com Signed-off-by: Greg Kroah-Hartman --- 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