Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3122346rwb; Mon, 15 Aug 2022 18:40:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR642ukfD6KiuNxCCKVpkoSSXtPDTll7QbtQJXU72Msd69noPwu6tOy2FXciSe2c1CZ4cL8o X-Received: by 2002:a17:907:6088:b0:733:1435:fb07 with SMTP id ht8-20020a170907608800b007331435fb07mr12135951ejc.306.1660614026754; Mon, 15 Aug 2022 18:40:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660614026; cv=none; d=google.com; s=arc-20160816; b=TVJO62dX3e45uWOhLBhk7KLNGeaR6GfyRMXu+9PmsYZh1x6IK5c9WSX4g7pocqnyCI m9aSBxGKxIBAZ7DXx5BluF2W7LSIyOHt2lbIm7jU8PrhhTrQHEa/SLokGoUdKqhTMeKA QV1QyKSYnImkeFPwI5R+/MnvvEV9VkJX177QwamZp6f5pM+lguVS85H6rd5TjqP+3iQM 8PedbFW9JNAMeT1kTS2TpN2mYM/J4fEEa3CejxCISbx4QtPmDROACBrUgRZqSwQTmP1y Dj8G90ipoIg3Hnum8eyNKwDVPOH2Dz3KTSHJZ/VOIxns11LzziPO5tw9oMbiRN3lW2Uq b0+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=L2Um5vIgqMjBzOdtwlHxIdzsv/amVAGC5LXL6ks1p4k=; b=LYDkCfjl1syXNkzRhG0fN9KaGji68w/pIkvoCoC6Ji+faJy2p/6147/KDSoMWYZgLt 62ORuP+iElBY59/FwDKf5+lW53zN9AYfuDLlIjtmTsuNPZ/nO96HX6aj4fHmYwDS2Df8 C4SHfIxFSlndkI0ImiaMCf4spLRZQ1aj4PknX3p6e/qArHYc9dTustzxSmn/uHBxfACu ueU2hLAbmLBT79l2j366860aOIPYnfp2H52C6sgXDroABDRuJhni06jp0yzo0epgwxKD 761JprnkPjwYdlfo506zBrDBctXzquFIkAjO8cJ38A1FHMw4GUrfxqHMMrTnyAK8selI 2zOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tN9Ny+aR; 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 h4-20020a056402280400b0043d100bcf3bsi10623486ede.538.2022.08.15.18.40.01; Mon, 15 Aug 2022 18:40:26 -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=tN9Ny+aR; 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 S244706AbiHPAn1 (ORCPT + 99 others); Mon, 15 Aug 2022 20:43:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349384AbiHPAl0 (ORCPT ); Mon, 15 Aug 2022 20:41:26 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77A8A18F5AA; Mon, 15 Aug 2022 13:39:30 -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 sin.source.kernel.org (Postfix) with ESMTPS id DE8D1CE12C6; Mon, 15 Aug 2022 20:39:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE102C433D7; Mon, 15 Aug 2022 20:39:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595967; bh=v1TmxYTRpANDeqiY7jjrSy2/3BnmPzasSFCbmur9pLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tN9Ny+aRmBAknIZyISdbSVp1yIe25vjNJzZltU1pZSIaSZBLY5sbR4JOcrC+amBj/ 4wIVHNpnBjOT4stnXkRjbjHYizQe2a1qBUI5sZ62gDgOoR3rstpbEWqdQeJHMcAGmQ doZUZSEcry/QzdXiUX5T3FKJTvskiA4W+w8ulFio= 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 0930/1157] tty: n_gsm: fix packet re-transmission without open control channel Date: Mon, 15 Aug 2022 20:04:46 +0200 Message-Id: <20220815180516.682535423@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 4fae831b3a71fc5a44cc5c7d0b8c1267ee7659f5 ] In the current implementation control packets are re-transmitted even if the control channel closed down during T2. This is wrong. Check whether the control channel is open before re-transmitting any packets. Note that control channel open/close is handled by T1 and not T2 and remains unaffected by this. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-7-daniel.starke@siemens.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 3f415b2fa199..39359274096d 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1532,7 +1532,7 @@ static void gsm_control_retransmit(struct timer_list *t) spin_lock_irqsave(&gsm->control_lock, flags); ctrl = gsm->pending_cmd; if (ctrl) { - if (gsm->cretries == 0) { + if (gsm->cretries == 0 || !gsm->dlci[0] || gsm->dlci[0]->dead) { gsm->pending_cmd = NULL; ctrl->error = -ETIMEDOUT; ctrl->done = 1; -- 2.35.1