This is a note to let you know that I've just added the patch titled serial: 8250: fix return error code in serial8250_request_std_resource() to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: serial-8250-fix-return-error-code-in-serial8250_request_std_resource.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 6e690d54cfa802f939cefbd2fa2c91bd0b8bd1b6 Mon Sep 17 00:00:00 2001 From: Yi Yang <yiyang13@xxxxxxxxxx> Date: Tue, 28 Jun 2022 16:35:15 +0800 Subject: serial: 8250: fix return error code in serial8250_request_std_resource() From: Yi Yang <yiyang13@xxxxxxxxxx> commit 6e690d54cfa802f939cefbd2fa2c91bd0b8bd1b6 upstream. If port->mapbase = NULL in serial8250_request_std_resource() , it need return a error code instead of 0. If uart_set_info() fail to request new regions by serial8250_request_std_resource() but the return value of serial8250_request_std_resource() is 0, The system incorrectly considers that the resource application is successful and does not attempt to restore the old setting. A null pointer reference is triggered when the port resource is later invoked. Signed-off-by: Yi Yang <yiyang13@xxxxxxxxxx> Cc: stable <stable@xxxxxxxxxx> Link: https://lore.kernel.org/r/20220628083515.64138-1-yiyang13@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/tty/serial/8250/8250_port.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2828,8 +2828,10 @@ static int serial8250_request_std_resour case UPIO_MEM32BE: case UPIO_MEM16: case UPIO_MEM: - if (!port->mapbase) + if (!port->mapbase) { + ret = -EINVAL; break; + } if (!request_mem_region(port->mapbase, size, "serial")) { ret = -EBUSY; Patches currently in stable-queue which might be from yiyang13@xxxxxxxxxx are queue-5.4/serial-8250-fix-return-error-code-in-serial8250_request_std_resource.patch