From nobody Mon Sep 29 22:46:25 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B56C9C00140 for ; Tue, 16 Aug 2022 00:43:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244817AbiHPAn3 (ORCPT ); Mon, 15 Aug 2022 20:43:29 -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-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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@siemen= s.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 =3D gsm->pending_cmd; if (ctrl) { - if (gsm->cretries =3D=3D 0) { + if (gsm->cretries =3D=3D 0 || !gsm->dlci[0] || gsm->dlci[0]->dead) { gsm->pending_cmd =3D NULL; ctrl->error =3D -ETIMEDOUT; ctrl->done =3D 1; --=20 2.35.1