From patchwork Mon Apr 24 07:52:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Starke" X-Patchwork-Id: 86899 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2587613vqo; Mon, 24 Apr 2023 01:31:09 -0700 (PDT) X-Google-Smtp-Source: AKy350bqUKNvjb4LMMCotBC8JcaVQzyvARDqcutHBURV7vJZlCy42aQsEofXRhHR+s48XnhVHfRi X-Received: by 2002:a17:90a:1481:b0:23f:9445:318e with SMTP id k1-20020a17090a148100b0023f9445318emr14542403pja.3.1682325069135; Mon, 24 Apr 2023 01:31:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682325069; cv=none; d=google.com; s=arc-20160816; b=l1dB6+8ECyAYOx77Ful3OSji0RCUO7m9Y/t4P10BrGhdIwYqd5WMwyL12x63B/+34o G87ncuDaj/WCqIRW00v6dUCB7VqeSffibe3euSaQ4farpLdOP+NEbT+cJ5C5OsVY/Anu pTnWFnsO8xgtdHzRtLrSFGrVI335gpvG7fFWuwBDKLxGf824AnyEeyBGhMryNamKiJ18 J7wGQQz0A7Fj2h4gz6LY8IqN8nG2rr8bC3SE1FdgKzI17jnykEXyf6WO/tFFilHmoL+f SUIzcNQjAllX25JYZqVq8Lw+b1+E1VAoiprRab5cij6UQ+BCPOIQQ4KOJCxyAxJkX3nH z+4Q== 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=qjQIn+HvmVUrb5AZ5u0C0kEC4MtX+YXbuwEE51kPmJA=; b=H7M+LB75geYdLGPLF8FPTK7sV32NWEZRJEatFXlC5DKaUXC7YCha02U+z3CId3lX8e HkzF4cPKAiKDu4bkwxrY0MVpyLjW6bVTvdOIds489uU+m+0URlO1S55FgEpvXrm9QaQP nU8Z6TfCy2Ak60RywSbFukVJUsFSAwmcXZQwwK8SP4bNCjPh0uFtH4nUb48lu9MvfW0A D5DvT4u6wYIGg7JF3/xgEmDvXb7M1xJYLpyMTjQqukE+UezIEH+NhTSPVbYk1E9o4w83 JBMvvy1Y8r3yEH2x3Xz154NbbA/NCSBl7z7v7445yuAKH1Zm5ITkLu5ZQFgsP04iJIPx BLrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=g4ekPUt7; 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 s14-20020a170902ea0e00b001a2104d7075si12066291plg.72.2023.04.24.01.30.56; Mon, 24 Apr 2023 01:31:09 -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=g4ekPUt7; 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 S231472AbjDXHyp (ORCPT + 99 others); Mon, 24 Apr 2023 03:54:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231149AbjDXHyk (ORCPT ); Mon, 24 Apr 2023 03:54:40 -0400 Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net [185.136.64.226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D3B610DC for ; Mon, 24 Apr 2023 00:54:38 -0700 (PDT) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 202304240754368306ba2628ecd55b54 for ; Mon, 24 Apr 2023 09:54:36 +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=qjQIn+HvmVUrb5AZ5u0C0kEC4MtX+YXbuwEE51kPmJA=; b=g4ekPUt7DHKdgaD2w3+YSP4VEx3pM64I89/4bb855ICW1UYYY7HE40PG0e1uIkdr40SIG8 grVnfQnDP4Nj0sLMilqJfqvjSQUmkpSvWtMcwIVJdbd6c8LqYvO9r3EdxKmw8QmWkYASTBMq xnw9dr6jWG6M4/XFjoq1ANZbiaP4c=; 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 v3 5/8] tty: n_gsm: increase malformed counter for malformed control frames Date: Mon, 24 Apr 2023 09:52:48 +0200 Message-Id: <20230424075251.5216-5-daniel.starke@siemens.com> In-Reply-To: <20230424075251.5216-1-daniel.starke@siemens.com> References: <20230424075251.5216-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=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?1764045691564693068?= X-GMAIL-MSGID: =?utf-8?q?1764045691564693068?= 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(-) v2 -> v3: No changes. Link: https://lore.kernel.org/all/20230420085017.7314-6-daniel.starke@siemens.com/ diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 6b6fafb1098a..10fc02133efa 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);