Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3126759rwb; Mon, 15 Aug 2022 18:48:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR7E4lXoCbkqiWOMy8Jb3BHy+g1zi1x4Q8Cc1uvrz2fbQNiRBJM9eIgZLYsJQy19N1rey2JA X-Received: by 2002:a65:5644:0:b0:41c:5b91:9ba with SMTP id m4-20020a655644000000b0041c5b9109bamr16071062pgs.553.1660614485735; Mon, 15 Aug 2022 18:48:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660614485; cv=none; d=google.com; s=arc-20160816; b=ohWZ9Tmr7FXt7581malBo/L3BfYBXK26Mxx54AHDha18m9xSBk3I4tI1im+0yJi6UU fgUO9ibHM/pUjpmFTgLZ2n/4Y/e5kjJ2dKNzs68+KdojHZzVdI0m8Leup4fYGrG4TF4p MUiass7lbrj5Xr+ZO/YBcPba14jhQ7YxJ719H5Qdg7u9cKfWxugIVt0Ndb9fkCqEfetf RQ1HXOcEGWvoZgoAcu6RrlblZLOP0KZXwFZRECubBrfdcP7LVmR4r8EQJjUmoiLZz6qR 1RmP1nXuEVwbUZgyQmwwGy1uy1LrFMDdyp9ZXeBEfGig6Ikl1EpVBJ/aTWMAapZi0le2 tK7Q== 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=gY8dniCXYDuPrvlUbBR9IBl4ISMJRbXPXvuUwcwriBo=; b=FWOqL4YlGM3JKMuK2mkVhTBhnIMTmknDdYsJYsAMsLmv6HAlqmctTmiW71o0zqjSLl vXOKh6Yzlbol1Jq9qM7SVgDSbu+Xq8hnBbn5omMCd2HyuzYUvQrVHxgGRRNZ4XamC6hH zv6pAwFS7I/fuoRAWp1dm9KThKmZ9crNWTXlzVhet2SA4pldTHbU3z5/cxXLaPMuXzXa FqFIQ2UXfy70/7Cqw7wP7iMOPN4C31xuGGvUvAwdslMePr3yCxLLKTPIEjyXIkdoOszG u+KUxhDc633AsLtf3dzeOee+Szcm/78tUB12RVQm06/+wvIVvrjvwRr5AJoLg+CXnVzo a2wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eGWRQX33; 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 r83-20020a632b56000000b00419be2b2b2fsi12571262pgr.735.2022.08.15.18.47.54; Mon, 15 Aug 2022 18:48:05 -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=eGWRQX33; 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 S240285AbiHPAo5 (ORCPT + 99 others); Mon, 15 Aug 2022 20:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350895AbiHPAmE (ORCPT ); Mon, 15 Aug 2022 20:42:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95CE9ACA3B; Mon, 15 Aug 2022 13:40:04 -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 ams.source.kernel.org (Postfix) with ESMTPS id E1DF6B80EA9; Mon, 15 Aug 2022 20:40:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34EF5C433C1; Mon, 15 Aug 2022 20:40:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596001; bh=tUPLCUTkgqwBFKrjziJpQTyka/orLefq/dUbfZbUVHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eGWRQX33HZ5fA9lg+oKP/Nax9YgrJbfvgWtF2FzGRdI3WDwysIclTxOhXpRKvesoq 8MvfCIp+r4P69GBcLqI2x8bAqdjp2EOolTof6CK+aDye7kczLicML9WMVZMXhITcO6 x/o5swsq4txo/hQyY1mCNu5hshO/dgyU+oHvnzNs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.19 0943/1157] tty: n_gsm: fix wrong T1 retry count handling Date: Mon, 15 Aug 2022 20:04:59 +0200 Message-Id: <20220815180517.257465629@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 ba399a660573..1a70e7ae90cc 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1805,8 +1805,8 @@ static void gsm_dlci_t1(struct timer_list *t) 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)) { @@ -1821,8 +1821,8 @@ static void gsm_dlci_t1(struct timer_list *t) 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