Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2875052rwb; Mon, 15 Aug 2022 13:05:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR6nyYLdD5mCFUfDBVapud4jCrqTIHOea4XDqP25d5xmHcrFITEmrnp0jkIVdkeQarnO1EYs X-Received: by 2002:a17:907:a064:b0:730:726f:c62c with SMTP id ia4-20020a170907a06400b00730726fc62cmr11428553ejc.86.1660593943566; Mon, 15 Aug 2022 13:05:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660593943; cv=none; d=google.com; s=arc-20160816; b=t7e9uGmqyjBTwAkwIS+J7FnLoIF1VMGw8MUy5g7LKNhhSpNHfiBw9gwtwyLzBjRAAC Ji32GIY7G3yhsQvB3Fnsvfq2gJS2VlJkG8MUppb9XMD2wr+PhZqk4yFPcZ9td1b1jZ0t bz2ENUstMOl/7JKL0wflf/gAQb9yufqOLBaQyWlvQDQelz59UAlGnaC4U+6mXX/qBevq cBytMDgI30QGqgCgUYeVaUF185XtKg1u4Km250R2xjBoNNov381HXQrwde1C3U0VW4yo A7jZH3ZX7nPJD20SeF2vHHIjKuL3FV+SilrZPca7PN9oQuamkcXG5WdOBoqr9GL3+IC0 vEyg== 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=GiRCvR+2+dPQaoLvUjC2UX3PMvDqddzZFYX+btTFkx0=; b=nR5lsY+/OaizNXNbWjz70Sb7dFRploU371qacc/hoGzAEGLnQcLtkxmLA/5ZVLjRvA aqaGmSufMz23GOFooFbJ3UUqkPsWb7h8kebi+RiXayp4YiWm9Wm02zc9RTI4v2SEko3v jFGcAmU95jNpO9WMdf12dwhiBQcOfBBCaDw7G/8FDhttjIDj7MZCjkautYdy5AZJT4Ra Ia53t1LMjyzMLPetFl5FSkuik1HwNXVq2tSfp9K8P40bLr5ouM53A5JYY/zvq2uBhfgA Uy6QxZCJY1v4/FjWUKW4HGyrrcGpJZJtfk0kuPC5AhOfrDfFcwOBTBzKrrtqYRKCCnuw tkkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T9HM2ND5; 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 q6-20020a056402518600b0043c2919cfd3si9878367edd.602.2022.08.15.13.05.18; Mon, 15 Aug 2022 13:05:43 -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=T9HM2ND5; 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 S1343755AbiHOTfj (ORCPT + 99 others); Mon, 15 Aug 2022 15:35:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345180AbiHOT1y (ORCPT ); Mon, 15 Aug 2022 15:27:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA9CB2B60C; Mon, 15 Aug 2022 11:43:45 -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 C301F611DD; Mon, 15 Aug 2022 18:43:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B16E5C433C1; Mon, 15 Aug 2022 18:43:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589024; bh=CEMIqF+IphZQ8hodhebu4GIFclW1IydghT4k3XvrY7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T9HM2ND5VwNdbhSRByB8aXr09NAnVntA11X2luCuVAfq/21UriZ4cFqegLuNupgvu aOAeMKKnldC1vlArh3BK8QyzTJLcKU8YFE4skzBukcHH/Ilrgi6YDAADG7r4Q9b1R4 idmathudNdC+GA/bcPiO86NwoHUvUo285DTvrSuE= 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.15 588/779] tty: n_gsm: fix packet re-transmission without open control channel Date: Mon, 15 Aug 2022 20:03:52 +0200 Message-Id: <20220815180402.463312290@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 56a3466acfc6..3f65990fc959 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1546,7 +1546,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