Skip to content

Commit 6e690d5

Browse files
Yi Yanggregkh
authored andcommitted
serial: 8250: fix return error code in serial8250_request_std_resource()
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 <[email protected]> Cc: stable <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5c5f44e commit 6e690d5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/tty/serial/8250/8250_port.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2975,8 +2975,10 @@ static int serial8250_request_std_resource(struct uart_8250_port *up)
29752975
case UPIO_MEM32BE:
29762976
case UPIO_MEM16:
29772977
case UPIO_MEM:
2978-
if (!port->mapbase)
2978+
if (!port->mapbase) {
2979+
ret = -EINVAL;
29792980
break;
2981+
}
29802982

29812983
if (!request_mem_region(port->mapbase, size, "serial")) {
29822984
ret = -EBUSY;

0 commit comments

Comments
 (0)