Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1215232iob; Wed, 4 May 2022 17:42:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9uzbr6e0oXtYHYVT8k78rq84W4ZdFEhPwRuKqlW6cRjj91NZn7vvKXu1D+mhwCekS1M1a X-Received: by 2002:a17:90a:8044:b0:1d9:7a6c:38dd with SMTP id e4-20020a17090a804400b001d97a6c38ddmr2746585pjw.156.1651711349574; Wed, 04 May 2022 17:42:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651711349; cv=none; d=google.com; s=arc-20160816; b=E0COU4gVnqBQq+iz4bVv6RGSfL3dJUwDtk1+PeJZVuVPSusQryBMLSGC6HKPMKZQTm /hmXbkbJyOFUFHHrN2bH4kCMgH2Bx3CRbJ/paOCSsLtTHPI5Gi3jNwsDgRrLPcShjp5R lHAjLpYLR80Vrh2R364Yj678M+P6UsjG/O9yMQ5GEeCIA3B+13BPmD9iNtGcgytIAxFW MbR2PXsPX7it/ThewxqwMRylGNK99UK9SsWdImnt6eUPS8oemAiZiUX65CWJK/g1lEHi +ultmQlCGDlwdbFsC/w5E5tFmWkvyCpnR4Bb6Mt+/dSiDq859dQTF+BdywyUzWevh9vq SARQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ISOI1Z0kh3Qvp0gO+cYeH8R7LcDOF/83SZiBx/rqHi4=; b=QPdx09/GaJQbcx7zG9upbEqmCjjgdc7r4qYhSkmx67jgKClCY6w3O14HI2yCJ7IQSv DT5u0dlieEgMBQo+ou9VmAfuhZDhxUBbH6OoFvd+Rvl1HucYm7d2RN2KTxROGDuDdMQ4 u7453FGEeBWCaRbIfWO5dUqux0mNEvgYWPdyNgyMEznkEdD35I7NswTEHTp9uc2e/bHp nfaWUwH4Shmo6YGFSYpolKgU9zOOSqvfXvpS8SmoKR12nP95pFcw/IvSuF1O71DAOX6i 8MqjspUl7cjXmjozDXik+CgukPLORpJJhPuNztUpq7ub6wUtCZvPvAgwBcvGSveRoZ/4 yoMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0tf1kj0w; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mw7-20020a17090b4d0700b001d95e5439f2si418324pjb.46.2022.05.04.17.42.13; Wed, 04 May 2022 17:42:29 -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=@linuxfoundation.org header.s=korg header.b=0tf1kj0w; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355684AbiEDRm3 (ORCPT + 99 others); Wed, 4 May 2022 13:42:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356504AbiEDRJR (ORCPT ); Wed, 4 May 2022 13:09:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8CAE4A3DB; Wed, 4 May 2022 09:55:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C2ACC617DE; Wed, 4 May 2022 16:55:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D1D5C385A4; Wed, 4 May 2022 16:55:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683308; bh=/5CcQMipvtHUQTk/m1gHS7QbUj6IB812HRyP3TwC12U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0tf1kj0wsCguahC58TqBsOz1hqdSmbol9qLG0exxb7A/+j/EIV8Rv8/McLXv9Lyed hh43xetgXdl7Viu/zDVccy27/17r5jJkuSSQxmW1w8oXLUR/076j5bpTL6neS7XS7p t9lhqyPY1kvxLyXVikxs/KQt8dZ968MK8PjeznuA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke Subject: [PATCH 5.15 160/177] tty: n_gsm: fix wrong signal octet encoding in convergence layer type 2 Date: Wed, 4 May 2022 18:45:53 +0200 Message-Id: <20220504153107.801052455@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 From: Daniel Starke commit 06d5afd4d640eea67f5623e76cd5fc03359b7f3c upstream. 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 Link: https://lore.kernel.org/r/20220414094225.4527-5-daniel.starke@siemens.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -820,7 +820,7 @@ static int gsm_dlci_data_output(struct g 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);