From nobody Mon Sep 29 21:18:49 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC848C00140 for ; Tue, 16 Aug 2022 00:42:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344509AbiHPAmw (ORCPT ); Mon, 15 Aug 2022 20:42:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347091AbiHPAkn (ORCPT ); Mon, 15 Aug 2022 20:40:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 710BA18DC12; Mon, 15 Aug 2022 13:38:56 -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 ams.source.kernel.org (Postfix) with ESMTPS id 49947B80EA8; Mon, 15 Aug 2022 20:38:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9505BC433C1; Mon, 15 Aug 2022 20:38:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595933; bh=E+ulq/STAWwHQuTcMCyRYJi1Yuj3JPnEACZhaX/4lQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tekgBPi8vc3D/D0NLiLjMIlVe3rhad0ALc0+lnC87PlLYK+dwu4YYnRj7jCPGhc2f iq7V6aSHVfP9XouCAa7s4CVl5L+i3uknSJXQypzcmJ89Ns36eeMx6nwpq+PzLvCeyW PbG329HOtkI7IqDy0V0C06D1oK9VzRM+YDLvSfYc= 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 0920/1157] serial: 8250_dw: Take port lock while accessing LSR Date: Mon, 15 Aug 2022 20:04:36 +0200 Message-Id: <20220815180516.255718805@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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen [ Upstream commit b9491b2e45d71eb64245560e208897af95ffbf95 ] Accessing LSR requires port lock because it mutates lsr_saved_flags in serial_lsr_in(). Fixes: 197eb5c416ff ("serial: 8250_dw: Use serial_lsr_in() in dw8250_handle= _irq()") Reviewed-by: Andy Shevchenko Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/c5879db7-bee9-93f-526e-872a292442@linux.int= el.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/82= 50_dw.c index c0ab67033a25..d0dfbf1fc9d8 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -266,7 +266,10 @@ static int dw8250_handle_irq(struct uart_port *p) =20 /* Manually stop the Rx DMA transfer when acting as flow controller */ if (quirks & DW_UART_QUIRK_IS_DMA_FC && up->dma && up->dma->rx_running &&= rx_timeout) { + spin_lock_irqsave(&p->lock, flags); status =3D serial_lsr_in(up); + spin_unlock_irqrestore(&p->lock, flags); + if (status & (UART_LSR_DR | UART_LSR_BI)) { dw8250_writel_ext(p, RZN1_UART_RDMACR, 0); dw8250_writel_ext(p, DW_UART_DMASA, 1); --=20 2.35.1