Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6228342iob; Tue, 10 May 2022 13:22:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4zW47ld8PfxJhLqUk66+WC+e2lUaf8m1VD4K0aF77soqqgMZHTCsoY9qHja2HvXUjWwx4 X-Received: by 2002:a17:902:7593:b0:15e:fe5d:58e1 with SMTP id j19-20020a170902759300b0015efe5d58e1mr15462386pll.102.1652214156096; Tue, 10 May 2022 13:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652214156; cv=none; d=google.com; s=arc-20160816; b=HzqkKT54nIk4kq0HngxFfCb2C3dINO5P7Bopq/8wKDLYf87b//u29fcImfAuw+uFWH 1H53A43erNfnTRcbfYzqZstuz5sqx1+4U1b7qDCJPcIXlFiI0S4fz3+FO3E//FC97Vfe jD3hR3XA4+XZyZkecdoNft4p+OrXqgT4oQygr6cLuDw2V3JVA8vSpPIXw2OFaXQe5sUp nlh/S0IAKNnXof9G8qmx1HODsoWW2uZLomB5e+8vu5ZCf/qhDFXO01sUDLDEYngeg72Q Ne4du47mvwAU0gEforVeobijVsZqLc/gqhCp+ruN3jHsJHuBHam/nYU+yUjDNVuP8h7S Gx+w== 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=RJ3sZ6MulE9qSSnj+au4reodd94omRkdvB3I19IE4M4=; b=U91yFCfWKZiCiFfV0SNao+Sry47WWCiPXVb1uh7fYeL9BtSeryN3i0j0xSiwZSScp4 eya2vqRkhRi4TtPHmxCaOoUZ1+wpHUXKc3GQFKls8Z1JLUDwUYcyvpIfy9ERWyyBm4ZY Yh0f34iVpS4I2T7WqJq0PUon0C1bBEXmS6aFmJlNIvTAbXEU4nSPYVpj8yn/NHO3w8Rd KygluWKDHNuxNSihP3MZeeqiDNWc+eNapJjJ4inT7+HTCsN7RZGrlqgfduFHMhSUlG+H GORcZRRDgGObcfVuJGDhyXY8SssU+C0eFVDH4mvQ91kSCTQNu8YKwcgIPhsNqsC8KfDY tdmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pxD+QVcx; 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 v8-20020a63bf08000000b003c6ab6a4b69si402731pgf.285.2022.05.10.13.22.20; Tue, 10 May 2022 13:22:36 -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=pxD+QVcx; 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 S243539AbiEJNbT (ORCPT + 99 others); Tue, 10 May 2022 09:31:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243564AbiEJNWE (ORCPT ); Tue, 10 May 2022 09:22:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13D37532D1; Tue, 10 May 2022 06:16: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 28FAE615FA; Tue, 10 May 2022 13:16:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38EC1C385A6; Tue, 10 May 2022 13:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652188563; bh=rcPMcmx+O2Rg0m2AEX3UqeiP68IktvyIl4QmJckVrk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pxD+QVcx+Q4CcaTPCrkLRokkfQpJFuBOdAGR4F1FV5bvD2l6qfXd5+Sr7ad/k50w5 FiZFtYpVAhyI/KYCSNKrrdaIJ0Ah3SgDcGOyzRTC5d8u8UZ+Y7fZ/kFo0sQgnAhwzj UJF4uiI2pDx1MDbp7d/eAZD9aMySQ64Kn0H1vOjk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke Subject: [PATCH 4.14 49/78] tty: n_gsm: fix missing explicit ldisc flush Date: Tue, 10 May 2022 15:07:35 +0200 Message-Id: <20220510130733.989336187@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130732.522479698@linuxfoundation.org> References: <20220510130732.522479698@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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,URIBL_BLOCKED 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 commit 17eac652028501df7ea296b1d9b9c134db262b7d upstream. In gsm_cleanup_mux() the muxer is closed down and all queues are removed. However, removing the queues is done without explicit control of the underlying buffers. Flush those before freeing up our queues to ensure that all outgoing queues are cleared consistently. Otherwise, a new mux connection establishment attempt may time out while the underlying tty is still busy sending out the remaining data from the previous connection. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Cc: stable@vger.kernel.org Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220414094225.4527-10-daniel.starke@siemens.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/n_gsm.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2113,6 +2113,7 @@ static void gsm_cleanup_mux(struct gsm_m gsm_dlci_release(gsm->dlci[i]); mutex_unlock(&gsm->mutex); /* Now wipe the queues */ + tty_ldisc_flush(gsm->tty); list_for_each_entry_safe(txq, ntxq, &gsm->tx_list, list) kfree(txq); INIT_LIST_HEAD(&gsm->tx_list);