Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3016328rwb; Mon, 15 Aug 2022 16:12:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR7w0RQBRyJGdrVfFNyUlVLvVhESxWuB2E6oeN4gQYOkL2l+D36XRjTBmRk84gR/W1V82PcF X-Received: by 2002:a17:907:2854:b0:731:3c34:b5ed with SMTP id el20-20020a170907285400b007313c34b5edmr11535073ejc.437.1660605162085; Mon, 15 Aug 2022 16:12:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605162; cv=none; d=google.com; s=arc-20160816; b=dg0UawBg6Vou4maXLqUISY/4KFgbRX7e0By4KY9TVI7ZGp0eoCWTMqCY4ML9KNb/Jo J7XIyLG0DSJbKW2duyqY30FgJwGxlo9GJC3NmxLhoE1VN4A0Xr2G6VqBZTa0hItWqmZ2 nfjI710OaN8fYgoDJPRUnjz9lVJuSBvRGvUka+74sIwvINqiFIOvF3CIQfzcc0uovPPv L4zq4fmJMxJimSdjVFqB+7PKEjUhRXHbqI88GX5a2ix9BLwOCEcPfr/zrCaJ689qVPMY PhFLogh07p9PrckD66dood0CsMiveCdmdAqmXsXvgfAm9kCfwYilm7EDBlZbkAfdQi40 i8EA== 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=aIVFFOG1Pv06NNTCbpCZ/6oCZ10+R9BYyLXKkGq3meA=; b=EXWIv6dtDV6WZrRYB5UpueZ5MOgaedZwM+U/+mQ7LBxpWTzigD0B63ndGRY6cw11bV 5uOnGJwO2hhn6pi78FIaB2nxfozoAz3+Py3yElm7lLojcZiaMrnIGWoz62shEubvmf9e Ac1yhKlc3lSIx+Nrnn+D3PiDbddJcc1NEvlJsnsibmabEKmgxSx12GQiAf0pgFnVRzk/ GEKmGeN6nhMvUYCJme6j73T4+V+lEuTVbAaADyQl0y1T+m5xgx6AklMByISH1hGdLltg X62exUGn+JMIxOuY+UOPrVRuaEQM/8c/oUC4NW/V9rgekfpspqGjieef/NNtl6vOGJed KS1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mddXANWp; 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 sd5-20020a1709076e0500b007330a081f1fsi8531883ejc.679.2022.08.15.16.12.16; Mon, 15 Aug 2022 16:12:42 -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=mddXANWp; 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 S1350431AbiHOWjb (ORCPT + 99 others); Mon, 15 Aug 2022 18:39:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349370AbiHOWcz (ORCPT ); Mon, 15 Aug 2022 18:32:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A53F71726; Mon, 15 Aug 2022 12:49:22 -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 B90C260FB5; Mon, 15 Aug 2022 19:48:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACE3FC433C1; Mon, 15 Aug 2022 19:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592930; bh=qugEq5AH7Mw1dkYBi+7kXa7GsbL/C2gowS+hGLws7/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mddXANWpv1PnJRCSTAdQtF8lms2EiM6RnY3w2EOfhX/kE9fYJNvh6MgVRy3Yyv5/I RvMZcxM7gSxrnuP1veOXAs3KkB0rn6kUDpvx99SdAdhyG0fAg0JMaCkOHbuoncdZuK 8Qrm0hjVtBoPvZQP8hhCMMmSPunZQi78q77VM/58= 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.18 0859/1095] tty: n_gsm: fix packet re-transmission without open control channel Date: Mon, 15 Aug 2022 20:04:18 +0200 Message-Id: <20220815180504.871703687@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 83ec596bba93..e95004217292 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 = 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