mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
ANDROID: tty: serial: msm: geni: Do not access private data when console is disabled
uport private data is not initialized when console is disabled. Prevent access of private data to avoid null pointer access in system suspend/resume. Bug: 228299196 Signed-off-by: Visweswara Tanuku <quic_vtanuku@quicinc.com> Change-Id: I288a24e2c6bee091fa7c479de520958ea0bb3d17
This commit is contained in:
committed by
Todd Kjos
parent
fbe6f8708d
commit
e21b6105a9
@@ -1,5 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
// Copyright (c) 2017-2018, The Linux foundation. All rights reserved.
|
||||
/*
|
||||
* Copyright (c) 2017-2018, The Linux foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/console.h>
|
||||
@@ -1496,9 +1499,9 @@ static int qcom_geni_serial_remove(struct platform_device *pdev)
|
||||
|
||||
static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev)
|
||||
{
|
||||
struct uart_port *uport;
|
||||
struct qcom_geni_private_data *private_data;
|
||||
struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
|
||||
struct uart_port *uport = &port->uport;
|
||||
struct qcom_geni_private_data *private_data = uport->private_data;
|
||||
|
||||
/* Platform driver is registered for console and when console
|
||||
* is disabled from cmdline simply return success.
|
||||
@@ -1506,6 +1509,9 @@ static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev)
|
||||
if (port->is_console && !con_enabled)
|
||||
return 0;
|
||||
|
||||
uport = &port->uport;
|
||||
private_data = uport->private_data;
|
||||
|
||||
/*
|
||||
* This is done so we can hit the lowest possible state in suspend
|
||||
* even with no_console_suspend
|
||||
@@ -1520,9 +1526,18 @@ static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev)
|
||||
static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
struct uart_port *uport;
|
||||
struct qcom_geni_private_data *private_data;
|
||||
struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
|
||||
struct uart_port *uport = &port->uport;
|
||||
struct qcom_geni_private_data *private_data = uport->private_data;
|
||||
|
||||
/* Platform driver is registered for console and when console
|
||||
* is disabled from cmdline simply return success.
|
||||
*/
|
||||
if (port->is_console && !con_enabled)
|
||||
return 0;
|
||||
|
||||
uport = &port->uport;
|
||||
private_data = uport->private_data;
|
||||
|
||||
ret = uart_resume_port(private_data->drv, uport);
|
||||
if (uart_console(uport)) {
|
||||
|
||||
Reference in New Issue
Block a user