Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp473065rwr; Thu, 20 Apr 2023 01:56:23 -0700 (PDT) X-Google-Smtp-Source: AKy350ap9plalY0yQRcCPPjQsYbVxarp2Vh9Hvl0K+gLCNKC0T+R8E1U/Hz1uJ4yFTyqmI8kFsHp X-Received: by 2002:a05:6a21:6d89:b0:ee:d266:32be with SMTP id wl9-20020a056a216d8900b000eed26632bemr1256408pzb.11.1681980982859; Thu, 20 Apr 2023 01:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681980982; cv=none; d=google.com; s=arc-20160816; b=KLG25bTSG+mBI7bqOFtz5u0KDr5nFelE9dGW/h2+K54zjUTV41Pn0U0EIWrnzLVav2 sFUmZmpb0E6aJdPnjMT5xZbJAXfPgrSyeUhroJQ0x98JQK0mNkK2ZwDpO1J+lrAPp1ZU +c1M0n5Y9tKU+vpcdjyrNTCUB0ysXu0rlPsFzgqg+M27Uou7cyRmxbOBrscf4bIkVwHj ySGJ4wKkqEZmgx0xgB/dwqYsoudvHBEANCK7Hfc3ooi0mMnfTDa54AVTD3dUMuTaaNJc cbQeWPNkCrce/FmdCJ0dfHy+f+25N/2MSWyJeKbRAJ5K5ulrISqsPZdwk+FJ8sCoJFtB TGXA== 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=XYVykcI9EtHEvwVp8QrpLutUdz6E6nO+3d071pliXpo=; b=1Cn1HY4j9QTbu+RfqabL47d99+JIODjg7gQGIdA14FXvrTFGpTCYszpUhXY3fOPgsc /zb8Ji2Mxu610SWipAQ7H7KyCys1195Z3PlVFsfSb62rCO/JfcIf7gFtwoKhnCEeNqCt /aw6ZW5t3KNx8PjxMsrOPhsqAiTDfNUy4gQQsv7z5J2lYe1X1bOFswHoElNeKMNnL4wg kD5Z+qOYSreShf0cwT5SPQgO4N6SaYedbvB8MCiUb6FpvXYAcv5FUlbvJrubiq4a2VDw ZvDuuxu8Zv1n8BU6NYNIS9dW4pAwTrepFX2kiZR1nW3YvlXR3Oaukf7LYpg8fN+q6p7y cALQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=BPrlmz2i; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y14-20020a655b4e000000b0051393805ccesi1149297pgr.418.2023.04.20.01.56.08; Thu, 20 Apr 2023 01:56:22 -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=BPrlmz2i; 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 S234049AbjDTIyz (ORCPT + 99 others); Thu, 20 Apr 2023 04:54:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234068AbjDTIxs (ORCPT ); Thu, 20 Apr 2023 04:53:48 -0400 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 D8C547292 for ; Thu, 20 Apr 2023 01:52:02 -0700 (PDT) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 202304200852015290d3ae88502a98bf for ; Thu, 20 Apr 2023 10:52:01 +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=XYVykcI9EtHEvwVp8QrpLutUdz6E6nO+3d071pliXpo=; b=BPrlmz2iLtFt4KgsBHX92M5GrD9Pt3OJMqVBvib3Io93kFjCTv048H+b+o9JGp6y5uauV0 URbfPyELH+q3i8dtyQjSD8Vuace/REOIp4M2oTRWK0nKj7wklscF7p09uFQjB4D9hvHW8gmy fwuae2S8aP9bcOpkhr09thIbi/Scw=; 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 v2 6/9] tty: n_gsm: increase malformed counter for malformed control frames Date: Thu, 20 Apr 2023 10:50:14 +0200 Message-Id: <20230420085017.7314-6-daniel.starke@siemens.com> In-Reply-To: <20230420085017.7314-1-daniel.starke@siemens.com> References: <20230420085017.7314-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.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 autolearn=unavailable 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 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(-) v1 -> v2: Added remark to the commit message that the malformed counter is not yet exposed to the user. This was remarked in the review. Link: https://lore.kernel.org/all/AS4PR10MB589597931E257D7CACB984BCE0919@AS4PR10MB5895.EURPRD10.PROD.OUTLOOK.COM/ diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 1e97a41e6be9..cc7be05c37ce 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2454,8 +2454,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); -- 2.34.1