Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1500786pxb; Thu, 14 Apr 2022 07:31:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSH89pal4nzoBHwAYzQkBkytLggzXx/RelaUxxpUKsIoQFYo3A0Tx+jNvJUT7qlV0F4L7R X-Received: by 2002:a17:907:2ce5:b0:6e8:71a7:5099 with SMTP id hz5-20020a1709072ce500b006e871a75099mr2591905ejc.264.1649946660830; Thu, 14 Apr 2022 07:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649946660; cv=none; d=google.com; s=arc-20160816; b=num/+I9vdxUpyUklSu2qf2ZN+z7fKarC1XfEOvkF670vRFJKNMwpBzBI3BvcgUYhpY f+hdjKu3uSTgQNUgZzMZfVqJ1ROF/4USzg11H0wV9HPkjOYW9M/s+OCx+5HR2lPllVhk 5a20P7rZuvk+mmaR71hSVZWOd6LnBQQCTU29odB5pFS1xIYu7RmroprwomVLdKTe7smo 6zcU2N7Evp9htTX4pPbgv+BqrFRIJf4TB2BQ//lcT+u9gZJedDz9QPkRQ5Ou9nV/Exdq +Wv/G5+LGoaFWyFb6poJLz0FpfBqN4qliRFBW35WxxENVGhJYIM/HJypZb4YRFRiud43 uf5g== 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=JjX0QExE5G0gdz7UMXnS8e0N4K1XjQpP52q6ISsyKsU=; b=p5wR4CEyRfTVgVUjPZ3QAt0J4lvje+yVr30akPKUcRk0DsBiTp0wK6F2mlgeq7tQGw 69dchQQFEP8JU4WpmdpcYtM9FB0wiG2DmoyETBrVNR61jpJvFvQyw57EzrU/LeRrXOxc f8hsMrAU5wXfB041FBjU/NIlE2Nk/jaX2c9xJOFOmU/x4CsH5tLK8S+YvJc27c/tYqFO tBeXzTeldzaRx1hjE9zIq+hzQ5wDL2k/L6Hbtf6GDEZSUG9zdCShW+c4oBPxz+siuGsO 6Max5H4cNDYmAlZYkPmYsunJxWb7oxARuFIv40V8zz5e8Sy2BV4c7A9KyDYH5Lgeh8v9 K5jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=YFV5IXw4; 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=siemens.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ec15-20020a170906b6cf00b006e8050c90b2si2061361ejb.505.2022.04.14.07.30.25; Thu, 14 Apr 2022 07:31:00 -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=YFV5IXw4; 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=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241950AbiDNJqc (ORCPT + 99 others); Thu, 14 Apr 2022 05:46:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241432AbiDNJqP (ORCPT ); Thu, 14 Apr 2022 05:46:15 -0400 X-Greylist: delayed 62 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 14 Apr 2022 02:43:50 PDT 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 8785C7004C for ; Thu, 14 Apr 2022 02:43:50 -0700 (PDT) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 202204140942429350bda5d4c4744145 for ; Thu, 14 Apr 2022 11:42:46 +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=JjX0QExE5G0gdz7UMXnS8e0N4K1XjQpP52q6ISsyKsU=; b=YFV5IXw4YFUyNLztxoQnz4iwDHjU2ZZ7ie3Yvvn5YDEXtidCy8U1db6wpK47Kzd3mecqGe GLMIjIN03UMbs9aDhv3ztElAX7nYURG7S61RPancztV4uzuyo8HianLsTIAbwhMMzWQlCIOc 7yRp2aaB+nIUnJr6xLxtwdXEBGQvg=; From: "D. Starke" To: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: linux-kernel@vger.kernel.org, Daniel Starke Subject: [PATCH 05/20] tty: n_gsm: fix wrong signal octet encoding in convergence layer type 2 Date: Thu, 14 Apr 2022 02:42:10 -0700 Message-Id: <20220414094225.4527-5-daniel.starke@siemens.com> In-Reply-To: <20220414094225.4527-1-daniel.starke@siemens.com> References: <20220414094225.4527-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,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,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 n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010. See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516 The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to the newer 27.010 here. Chapter 5.5.2 describes that the signal octet in convergence layer type 2 can be either one or two bytes. The length is encoded in the EA bit. This is set 1 for the last byte in the sequence. gsmtty_modem_update() handles this correctly but gsm_dlci_data_output() fails to set EA to 1. There is no case in which we encode two signal octets as there is no case in which we send out a break signal. Therefore, always set the EA bit to 1 for the signal octet to fix this. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Cc: stable@vger.kernel.org Signed-off-by: Daniel Starke --- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index de97a3810731..3ba2505908e3 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -832,7 +832,7 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci) break; case 2: /* Unstructed with modem bits. Always one byte as we never send inline break data */ - *dp++ = gsm_encode_modem(dlci); + *dp++ = (gsm_encode_modem(dlci) << 1) | EA; break; } WARN_ON(kfifo_out_locked(&dlci->fifo, dp , len, &dlci->lock) != len); -- 2.25.1