]> git.baikalelectronics.ru Git - kernel.git/commit
serial: 8250: fix return error code in serial8250_request_std_resource()
authorYi Yang <yiyang13@huawei.com>
Tue, 28 Jun 2022 08:35:15 +0000 (16:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Jun 2022 15:15:47 +0000 (17:15 +0200)
commit1a4e3531edefb6ceab93c26043b6270a25e87211
tree2166f2337e0a8dca5b8275fa17c3f8064922d79f
parent97b4348ed93eee1a8aae503257a62dad5b1cdfe2
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 <yiyang13@huawei.com>
Cc: stable <stable@kernel.org>
Link: https://lore.kernel.org/r/20220628083515.64138-1-yiyang13@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_port.c