Commit: d4679ffa4563a72c2eec461707f32f835f48e75c
Parent: 8ecfe3221a699f7e1d731a16a4da8e5c349bf754
Author: Daniel Winkler <danielwinkler@google.com>
Committer: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: 2020-08-17 20:32:44
Tree: e9f1b9043aaa6917dfd04a43b420e1574c22c705

advertising: Fix dbus response for over-advertising client_free would always send a dbus method_return to fix the case where a request to Unregister occurred before the MGMT call returned. However, in the code path where too many advertisements are registered, this method_return prevents the failure from being sent properly. This patch makes sure the reference to the register_advertisement DBusMessage is not stored in the client structure until the end of register_advertisement. This ensures that we only respond once, either in register_advertisement or in client_free, not both. It also changes the dbus response in the fast unregister_advertisement case from a method_return to a btd_error_failed, since the registration was never allowed to complete, and thus was not successful. The patch was tested in the following ways: To verify it did not break the segfault fix in caff2b48ca54bbc57b5da3f63317767489aa5b48, I repro'd the failure by quickly unregistering after registering, and verified that the segfault is still fixed with this change. Ran through our automated tests that register too many advertisements and verify that the registration fails with the intended "Maximum Advertisements Reached" error response.

Diffstat

M src/advertising.c | 12 ++++++++- - - -

1 files changed, 8 insertions(+), 4 deletions(-)

View Full Diff | Patch