From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 39D7F3AE1A5; Mon, 23 Mar 2026 13:52:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774273958; cv=none; b=Sie+KHIH65j9cVq8nciZEz71kj/zhENS/dmvsOdqVPMeFRirUbeDZyWfKSMlXtNL6PSWMN8aj6m4G/FZBRPnPk2at7f9ZNPeu2/eSofpOcuC0pVQVdDVSwKad2NwtCHuI72Y7X/sbmX2WY8uCvfJOZ1WuKPKgM35A3Z/TN5l4Ow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774273958; c=relaxed/simple; bh=OPZTMsduaj7NNw8RBoxXxHx9iM2S6xqR6BGPzPJ1xUg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ODYcbDFKq86duO0Hxe/ReLTKM+iSzMacmxO4FzzrRVTKzg1hCrhZ+IBsHt363JZVvl6PiQfeeqoSD7BzHvrS2JxdPAw1mrBr9ZYPI8nL60yQTh1CNvWFwqWBlWa98AOAeOO1zhhqgJ9YlJzJ6ab3E1Ar9izIj/jsu+5D0h43HCI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ZS7k/3rD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ZS7k/3rD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9904C4CEF7; Mon, 23 Mar 2026 13:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774273958; bh=OPZTMsduaj7NNw8RBoxXxHx9iM2S6xqR6BGPzPJ1xUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZS7k/3rDzIQVxdeFo2CVNx5Mv8qn7mIMV5AXaEBCS0yaY/qRuIGFqmfc2z1XiYjtQ euBvjLfLYi0mTtYHnOvvUx6/+rD1B8MfCoR1nqEKiMJvH7Ccp+oyHJ3Kic5C3MO9GN ZpB5IggtG3EWjVmnbDfnlTMYQoAVV7kmsz3mY9Po= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Bandal, Shankar" , "Murthy, Shanth" , stable , Andy Shevchenko , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 6.19 062/220] serial: 8250: Protect LCR write in shutdown Date: Mon, 23 Mar 2026 14:43:59 +0100 Message-ID: <20260323134506.550997175@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134504.575022936@linuxfoundation.org> References: <20260323134504.575022936@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ilpo Järvinen commit 59a33d83bbe6d73d2071d7ae21590b29faed0503 upstream. 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 Reviewed-by: Andy Shevchenko Signed-off-by: Ilpo Järvinen Link: https://patch.msgid.link/20260203171049.4353-2-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/8250/8250_port.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2348,6 +2348,7 @@ static int serial8250_startup(struct uar void serial8250_do_shutdown(struct uart_port *port) { struct uart_8250_port *up = up_to_u8250p(port); + u32 lcr; serial8250_rpm_get(up); /* @@ -2374,13 +2375,13 @@ void serial8250_do_shutdown(struct uart_ port->mctrl &= ~TIOCM_OUT2; serial8250_set_mctrl(port, port->mctrl); + + /* Disable break condition */ + lcr = serial_port_in(port, UART_LCR); + lcr &= ~UART_LCR_SBC; + serial_port_out(port, UART_LCR, lcr); } - /* - * Disable break condition and FIFOs - */ - serial_port_out(port, UART_LCR, - serial_port_in(port, UART_LCR) & ~UART_LCR_SBC); serial8250_clear_fifos(up); rsa_disable(up);