Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3092151rwb; Mon, 15 Aug 2022 17:56:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR5bo9PfQPtKQWH/sgbQHokzMTtxeb0uZbi4bqLScLl0DFCEFlGsZPoLCU/iMo2MceYiDoto X-Received: by 2002:a05:6402:538f:b0:444:c17b:1665 with SMTP id ew15-20020a056402538f00b00444c17b1665mr479804edb.98.1660611377744; Mon, 15 Aug 2022 17:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611377; cv=none; d=google.com; s=arc-20160816; b=F7ZiK7Uw5dQiySaY2DqCe8j05jb4xc0UInVHDpmiy9T38NavH82+SxpGcRCEuIuQcK k999BoPHaOY5tDYek5eKMFhoJCr5LvVasnmkgCeDPqc8GRRHVTlM9DuPJzDLzHklPT7A WU73Ye4Ls7/jefXsfEI60T150/MfTLKbkLHh9HBZUEmX4eoZc7fCeuLdc/PNeYLPEcO2 EO1cQBa6CZfEMD7Z7qi2e63bGC5NFtXw/f58RfKSlS6eQOAs3aBepISI70Z801LuE7WW qjMbA2Xg0wgkkxh7WWDN4iXAlVb6bqC0bCg799ZR+RVPDAMFWdN7qiyxYU6LYJRkvgGw 9nTw== 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=7qnFV/GIQ7iOBkTS/E6xc95uWppPga2z6SoAogMfNmU=; b=qcgkMnMLVnc1Nekh6V6LgYqcitUH5InLUkBRxjgrQfyx5N6xtXbZxKfQf3gZoHZp1N B9n2H7LdP/zYTJfw9VNOILxtJ2HXCCGsaB0gJnC3lcDJ3qpki3lKuxG5CkjzdMSUtF+s +KYpxMXSa5ctYpcjmf8qMLBN6zgNO5nyDuKVrVZWloer5xVt5RNz3QfZM0HkXCsHz64p dI5pK0X6j4w68mYwhnsA0qDEbNvuDoWjrenbqvJjwGwlRmcnGTHKRP0S4FsSUQ5FqoP1 B6pNGGSQhoXlC2MEN36+lWjpeR4OycASh2JDszxqwtuQ9ExaN3EodzrGQHlwHylbUdQ8 Z4Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tekgBPi8; 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 e1-20020a056402330100b0043d5404f4fasi8196689eda.104.2022.08.15.17.55.49; Mon, 15 Aug 2022 17:56:17 -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=tekgBPi8; 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 S1344348AbiHPAmu (ORCPT + 99 others); Mon, 15 Aug 2022 20:42:50 -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: 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 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ärvinen Link: https://lore.kernel.org/r/c5879db7-bee9-93f-526e-872a292442@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 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) /* 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 = 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); -- 2.35.1