Commit cf28f3f4 authored by Ilpo Järvinen's avatar Ilpo Järvinen Committed by Wen Zhiwei
Browse files

tty: serial: 8250: Fix another runtime PM usage counter underflow

stable inclusion
from stable-v6.6.72
commit 0231ecfb1f7ad8e4b054387c74accffcc5593603
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBQN9L

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=0231ecfb1f7ad8e4b054387c74accffcc5593603



--------------------------------

commit ed2761958ad77e54791802b07095786150eab844 upstream.

The commit f9b11229 ("serial: 8250: Fix PM usage_count for console
handover") fixed one runtime PM usage counter balance problem that
occurs because .dev is not set during univ8250 setup preventing call to
pm_runtime_get_sync(). Later, univ8250_console_exit() will trigger the
runtime PM usage counter underflow as .dev is already set at that time.

Call pm_runtime_get_sync() to balance the RPM usage counter also in
serial8250_register_8250_port() before trying to add the port.

Reported-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Fixes: bedb404e ("serial: 8250_port: Don't use power management for kernel console")
Cc: stable <stable@kernel.org>
Tested-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20241210170120.2231-1-ilpo.jarvinen@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent c06ebe88
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1131,6 +1131,9 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)
			uart->dl_write = up->dl_write;

		if (uart->port.type != PORT_8250_CIR) {
			if (uart_console_registered(&uart->port))
				pm_runtime_get_sync(uart->port.dev);

			if (serial8250_isa_config != NULL)
				serial8250_isa_config(0, &uart->port,
						&uart->capabilities);