From patchwork Wed Apr 26 08:03:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Starke" X-Patchwork-Id: 87708 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp78426vqo; Wed, 26 Apr 2023 01:07:11 -0700 (PDT) X-Google-Smtp-Source: AKy350Y1oZPZo9QJsNM9nGKB1uoNqlPiXba8BmZMbADyWTmL0EZFhKCwYajWQvr1IvkcAfhM0qoY X-Received: by 2002:a05:6a20:2443:b0:f0:3e78:715b with SMTP id t3-20020a056a20244300b000f03e78715bmr25119357pzc.40.1682496431647; Wed, 26 Apr 2023 01:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682496431; cv=none; d=google.com; s=arc-20160816; b=CjJbbGLWdSZaPCv+SzJTKvqx9wWlUPNUdvL1Q4qmsj3VsBBC2Z/3PGfzcBcyWf+uOo 2ZHcm8Cy4LicrfQluchRkBFZCmHme9KH9MAlPBSNHPb+yzPACxCwv7CCt28vWiMBGfYR gAMNjhpSp823tOCxZtQeECPFaM20jm5PLnLoqeyukOFye0X2I5gViExOq+tsnMuPvJTH Tji1OxgCzWyyw3w3H+6RSWvnrtD8KvlvwLW0PnZG2qKtbHp/6N1OkwLPlzblGotQYrDF 2qYE4MnwjdWhjYt3vK3/hP/H75kUCnxxU+n3gru16P9ANT2yRa1xE19LbpxAoqnjQi6w X+Kg== 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=n93VBue8YLe4OhiAewOGivq1aA7fZ4cftiwPcFyOEGA=; b=qZhs+NtDdA0shPooTahijfz13/STfCE1URaTWAXCLnV7MfRX7yxiMUXFnXLXYvQvJS uwOR7ahakJwj3OGVEPrhrZkIXGKEQj2EZpXuQ0dNu+PTk32VdOCRmxxNLL4iF4RmUcvr q1s4sn18ibl3unOyLqEUyYXq2XnuQvjaiX7w7qfoftckFmaZsN5cm2VyngcbGbHfSMte D761chmitfrNzu6Q/SE5TNqHyZcfsc0w7Qzf4jcKbBZOOK2YalZZqCGjCuzY5D14fn3L Qs/50hR2MolWY1xyzSWiC1bh31SLRbP0LYCrfKsCLYdz/GqOakuTVwR1qALWdLgXL/mB WOgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=iHhg3PN6; 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=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v20-20020a634654000000b005139e0d2b5csi10763006pgk.487.2023.04.26.01.06.56; Wed, 26 Apr 2023 01:07:11 -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=@siemens.com header.s=fm1 header.b=iHhg3PN6; 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=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240028AbjDZIDw (ORCPT + 99 others); Wed, 26 Apr 2023 04:03:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239943AbjDZIDg (ORCPT ); Wed, 26 Apr 2023 04:03:36 -0400 Received: from mta-64-228.siemens.flowmailer.net (mta-64-228.siemens.flowmailer.net [185.136.64.228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D26233C39 for ; Wed, 26 Apr 2023 01:03:33 -0700 (PDT) Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 20230426080331e894376af7320373af for ; Wed, 26 Apr 2023 10:03:31 +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=n93VBue8YLe4OhiAewOGivq1aA7fZ4cftiwPcFyOEGA=; b=iHhg3PN6pCQYgTPCN2tI8Jn7nBEpR5m7L9OP1UZleR07/97xPskAQLDJAPcOpaj6/MLISf RxGW/4L8VGia4AjNB+bOs21NVemge0kmuMzc3N7d2S54tpe/V0FIsgP6o+L8E+/XWscLi98d HT3/Oz0kCM08cEwWspWuNjoy3a2dU=; From: "D. Starke" To: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com Cc: linux-kernel@vger.kernel.org, Daniel Starke Subject: [PATCH v4 5/8] tty: n_gsm: increase malformed counter for malformed control frames Date: Wed, 26 Apr 2023 10:03:12 +0200 Message-Id: <20230426080315.7595-5-daniel.starke@siemens.com> In-Reply-To: <20230426080315.7595-1-daniel.starke@siemens.com> References: <20230426080315.7595-1-daniel.starke@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-314044:519-21489:flowmailer X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764225378618796783?= X-GMAIL-MSGID: =?utf-8?q?1764225378618796783?= From: Daniel Starke 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 --- drivers/tty/n_gsm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) v3 -> v4: No changes. Link: https://lore.kernel.org/all/20230424075251.5216-5-daniel.starke@siemens.com/ diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 186f463f0f11..5b6a03668c78 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -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);