Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3407570rwa; Tue, 23 Aug 2022 04:23:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR6zLucL2Z8E2g6X7dWJWxnrIMuSGm9nbiEvN9NhIPTuldaYZwBu59YyRrptd2Ed2Fz1r5ci X-Received: by 2002:a05:6a00:1410:b0:528:5a5a:d846 with SMTP id l16-20020a056a00141000b005285a5ad846mr25283270pfu.9.1661253799467; Tue, 23 Aug 2022 04:23:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253799; cv=none; d=google.com; s=arc-20160816; b=A/A0714g/m6QH0/Nt/i0vDuJRLXyTYXdNDg/u52FbtoSuNjkygOQy+nZJh1idjkyEF ALP5DuXbnpmpNB44gdPn4/ZucYJD6zSnSGCHFZFLVogIH9OcidgaZQ1Zy26mCxMh3PMg W2VDXb91RSQmUU3fDn/09DmPrLxe8wm9CkTYPmsC6eTiLSHUqznt6mvDxfNuPBypfTWF QyjfF95dnytZCW1v8GP5XhvFEXvUm8Uo+lCEQ5w19QPN9YvnQcGF6pyCLzpizvXKnD1r r0jqQMhQoZRSe1GupxoVziESF5X36GEs4S892QfSnuqQQSK84mdDwr4HHNTvHWTirSjt NVwQ== 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=jMxgItAzosXXMp4/TZyyjRH0Sgkgde9z7Z0EDJOiHwE=; b=jYFhDWQwyd1cUrU4qyhAhCshuMdlSpzaWtVLxUHQoJXDSkk+aiEar/QDeTj0fwDz81 U78HN/Iy+lB4MoBKbtaYvN5CXZWBcn8/ZOUT++yKHCfN8ml4iWp6+eQuiQHMykdBY/4r aQcXvp+r0dOIx/2LTS8tSqJK+HHplVVTRRUTu6dSZrJAy2wUWhBWoDAvH7dPNCwaj2KH 5LevsOGAfZo19uQCvDGFDqkp8TDWh6krEGJQoLib+x6CFuYF5/pb049+bfHlcXThynO9 TN8zwHubxuFAEnpbCMzkLqgbH3nBQ7IAVKR5Xo6HOgrzHSBncD5gE0M6NDJEHnh1e7Ws Zhuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B0EmHchU; 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 z1-20020a634c01000000b0041ae6c5b779si14437807pga.426.2022.08.23.04.23.08; Tue, 23 Aug 2022 04:23:19 -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=B0EmHchU; 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 S1356044AbiHWKqU (ORCPT + 99 others); Tue, 23 Aug 2022 06:46:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355371AbiHWKik (ORCPT ); Tue, 23 Aug 2022 06:38:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 245C285FE0; Tue, 23 Aug 2022 02:07:53 -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 B37FC6159D; Tue, 23 Aug 2022 09:07:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C52E8C433D6; Tue, 23 Aug 2022 09:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245672; bh=YmPGrFWk1dIpgcK0xv85HBTh9Bvs1iiimS9xMNqUvAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B0EmHchUB3yKEHUYfbgkmbYm+2ZDl+eYr7ikO/v6le6+1StVQW9thQMancP0ORx/f FtJDWH4zr+63lZSWtguLVa6wGLVfoZcxJRDmjIGm6xLbX5sE1Taq6uc1WF1NIj9LSh EX1GdoEV/DGQGpJi6bEc2EWF2UbmurfMtIkiHNoI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 4.19 153/287] tty: n_gsm: fix packet re-transmission without open control channel Date: Tue, 23 Aug 2022 10:25:22 +0200 Message-Id: <20220823080105.770294137@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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 baadac224c8d..2c34a024b75f 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1382,7 +1382,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