From patchwork Thu Apr 20 08:50:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Starke" X-Patchwork-Id: 85785 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp186566vqo; Thu, 20 Apr 2023 02:07:13 -0700 (PDT) X-Google-Smtp-Source: AKy350ZTiOYu74cNQe30XrJa2R3nAnGixJIXV0q3jtI4hx8b2/KTHpxnDe4ZFW27cWg4qX3VYRd0 X-Received: by 2002:a05:6830:1d91:b0:69d:7a86:9875 with SMTP id y17-20020a0568301d9100b0069d7a869875mr316296oti.25.1681981633098; Thu, 20 Apr 2023 02:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681981633; cv=none; d=google.com; s=arc-20160816; b=a6oHDSCUE/sTM9miN4ZrbJzwbi4icYjEJdcrYu93Lzzx6nhW/Hmkyv3PAaGKh8nDem g/ZpXVwiVHKESzTcqTfidUmA/5C9tHCO1WCuME90qH0Kdfb0R60qVbyzUSs8Ow2QDQg6 s855Qmue4trQk7nmgLLR0C0nvnSgqyyDCioVMKLWdR0fUspJhglUYKRrLFlJTMrxHLEz mOu69DUjWkPYK+0S55xOO1yjlH6UVKpfSrpbc3WsALh7yyav79N5XeR5jwtc2MyyDTSy /vHcsPCcTDAUf6S4rrM4/5gluHsGjCLFRtEf67fjpZ6vHt2cBWUHuqi1R4njSgq0ZdGu EEgw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f12-20020a056830264c00b006a61b3b30b4si1779017otu.233.2023.04.20.02.07.00; Thu, 20 Apr 2023 02:07:13 -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 S234174AbjDTIyz (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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763685572950884020?= X-GMAIL-MSGID: =?utf-8?q?1763685572950884020?= 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);