Received: by 2002:ac0:c50a:0:0:0:0:0 with SMTP id y10csp982894imi; Thu, 30 Jun 2022 23:45:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1spEThbWhycXuJJYmrbEvdHsVS61VeE6zL5YG2G9/c7HxWQRz/hJh+CmBx4wRa9+6c9Wmnr X-Received: by 2002:a17:907:a427:b0:71b:6f0b:8beb with SMTP id sg39-20020a170907a42700b0071b6f0b8bebmr12714631ejc.496.1656657952295; Thu, 30 Jun 2022 23:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656657952; cv=none; d=google.com; s=arc-20160816; b=DGZfQiGrAbDRk/xsxRQb8Rt2C911t4R6AbvyLrsrjaQ8MgNwOMMBpuT2KuSt6V9CG9 vR88D8ZCseUPvn2WhzHgeGiFLQM2l6OuNAntLzC3DebdCMr9uTAt1Jdy5yL5+uDffeqm ypqClLXkdf1+MB28yLUEcbdrDrsyVFs144XNBDGLPTnwtdgRyx0hRqXHtv90RtM1WFTE W8rCCBopZdvHDKDuLL86Ae7qCscB/SWxFpzdc4uzxM9XhnJJykZ4k7SAEa8N3HuVsr86 4rQXiTk7fTcqAq8YgLpocvgiKpHgh9RL4djmHctUyySzLJJ1IoB87E1eVdzTKyevhL2k lrAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NZItoV2JfrOEDSXsB/rFEb+ZXLjiX0JTl5KZWK01kx8=; b=xcsPVp7ZYCPZQ5aUDujGu39VIP2xx1x5BSrz+iF0vOoNI1dsD0+WGiET+I8u89H/lK 8R69YBD/P80YS2ZB8wCSWERcekJUb1OlJBB3HoXBeBZQVp7PZaZe9LDmpnQTLzt1Ehie LlUOoPTyO2d7/jYiithOnhLtTMAckKz1kqqdXE2W7sM2I94JQImLrFIFYeu1SCNXw552 khR40zifbYSastB5Rs93dc1NyDqCXyYGhGbbgz69K1Y/9dNGeMqyMUYceiRvYfHBJwKL OuDbUvcd+sjGfeDt/l0ZfdaH5XgCuFQEx0yCPPs6LvJN+fpKjKdLca4T/r7efU2cTnM5 nxug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=AjOZCN1o; 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=siemens.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw18-20020a1709066a1200b0072a6b4767d0si4733678ejc.793.2022.06.30.23.45.27; Thu, 30 Jun 2022 23:45:52 -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=@siemens.com header.s=fm1 header.b=AjOZCN1o; 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=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234835AbiGAGTU (ORCPT + 99 others); Fri, 1 Jul 2022 02:19:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234820AbiGAGSo (ORCPT ); Fri, 1 Jul 2022 02:18:44 -0400 Received: from mta-64-225.siemens.flowmailer.net (mta-64-225.siemens.flowmailer.net [185.136.64.225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4AB7369E7 for ; Thu, 30 Jun 2022 23:18:40 -0700 (PDT) Received: by mta-64-225.siemens.flowmailer.net with ESMTPSA id 2022070106183828c168a7588be0ede2 for ; Fri, 01 Jul 2022 08:18:39 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=daniel.starke@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=NZItoV2JfrOEDSXsB/rFEb+ZXLjiX0JTl5KZWK01kx8=; b=AjOZCN1obWj1cbB5EjyhXANHyAepWgti+u2MEKcwDlFLCW7X3HOnkqgwdc2qLeoVFWCHMT g1QsG51ap3zJO22uIC2WXuig7J0QOdu5lb8cfRB51l1VKr+B1ItV/yiuXjj8MZwbDYnCORio 25ubbSvA4yrkL2MQQvtZV5xJSbEY8=; From: "D. Starke" To: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: linux-kernel@vger.kernel.org, Daniel Starke Subject: [PATCH v4 7/9] tty: n_gsm: fix packet re-transmission without open control channel Date: Fri, 1 Jul 2022 08:16:50 +0200 Message-Id: <20220701061652.39604-7-daniel.starke@siemens.com> In-Reply-To: <20220701061652.39604-1-daniel.starke@siemens.com> References: <20220701061652.39604-1-daniel.starke@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-314044:519-21489:flowmailer X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,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 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 --- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Stable backport remark has been removed compared to v3. No other changes applied. Link: https://lore.kernel.org/all/20220530144512.2731-7-daniel.starke@siemens.com/ diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index b82efb63f4e6..9e4ada510c9f 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1624,7 +1624,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.34.1