Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp983023pxb; Fri, 15 Apr 2022 17:22:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymyztJ640XCGuglh7E9KWHTDcy9gOqCEhJ52gAlm2dbPKVosv4IQ8rgnIhXGzb1PjqJQz2 X-Received: by 2002:aa7:8241:0:b0:509:979d:c760 with SMTP id e1-20020aa78241000000b00509979dc760mr1315296pfn.84.1650068541918; Fri, 15 Apr 2022 17:22:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650068541; cv=none; d=google.com; s=arc-20160816; b=pW+KDPktmKJXody4Zk2gNQg6FLAjhmQXz9p6GTphPEPZH/jfr8tq1wpOM21AmerLfO pDMJceyKCeD+NrM2YRfcUh1xYU1Hw4qMb8Ssap105/7joWH9Z0NiESUfraNz6PCmKTl2 0vydnP35O3WV9YUKdZZ8nCgMC8JdSYUR852upyptQWIINuDykR0NaVoAbxyVEK9jpq+2 vx/ScK5sGkX5hd7Wlhd8z/E79RrXFWTdOvoFuVKHALH7efkzx6OWkM2YcKYpiImi/wpt LaJGXHFGJivIzfD0hdoRlUe4I31nBkv4G4YpePIDXBaUG3T59Jvl4BJtFIcLQPL1Vpq4 nPMA== 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=BeY7tUTv0JkVwOPsalB6SRWsraBVI4DRmB8X+cQCD64=; b=zkJrtxY9aWgJnGLbv26kE1+VLHlDq4/kH2xJkyynldk8hNp6R8kE0BQyuzS+qoXic2 tg4jYdFvYYxfNJHvXO3CJa5mO3ScQHnAVdXHW+Om3nDAhSGamlJXViXlAcxjINoTauqc 5JvXBINhbzSdS2lC76r+KfVrZC4FUF2JP3DKO4nAEvQYk4VYVoQ8Lpqp+OYu6v+rjWC1 x1y1f6vn+TDzX0ivFAQurTmIomdMLl97/4ZB678nAS0gdUIrak6m0yl6sarX4pDN/SCA d4T157jAvWOcJ40m+yNBED+auydoHagacmalHJlW5hZTwQyZK7mZ2DOlv+l6m0/+1vP/ NkSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=RIqpALIX; 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 22-20020a631056000000b0039d59d47179si2805786pgq.225.2022.04.15.17.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:22:21 -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=RIqpALIX; 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 6D9D0CBE79; Fri, 15 Apr 2022 17:21:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241995AbiDNJrH (ORCPT + 99 others); Thu, 14 Apr 2022 05:47:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241915AbiDNJqT (ORCPT ); Thu, 14 Apr 2022 05:46:19 -0400 X-Greylist: delayed 62 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 14 Apr 2022 02:43:54 PDT Received: from mta-64-227.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ECA26E4CB for ; Thu, 14 Apr 2022 02:43:54 -0700 (PDT) Received: by mta-64-227.flowmailer.net with ESMTPSA id 20220414094245966d7bee8fdb696ff2 for ; Thu, 14 Apr 2022 11:42:50 +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=BeY7tUTv0JkVwOPsalB6SRWsraBVI4DRmB8X+cQCD64=; b=RIqpALIXOaqm2jmA2yjsGYAjlJKVXKPN6qha01nU0Jq1C1Thbw2DmOY0DAQydb4izizcFz GHQhu20OHiPGmj2IK2W6QKrE6TKPol4uish36za4iqGEo0+MwDtj85bVQFsaNAgHxjWswMDM jGOD2pyROTbLjZ/0fO8vlnQedfJ10=; 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 09/20] tty: n_gsm: fix wrong DLCI release order Date: Thu, 14 Apr 2022 02:42:14 -0700 Message-Id: <20220414094225.4527-9-daniel.starke@siemens.com> In-Reply-To: <20220414094225.4527-1-daniel.starke@siemens.com> References: <20220414094225.4527-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 The current DLCI release order starts with the control channel followed by the user channels. Reverse this order to keep the control channel open until all user channels have been released. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Cc: stable@vger.kernel.org Signed-off-by: Daniel Starke --- drivers/tty/n_gsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index cc90b03ce005..6b953dfbb155 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2146,8 +2146,8 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, bool disc) /* Finish outstanding timers, making sure they are done */ del_timer_sync(&gsm->t2_timer); - /* Free up any link layer users */ - for (i = 0; i < NUM_DLCI; i++) + /* Free up any link layer users and finally the control channel */ + for (i = NUM_DLCI - 1; i >= 0; i--) if (gsm->dlci[i]) gsm_dlci_release(gsm->dlci[i]); mutex_unlock(&gsm->mutex); -- 2.25.1