Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1875906rwb; Fri, 19 Aug 2022 10:53:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR5jCnEDsOR4txNyKAduG8eaW8VtVf5zy4Ot3V9EAz5Id3LbpouuJ9g6GzxbyrylwKpi+opw X-Received: by 2002:a17:90b:3889:b0:1f5:88cd:350d with SMTP id mu9-20020a17090b388900b001f588cd350dmr15326444pjb.9.1660931589647; Fri, 19 Aug 2022 10:53:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660931589; cv=none; d=google.com; s=arc-20160816; b=XGxtagZeXO8Gfhb/XssUO+NoGMhovQ1hCNIvNYyij29p43ysaeMh03Dqjb9+jHexyK e43J38MXdl0zY20KooWZzNB8BbzFaqXksT4B6GweodAOtV4qKfX2TO/VJ7V3JECKY0cj kZHEivYLRKJfUMXaBMGXz0FW8+XuOlq96iexhRcMJHIwqNL0ioAXkjW06K51sn1q6FUc yOQOB9Jqw01EdzQvGUQs9PI0PCYDA1OjB5XamFLUNoEc1y+3WjqN9C67Ra8hHsGXF84P VfmEDw6VMiIvkMixvWX85vmQCobOZnwzKfeGoFDLkasYbOHqdpEcaH2mTU5rnbpnzL3D nR9Q== 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=GSa52CsOk/9mHqc7zhramuOtxydyXpZYtQGfBonaVlI=; b=lPgq89WIQ8prKN23cGaV87SI5At0wixwtOQPPh8QaIYJbPWYpbanh3hZfRZEtTZ0zl VKYFRvzE/QS4pKoVB9GOmmnafhWdqUThuUM4drfRyvddlNADFy+6OirK7LOSNGdjUtUD mzfqq36SndkeJr5nrFWQdgYUHIR7kp+5xVOtROS+RbeRC65K1E3BHvWNq15I/EzJxpTT jo3tsWrdmOgBq0CAGF1B/m5NIV9qNp6SDLBey6+Qqjb1tG0GfMNa64CUYmuiyp0sqmgW /o/8p4AwNdAglViCLT554tWuP9514cfZfOJEjZpXKvku76dVD5/HAX28hNo+8iWssK1L FMWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sxm9KeVG; 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 c8-20020a630d08000000b0041cda7ee9acsi4547440pgl.417.2022.08.19.10.52.58; Fri, 19 Aug 2022 10:53:09 -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=Sxm9KeVG; 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 S1353167AbiHSQdo (ORCPT + 99 others); Fri, 19 Aug 2022 12:33:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353113AbiHSQai (ORCPT ); Fri, 19 Aug 2022 12:30:38 -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 3991E11CF37; Fri, 19 Aug 2022 09:05: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 dfw.source.kernel.org (Postfix) with ESMTPS id 0BFBD6181B; Fri, 19 Aug 2022 16:05:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAA05C433C1; Fri, 19 Aug 2022 16:05:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660925103; bh=/zEdtsTIMZtBod26zAP0r+tf459yO0+VwCRjbNtJLPo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sxm9KeVGfLpnX2eSHXVJI+p5077WDDo94MK+XUSRBioyZFpHEJ6mX3Ihtkgnl3NiW WYW1bAJaLMwoueNRLXIKC9woYhjQQySEHLfcB/qbbFOAGTHbZgHBRRLf+z/FAWZtoR rcpjUi84s3JwIzLfAuiDaWylNeHhj3pogtiyywFU= 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.10 385/545] tty: n_gsm: fix packet re-transmission without open control channel Date: Fri, 19 Aug 2022 17:42:35 +0200 Message-Id: <20220819153846.638308633@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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 fe14eed0aa2e..b4cce5cd0e3d 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1388,7 +1388,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