All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] advertising: Do not crash in case of adv update failure
@ 2024-04-03 17:12 Arkadiusz Bokowy
  2024-04-03 19:01 ` [BlueZ] " bluez.test.bot
  2024-04-12  8:23 ` [PATCH BlueZ v2] " Arkadiusz Bokowy
  0 siblings, 2 replies; 4+ messages in thread
From: Arkadiusz Bokowy @ 2024-04-03 17:12 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Arkadiusz Bokowy

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(-)

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);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-12 10:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-03 17:12 [PATCH BlueZ] advertising: Do not crash in case of adv update failure Arkadiusz Bokowy
2024-04-03 19:01 ` [BlueZ] " bluez.test.bot
2024-04-12  8:23 ` [PATCH BlueZ v2] " Arkadiusz Bokowy
2024-04-12 10:03   ` [BlueZ,v2] " bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.