Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5784027ioo; Wed, 1 Jun 2022 12:31:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7/sDSxCeEn0w1MVPApYFHPxw5dEO9hkgps1nqUb5r94g1Z+0SbNOFAHouGasOVFLXv6Wz X-Received: by 2002:aa7:8008:0:b0:51a:cae3:7563 with SMTP id j8-20020aa78008000000b0051acae37563mr24321426pfi.16.1654111884826; Wed, 01 Jun 2022 12:31:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654111884; cv=none; d=google.com; s=arc-20160816; b=Vj+3x3y9avaQUYEMAQaiY8QE4y7q5q1eIsoPN9eKrv6UW/Z+YerLkQ5JlwX2a+mh4L XqCp5AqKVfueiPMBn3/ColXKp5xN/jzU1JqKPZnibJxp7jJfBIcFMMO4DOKI6bvBUdxp 0ZJwU5zEhmch+27VmiPUrOhRqIavwhf1RMyNr0lbT0vXec6SuCyYhTuE9U62R/DZv6AK nDjsu274QeqV90xHTwDhx6h4QyVzv1d9APxKVqbCWvyuqHI7v6po4AGagPvtMc1F7sXv ycE0mIeD8vXxIrXgnC7M6wAABUWt12RxWkmQoYuwG8AdGTDSfNfnQ9qJ5lJ3AWyeZeyA mf4w== 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=UJuQVbGzL7rw+17ZXL97cqh0Je+QI5cDnhvQmUFGp38=; b=MynaJmUPKRS3xGmc2iFu4wq75oWDroDcaidpb1gOfzZIP4lFov64oaMwHrEVN7s12o QnQbogpwzs9DQhAePsdj/72pBKrTn/vD5fLZfAlSrvgboTAObfAR86kyyMPTbVhN+DRB ris+7zXppd2E1zeFQmlclNHLIlGfxx0qLg+6BouJSSQussPCVJYlAtK7CJVJLZAMKrQy OmRBhgUH0pwTx6Efjhl/EVNePijcGDyQqwPn1NYo52s/mI9rpH9JyxNFoo50N2GMmNZE 1VENevT9CzXyfyv5AjhQa+1ZG6xZ4Ic7lx7h6QwlLGfnogD+YAreH0maSI/rwWom+Cer oYOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=fvi4+WId; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i9-20020a17090332c900b00163ad368fe7si928385plr.71.2022.06.01.12.31.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 12:31:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=fvi4+WId; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3838563AD; Wed, 1 Jun 2022 12:01:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238941AbiE3PjU (ORCPT + 99 others); Mon, 30 May 2022 11:39:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238641AbiE3Pi6 (ORCPT ); Mon, 30 May 2022 11:38:58 -0400 Received: from mta-65-226.siemens.flowmailer.net (mta-65-226.siemens.flowmailer.net [185.136.65.226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B5EB69B73 for ; Mon, 30 May 2022 07:46:46 -0700 (PDT) Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 20220530144630d17b30635b74043a1b for ; Mon, 30 May 2022 16:46:30 +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=UJuQVbGzL7rw+17ZXL97cqh0Je+QI5cDnhvQmUFGp38=; b=fvi4+WIdTxAgGA9Ind8Jmq5ooknKaltqiBelcsLSUrkUkXuGkeqdGELoIKeq+2XH2g77O7 m+XQGtyRFs3vopcNVUcRiQiyc1ELky0S2IQbUhNl0pTE6/vGhRX3CBwp2QuA9ZlZRha4uR+1 +qhGcB5VqOys8vUjiqZUTiulaIjy0=; 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 v3 7/9] tty: n_gsm: fix packet re-transmission without open control channel Date: Mon, 30 May 2022 16:45:10 +0200 Message-Id: <20220530144512.2731-7-daniel.starke@siemens.com> In-Reply-To: <20220530144512.2731-1-daniel.starke@siemens.com> References: <20220530144512.2731-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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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") Cc: stable@vger.kernel.org Signed-off-by: Daniel Starke --- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) There have been no comments on v2, hence, no change was done. Link: https://lore.kernel.org/all/20220519070757.2096-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