From nobody Sat Feb 7 08:58:49 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AD2731AABC; Tue, 3 Feb 2026 17:11:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770138676; cv=none; b=UDmGgQ1Zjw5W0ltjOnHiY+KhvL+ss97v6cLsEOCoHnQ31WFzahWA9FAzmzx/B6ctfvUEIEF+EONZT+5DIpS3kggmeUGHi93oegpQiAd2JeUh8inhI42a4XtEGupeDnoBbUJaOWqZ/pwHLSboiV418uvAEVXJtZ0nHVtsP2+2r3c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770138676; c=relaxed/simple; bh=v9MIggMZQHwM4Mc3G2t1gkLl/CS706f7qBG7EVvk9Cc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=iwowBjcZtGwZ1TGw2JgssljLR/58kmCB2459h8OiKuxvuONz6o4r24Rl9U43xuBakOA70PMZ+S/zgr9ywfitQieXp//jQHv2Y8RWF29eJo0KkuoYitBTYnoEzjXc2qF/KOLypD25JP7q8mWzGcSfNPkD8L6FhCv8FhAZbYqhCFk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=eC57H0hl; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="eC57H0hl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770138675; x=1801674675; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v9MIggMZQHwM4Mc3G2t1gkLl/CS706f7qBG7EVvk9Cc=; b=eC57H0hlcIsV65u5rYsPbI/k6KHOzzfrNuPrB9gP3wYrI7FAgOWKmM34 gRm+OFHQPbA1MuRF6wxDC8repMD3fEpJjVMXr+AK6+g0Cav80A5xYOjqv q5hiOZN1GGykpEjWJVx9zqAVmPwpUGRW4BlRq/+3OPDx7bWmXdwD8x1F5 /yClURHKHI9FN+IzSQg0hEjyovTqAaIIgQfoQSoWtxHICPaTxQMsI1AR9 6y0/a2+whoNFfvHcwiotAYmR9Qvw1lqI9e0k3z8b0lCapBIlci7YZeea8 Y/CrCPmaPnoK7hEveLEy1X4LNDjiBofOs/Ga8Q7zvsd2zHQOA7a+YTdb1 Q==; X-CSE-ConnectionGUID: eMAwH/EBSEi/up5cv/BdkQ== X-CSE-MsgGUID: 47SMGepFSP2zmmsuFTDUAQ== X-IronPort-AV: E=McAfee;i="6800,10657,11691"; a="71220776" X-IronPort-AV: E=Sophos;i="6.21,271,1763452800"; d="scan'208";a="71220776" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2026 09:11:13 -0800 X-CSE-ConnectionGUID: z8t4xJnpRg6fOAQ7ztm3Sg== X-CSE-MsgGUID: UvkX++AJSTqMI8SrbFG/ig== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,271,1763452800"; d="scan'208";a="240589479" Received: from ijarvine-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.245.117]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2026 09:11:05 -0800 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, Andy Shevchenko , qianfan Zhao , Adriana Nicolae , linux-kernel@vger.kernel.org Cc: "Bandal, Shankar" , "Murthy, Shanth" , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , stable@vger.kernel.org Subject: [PATCH v4 1/7] serial: 8250: Protect LCR write in shutdown Date: Tue, 3 Feb 2026 19:10:43 +0200 Message-Id: <20260203171049.4353-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260203171049.4353-1-ilpo.jarvinen@linux.intel.com> References: <20260203171049.4353-1-ilpo.jarvinen@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The 8250_dw driver needs to potentially perform very complex operations during LCR writes because its BUSY handling prevents updates to LCR while UART is BUSY (which is not fully under our control without those complex operations). Thus, LCR writes should occur under port's lock. Move LCR write under port's lock in serial8250_do_shutdown(). Also split the LCR RMW so that the logic is on a separate line for clarity. Reported-by: "Bandal, Shankar" Tested-by: "Bandal, Shankar" Tested-by: "Murthy, Shanth" Cc: stable@vger.kernel.org Reviewed-by: Andy Shevchenko Signed-off-by: Ilpo J=C3=A4rvinen --- drivers/tty/serial/8250/8250_port.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/= 8250_port.c index 719faf92aa8a..f7a3c5555204 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2350,6 +2350,7 @@ static int serial8250_startup(struct uart_port *port) void serial8250_do_shutdown(struct uart_port *port) { struct uart_8250_port *up =3D up_to_u8250p(port); + u32 lcr; =20 serial8250_rpm_get(up); /* @@ -2376,13 +2377,13 @@ void serial8250_do_shutdown(struct uart_port *port) port->mctrl &=3D ~TIOCM_OUT2; =20 serial8250_set_mctrl(port, port->mctrl); + + /* Disable break condition */ + lcr =3D serial_port_in(port, UART_LCR); + lcr &=3D ~UART_LCR_SBC; + serial_port_out(port, UART_LCR, lcr); } =20 - /* - * Disable break condition and FIFOs - */ - serial_port_out(port, UART_LCR, - serial_port_in(port, UART_LCR) & ~UART_LCR_SBC); serial8250_clear_fifos(up); =20 rsa_disable(up); --=20 2.39.5