OSDN Git Service

Fix a race condition during HCI module shutdown
authorPavlin Radoslavov <pavlin@google.com>
Thu, 13 Apr 2017 21:33:30 +0000 (14:33 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Fri, 14 Apr 2017 06:59:55 +0000 (06:59 +0000)
commita3292051d9c088769b0f4e46ffaf7c66b1127194
tree33a30184f5199647575242b7e315350a035a0db0
parent1f5ec7304fc4e297f9f9868b5bd9382c2a26c8cc
Fix a race condition during HCI module shutdown

If an HCI event (e.g., incoming event) happens during
HCI module shutdown, and the processing of that event
calls update_command_response_timer() right after
"alarm_free(command_response_timer)" in the beginning
of hci_module_shut_down(), then update_command_response_timer()
will try to schedule an alarm on command_response_timer that is NULL.

Test: Enable/disable Bluetooth, added unit tests
Bug: 37241256
Change-Id: I7fd58446caedc135e906953644201f88b5df32bb
hci/src/hci_layer.cc
service/hal/bluetooth_interface.cc
service/hal/bluetooth_interface.h
service/hal/fake_bluetooth_interface.cc
service/hal/fake_bluetooth_interface.h
test/suite/adapter/adapter_unittest.cc