Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3413087rwa; Tue, 23 Aug 2022 04:29:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR7TSBCcp+L8S/70rfWmwpavDVA8LOIRCFik0xfvLJoJyxCrtikHrll3Dd/GwRkfBDP15Sl5 X-Received: by 2002:a17:906:fc6:b0:72f:d080:416 with SMTP id c6-20020a1709060fc600b0072fd0800416mr15916637ejk.1.1661254160894; Tue, 23 Aug 2022 04:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254160; cv=none; d=google.com; s=arc-20160816; b=uU0gcw53JDncnXlTvqkZhM9DNOwGtUPPHXqX8fOJHNsMxARRxb5GLQYlrh/a4kr4Q2 dFTpN2EySUYnnEHKtVXeKRp2l45zDIuHFBkhU+GrW2kcwhEFIHoAncn1h3lTLiX6bsZE WX4ESSrOEq5HOjrkyyDEQpYv6x4Ds9Km5LlOgqrf7PDQ60dgzMA70KadcK7GBtRST64T KsvTdM3LyYFynbekK9LvwbciQErF5uAAhpk06RhBB1Zizo4lGJM3y00M8WKR6RmglVa5 sglSB7fH7xLtmtXH/EHx9jZaA44bAKvQZ7ZA5Vwl8zDKHnCIvjcHo0B5kRtZuijpzwm4 JR/g== 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=AZhaQvfnPm0V8JVjch3B6jQtRB54kS4v0ae1awoPVXY=; b=k1L7+/9/YRbwCGzrQ3/2tz9By4d04HvqthUYm/LZhcS7mFmLqQhLaOxsOOryJRU62T XAkZJEIV2CnzIYZMN++5e1tnAkXiS2cuko2VjA6yo6kuPDZMxs9pslhP02ISUsWMEbS4 ozdL/vhQXcItueTnULiKq91y5cTxLQ4hPD3pm5ZoM3nbhHXcaw/MmEVwmEIJW1/BuX6C jPwmdazAwWMymrrqfkQULdmL9AA6N5h2rJ+cId8V0O6tUnUmbWqtyQkrdxdhbIv4FXIg uaSDFI3oBhRA0OqPM9dFvyv89eHC46GgIEgkf0umEet2WyI5TAOjSitnqLiPQoo0t3Vc NOew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="kXtligK/"; 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 q9-20020a056402248900b00446a3185341si2077397eda.80.2022.08.23.04.28.55; Tue, 23 Aug 2022 04:29:20 -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="kXtligK/"; 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 S1345960AbiHWJzf (ORCPT + 99 others); Tue, 23 Aug 2022 05:55:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245098AbiHWJyB (ORCPT ); Tue, 23 Aug 2022 05:54:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CCF09F76C; Tue, 23 Aug 2022 01:46:24 -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 0BDF56123D; Tue, 23 Aug 2022 08:46:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16BFEC433D6; Tue, 23 Aug 2022 08:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244375; bh=3mDep3EEArUyGh+iEsrWRUzpbM71FoBb0/Y1L3xRGi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kXtligK/Scd3GaqhcqiRY3tm+VF/UoTnL+iqds+Pw1Iy1h8B2HyCbuXJC2mB89+s1 qS3fmVjJpLNOVwLFaVzwdxC6Bk4EjnnfBV1+RWfSH4K8YTDRSkmLeY4osGm093PCQB s5fmPeOk5so8fs5x96Z2LW/Wqci/q85XErlrLe7k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 4.14 127/229] tty: n_gsm: fix wrong T1 retry count handling Date: Tue, 23 Aug 2022 10:24:48 +0200 Message-Id: <20220823080058.268266364@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 [ Upstream commit f30e10caa80aa1f35508bc17fc302dbbde9a833c ] 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.7.3 states that the valid range for the maximum number of retransmissions (N2) is from 0 to 255 (both including). gsm_dlci_t1() handles this number incorrectly by performing N2 - 1 retransmission attempts. Setting N2 to zero results in more than 255 retransmission attempts. Fix gsm_dlci_t1() to comply with 3GPP 27.010. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220707113223.3685-1-daniel.starke@siemens.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/n_gsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 18878ab707af..5f5a7ad4c46a 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1546,8 +1546,8 @@ static void gsm_dlci_t1(unsigned long data) switch (dlci->state) { case DLCI_OPENING: - dlci->retries--; if (dlci->retries) { + dlci->retries--; gsm_command(dlci->gsm, dlci->addr, SABM|PF); mod_timer(&dlci->t1, jiffies + gsm->t1 * HZ / 100); } else if (!dlci->addr && gsm->control == (DM | PF)) { @@ -1562,8 +1562,8 @@ static void gsm_dlci_t1(unsigned long data) break; case DLCI_CLOSING: - dlci->retries--; if (dlci->retries) { + dlci->retries--; gsm_command(dlci->gsm, dlci->addr, DISC|PF); mod_timer(&dlci->t1, jiffies + gsm->t1 * HZ / 100); } else -- 2.35.1