author | Tao Zeng <tao.zeng@amlogic.com> | 2016-03-01 06:24:16 (GMT) |
---|---|---|
committer | Tao Zeng <tao.zeng@amlogic.com> | 2016-03-01 06:37:20 (GMT) |
commit | f981b1d98eb4c3cbc9cd453175de4a2862c5c189 (patch) | |
tree | b60f6fcae217468e7e31002c70a4199c65b8799f | |
parent | 1e159c44e5ed3cdae4ebec0f5a429ea6013c5191 (diff) | |
download | hdmi_cec-f981b1d98eb4c3cbc9cd453175de4a2862c5c189.zip hdmi_cec-f981b1d98eb4c3cbc9cd453175de4a2862c5c189.tar.gz hdmi_cec-f981b1d98eb4c3cbc9cd453175de4a2862c5c189.tar.bz2 |
PD#116677: fix system server crash in auto-reboot
Thread check connection may crash by NULL pointer if port
status is under updating during 2 IOCTRL operations. We
need sync these operations to avoid this bug.
Change-Id: If3cd49a1c6afd623830b74a17e0361757dd24608
-rw-r--r-- | Android.mk | 2 | ||||
-rw-r--r-- | hdmi_cec.c | 4 |
2 files changed, 3 insertions, 3 deletions
@@ -20,7 +20,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := hdmi_cec.c LOCAL_PRELINK_MODULE := false LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_SHARED_LIBRARIES := liblog libcutils +LOCAL_SHARED_LIBRARIES := liblog libcutils libnativehelper LOCAL_MODULE := hdmi_cec.amlogic LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY) @@ -129,7 +129,7 @@ static void check_connect_status(struct aml_cec_hal *hal) hdmi_event_t event; prev_status = hal->con_status; - for (i = 0; i < hal->total_port; i++) { + for (i = 0; i < hal->total_port && hal->port_data != NULL; i++) { port = hal->port_data[i].port_id; ret = ioctl(hal_info->fd, CEC_IOC_GET_CONNECT_STATUS, &port); if (ret) { @@ -465,7 +465,6 @@ static void cec_get_port_info(const struct hdmi_cec_device* dev, D("dev:%p, total port:%d\n", dev, *total); if (*total > MAX_PORT) *total = MAX_PORT; - hal_info->total_port = *total; hal_info->port_data = malloc(sizeof(struct hdmi_port_info) * (*total)); if (!hal_info->port_data) { E("alloc port_data failed\n"); @@ -482,6 +481,7 @@ static void cec_get_port_info(const struct hdmi_cec_device* dev, hal_info->port_data[i].physical_address); } *list = hal_info->port_data; + hal_info->total_port = *total; } /* |