summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <ricardo@cyngn.com>2016-04-15 16:18:06 +0100
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2016-04-15 08:56:04 -0700
commit22597211f212d570dc0d69caeb3ded4ddae7bf00 (patch)
tree2ca07e72709327474f84adb74c8b5142585c7410
parentd17f144472d68db804c1861a807e799ef1d9edb0 (diff)
downloadandroid_system_bt-22597211f212d570dc0d69caeb3ded4ddae7bf00.tar.gz
android_system_bt-22597211f212d570dc0d69caeb3ded4ddae7bf00.tar.bz2
android_system_bt-22597211f212d570dc0d69caeb3ded4ddae7bf00.zip
bt-vendor: Fix sporadic crashes on shutdown
The core was unconditionally calling a vendor method that few implementations have. Don't do that, it's evil. Change-Id: I96df83760fd07805de37832f7ee315ee1f721948
-rw-r--r--hci/src/vendor.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hci/src/vendor.c b/hci/src/vendor.c
index 8224fc48c..6cf14c19e 100644
--- a/hci/src/vendor.c
+++ b/hci/src/vendor.c
@@ -90,7 +90,11 @@ static void vendor_close(void) {
lib_handle = NULL;
}
void vendor_ssrcleanup(int reason) {
- if (lib_interface)
+ /* This is horrible. Not all implementations have this method (from ours,
+ * only 8992 appears to have it), so never try to call this on vendor
+ * libraries without a "complete" interface (since this is the last one) */
+ if (lib_interface && lib_interface->size >=
+ (sizeof(bt_vendor_interface_t)))
lib_interface->ssr_cleanup(reason);
else
LOG_ERROR("%s lib_interface is NULL", __func__);