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)
committerPavlin Radoslavov <pavlin@google.com>
Fri, 14 Apr 2017 09:59:55 +0000 (02:59 -0700)
commit51b86e9fa59ab53d39bc8cd1dcf9ce898372650f
treea5c887e3f2c3997a62c4297a7992fa4c49e5c1d9
parent4f484079fd27effce2675ed38f3cdf88da42ab04
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
(cherry picked from commit a3292051d9c088769b0f4e46ffaf7c66b1127194)
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