diff mbox series

[BlueZ,v2] advertising: Do not crash in case of adv update failure

Message ID 20240412082351.930802-1-arkadiusz.bokowy@gmail.com (mailing list archive)
State New
Headers show
Series [BlueZ,v2] advertising: Do not crash in case of adv update failure | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Arkadiusz Bokowy April 12, 2024, 8:23 a.m. UTC
The refresh_extended_adv() is used in case of direct advertising
request from the client or in case of advertising properties update
or configured advertising timeout. In the two latter cases it is not
possible to prepare reply D-Bus message, because there is no request
message to begin with.

bluetoothd: ../src/advertising.c:add_client_complete() Failed to add
            advertisement: Busy (0x0a)
dbus: arguments to dbus_message_get_no_reply() were incorrect, assertion
"message != NULL" failed in file ../../../dbus/dbus-message.c line 3235.
This is normally a bug in some application using the D-Bus library.
---
 src/advertising.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com April 12, 2024, 10:03 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=843919

---Test result---

Test Summary:
CheckPatch                    PASS      0.31 seconds
GitLint                       PASS      0.22 seconds
BuildEll                      PASS      24.27 seconds
BluezMake                     PASS      1679.26 seconds
MakeCheck                     PASS      12.80 seconds
MakeDistcheck                 PASS      179.41 seconds
CheckValgrind                 PASS      248.75 seconds
CheckSmatch                   PASS      349.07 seconds
bluezmakeextell               PASS      118.00 seconds
IncrementalBuild              PASS      1422.69 seconds
ScanBuild                     PASS      1037.22 seconds



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/advertising.c b/src/advertising.c
index 7f55a20e3..ad28f6f77 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -1259,9 +1259,18 @@  static void add_client_complete(struct btd_adv_client *client, uint8_t status)
 {
 	DBusMessage *reply;
 
-	if (status) {
+	if (status)
 		error("Failed to add advertisement: %s (0x%02x)",
 						mgmt_errstr(status), status);
+
+	/* If the advertising request was not started by a direct call from
+	 * the client, but rather by a refresh due to properties update or
+	 * our internal timer, there is nothing to reply to.
+	 */
+	if (client->reg == NULL)
+		return;
+
+	if (status) {
 		reply = btd_error_failed(client->reg,
 					"Failed to register advertisement");
 		queue_remove(client->manager->clients, client);