提交 b933ca04 编写于 作者: Y Yi Yang 提交者: Zheng Zengkai

serial: 8250: fix return error code in serial8250_request_std_resource()

stable inclusion
from stable-v5.10.132
commit 039ffe436ae55dabfaa4f46be39a7214c910cacc
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5YS3T

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

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

commit 6e690d54 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: NYi Yang <yiyang13@huawei.com>
Cc: stable <stable@kernel.org>
Link: https://lore.kernel.org/r/20220628083515.64138-1-yiyang13@huawei.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 99f24243
...@@ -2953,8 +2953,10 @@ static int serial8250_request_std_resource(struct uart_8250_port *up) ...@@ -2953,8 +2953,10 @@ static int serial8250_request_std_resource(struct uart_8250_port *up)
case UPIO_MEM32BE: case UPIO_MEM32BE:
case UPIO_MEM16: case UPIO_MEM16:
case UPIO_MEM: case UPIO_MEM:
if (!port->mapbase) if (!port->mapbase) {
ret = -EINVAL;
break; break;
}
if (!request_mem_region(port->mapbase, size, "serial")) { if (!request_mem_region(port->mapbase, size, "serial")) {
ret = -EBUSY; ret = -EBUSY;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册