Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3124336rwb; Mon, 15 Aug 2022 18:44:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Hmgw5ULQ67zBlk1Ahb2ktka+ffLYVFxEdRvCpj7ADeU3S6kOV7BdnWEWvvA8rf8EriXAM X-Received: by 2002:a17:907:2722:b0:731:23a3:be78 with SMTP id d2-20020a170907272200b0073123a3be78mr12185523ejl.330.1660614242087; Mon, 15 Aug 2022 18:44:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660614242; cv=none; d=google.com; s=arc-20160816; b=FglEnqctjcny+d8B1ho8DNh0WEcbBhXAs8mHBEPcEZBvCUuuTid/M9RF6p7pFoSZLE CTMcULENEC4tIV/2fFb/DQno+vq4no9heQRMwkZ8r0x+evhEli+jx80YjwZ/YWlhJWb6 TeZC9SjdW5gCNXbrfaCnQLtsroPxbFPyIjrHPU4hISap0vGiZv/5Xyf4nza9ptjCGXMZ 0RZoHF+LqNuJ31y4cOGC3mZPVw0GnHO9xUI8P62oGNUs+th1aQFN6btFGXtvlOs8DWSV 0HZP+1SzQLIbKTRxCAdneF13C75v5Q83m0+2+Oe0q8p5p13DWynu/Fjb5IGpTiIjzICq q9jQ== 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=f573aDgA0/Uh0Y2VMDFv8oc73YovEUdwD4zLOPXC/zI=; b=kPsKwCFdT44YUP5+DH/ikyfhUZ88JU26BKwExwQ8JpXqJLjX7Ik4icaT6JH2pTuoRr PKZCAOX8vFn/MzBBTwd6+ixv86wTTgxCSjb4De+GnRbCkRBmSFalp+izO4JO3mESxU+n qMsYbGV5HLc8IMo3T0GGqfsbLdatG17Y/ncvwsMC8sK4PVg5VD9ezpbrKO/2m1d7gMzf u0PWd/w6NbchJ2gRpzl2eINomFAupqxRBKsTgdmaAinAWGExU+Az/vk3oF0KpBVJy817 962NzZt/z1v0zwkcvafGiQbx2I9b0m1rmslyLVKFKuwszCiqWJtZVMA//t7B/UGcMV0B xh8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M0wk35Co; 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 x5-20020a05640226c500b0043ce8b2c72dsi9899023edd.36.2022.08.15.18.43.36; Mon, 15 Aug 2022 18:44:02 -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=M0wk35Co; 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 S233985AbiHPAoQ (ORCPT + 99 others); Mon, 15 Aug 2022 20:44:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350113AbiHPAll (ORCPT ); Mon, 15 Aug 2022 20:41:41 -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 72C4CD39AE; Mon, 15 Aug 2022 13:39:41 -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 D8D9161231; Mon, 15 Aug 2022 20:39:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6FCFC433C1; Mon, 15 Aug 2022 20:39:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595980; bh=LGatekdsh6yj4BD49i20YVek1o/AM68LJ6eGus3GXYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M0wk35Cor/P9+NW44tjqbgz8LkY00RaCFRaeKuuuh1R77eaRJzqdm2ZfrQARZ6yRY PH1tU7vY2Nd0NPDsBWpYFHlt7DVhgoiloVEOXCk/K+ryd+HPGhqQy7zOhTB2Jzkkbe j42NP0sqWXmpVNBgfTX/x31HCcLz8BpOOK8EWZpA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sasha Levin Subject: [PATCH 5.19 0902/1157] serial: 8250_dw: Store LSR into lsr_saved_flags in dw8250_tx_wait_empty() Date: Mon, 15 Aug 2022 20:04:18 +0200 Message-Id: <20220815180515.546951459@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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: Ilpo Järvinen [ Upstream commit af14f3007e2dca0d112f10f6717ba43093f74e81 ] Make sure LSR flags are preserved in dw8250_tx_wait_empty(). This function is called from a low-level out function and therefore cannot call serial_lsr_in() as it would lead to infinite recursion. It is borderline if the flags need to be saved here at all since this code relates to writing LCR register which usually implies no important characters should be arriving. Fixes: 914eaf935ec7 ("serial: 8250_dw: Allow TX FIFO to drain before writing to UART_LCR") Reviewed-by: Andy Shevchenko Signed-off-by: Ilpo Järvinen Link: https://lore.kernel.org/r/20220608095431.18376-7-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_dw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 7e05b431a314..c0ab67033a25 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -122,12 +122,15 @@ static void dw8250_check_lcr(struct uart_port *p, int value) /* Returns once the transmitter is empty or we run out of retries */ static void dw8250_tx_wait_empty(struct uart_port *p) { + struct uart_8250_port *up = up_to_u8250p(p); unsigned int tries = 20000; unsigned int delay_threshold = tries - 1000; unsigned int lsr; while (tries--) { lsr = readb (p->membase + (UART_LSR << p->regshift)); + up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS; + if (lsr & UART_LSR_TEMT) break; -- 2.35.1