From: Lawrance Liu Date: Tue, 4 Oct 2016 08:09:15 +0000 (+0800) Subject: Improve HOGP input report error handling X-Git-Tag: android-x86-8.1-r1~196^2~67^2~174^2~81 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=9e6f5ad992;p=android-x86%2Fsystem-bt.git Improve HOGP input report error handling This fixes com.android.bluetooth crash when receiving HOGP input report for unknown characteristic. Test: Pair/Unpair BLE mouse/keyboard devices. --- diff --git a/bta/hh/bta_hh_le.cc b/bta/hh/bta_hh_le.cc index 05493d687..5ff0dd5f0 100644 --- a/bta/hh/bta_hh_le.cc +++ b/bta/hh/bta_hh_le.cc @@ -1791,12 +1791,19 @@ void bta_hh_le_input_rpt_notify(tBTA_GATTC_NOTIFY *p_data) if (p_dev_cb == NULL) { - APPL_TRACE_ERROR("notification received from Unknown device"); + APPL_TRACE_ERROR("%s: notification received from Unknown device, conn_id: 0x%04x", + __func__, p_data->conn_id); return; } const tBTA_GATTC_CHARACTERISTIC *p_char = BTA_GATTC_GetCharacteristic(p_dev_cb->conn_id, p_data->handle); + if (p_char == NULL) + { + APPL_TRACE_ERROR("%s: notification received for Unknown Characteristic, conn_id: 0x%04x, handle: 0x%04x", + __func__, p_dev_cb->conn_id, p_data->handle); + return; + } app_id= p_dev_cb->app_id; @@ -1806,7 +1813,8 @@ void bta_hh_le_input_rpt_notify(tBTA_GATTC_NOTIFY *p_data) p_char->handle); if (p_rpt == NULL) { - APPL_TRACE_ERROR("notification received for Unknown Report"); + APPL_TRACE_ERROR("%s: notification received for Unknown Report, uuid: 0x%04x, handle: 0x%04x", + __func__, p_char->uuid.uu.uuid16, p_char->handle); return; }