Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1688096iob; Thu, 5 May 2022 06:31:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxkHJ+8tpx2zaYWFzepyKfkmqFfIlQixyCiBjBT6YUqX/cDZ1q8QIXgsIce7u+F/4JLNdh X-Received: by 2002:a05:6402:128b:b0:425:d1d7:b321 with SMTP id w11-20020a056402128b00b00425d1d7b321mr29500796edv.179.1651757505606; Thu, 05 May 2022 06:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651757505; cv=none; d=google.com; s=arc-20160816; b=WNf5eoog36v/nvu92BeOVRvoJ0wonOcocA3c3giy8RvJI1AQLy2jtv9pw4M9/Sj7Xq dklRe7qB1RQzdu/9v4o4HnGRMCf+08Y22OGpYq7nD3HvXKurpoVGLefAeJPo4t2K07DB CFl4SiML2+Eu4zT7deVqmE8o1yQSmgmK1Nd5YqpGT9wpqwSGAI58VHj6es1vBkZwFSd5 FaywUJrOnONkS3S7uWtPLIYqiv8ek3QdRtlfbEA/Gte/g7yDy75byZrkhjHIfGK+v63I Lhv8U/TZs7Mr5B24PYAbiVUujwJ/V58Cfk18ip/O4+sjaI2di0BesbcWUrz3Qo4fRCDZ A3/A== 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=3s64Hnsz3MYZAMV9EbbgtWNV/Ft6nZh2i8qcNc/lang=; b=dyDcKbw4B6InttLzOf757M4zBIW3J9RldISyHTRphZZT9L9+/4EwucI1LzF91ZG/IF uSqTTb39cWAZcWhvWg2LwhDbJjRqB2362N6mDA+cgokAF87F1mzv1neji9h4drhcH+LD i3xGpdUfSZlQYYsfudSKC5pgD+S2ya80pdwPFVnl4Sh3GkWSQk6QKO3Tv2yrN8HEn/Fa DZioj68eTnKoffsThuKbfKYWqH3KJKuxorMQZb74UyKpePbbuWay2GNy+5pDb1gEXw0R B+o9cYouGbDW6hH61dbFvEOw7muGW2Imh7dIzhajK/dfFYRlhaAtNR87vxawCr9N3zrA bopg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2QNh1Kpt; 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 m19-20020a056402431300b00426110e5d52si2334328edc.485.2022.05.05.06.31.20; Thu, 05 May 2022 06:31:45 -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=2QNh1Kpt; 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 S1358128AbiEDR3q (ORCPT + 99 others); Wed, 4 May 2022 13:29:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356536AbiEDRJS (ORCPT ); Wed, 4 May 2022 13:09:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 399C025EF; Wed, 4 May 2022 09:55:14 -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 C1F81616B8; Wed, 4 May 2022 16:55:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12DE8C385AA; Wed, 4 May 2022 16:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683313; bh=Pv6X4Dct+sK2R/BzHQahrsi0kPRPIvAyAQ9pivAnEro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2QNh1KptinDjH1nyKs/LLWQeplQFYAlxG9XC6phiWMiMk9lvbph0CQCaI1UoMUmUX bH0/WR8vRyqinQWVwQDERv9XD+jI+dY7IN01S99+fbHpKuS+uuaOCkW37Td7R4BY/R BTAJuXQnTvE+uz3Zy+cZARq6GWCBMvnaDbE9QjwM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke Subject: [PATCH 5.15 165/177] tty: n_gsm: fix missing explicit ldisc flush Date: Wed, 4 May 2022 18:45:58 +0200 Message-Id: <20220504153108.285574527@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@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 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 @@ -2087,6 +2087,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);