linux-bluetooth.vger.kernel.org archive mirror
 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

* RE: [BlueZ] advertising: Do not crash in case of adv update failure
  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.test.bot
  2024-04-12  8:23 ` [PATCH BlueZ v2] " Arkadiusz Bokowy
  1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-04-03 19:01 UTC (permalink / raw)
  To: linux-bluetooth, arkadiusz.bokowy

[-- Attachment #1: Type: text/plain, Size: 2754 bytes --]

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=841166

---Test result---

Test Summary:
CheckPatch                    FAIL      0.52 seconds
GitLint                       FAIL      0.49 seconds
BuildEll                      PASS      24.47 seconds
BluezMake                     PASS      1677.49 seconds
MakeCheck                     PASS      13.13 seconds
MakeDistcheck                 PASS      176.03 seconds
CheckValgrind                 PASS      244.92 seconds
CheckSmatch                   PASS      348.86 seconds
bluezmakeextell               PASS      118.37 seconds
IncrementalBuild              PASS      1443.51 seconds
ScanBuild                     PASS      982.29 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ] advertising: Do not crash in case of adv update failure
WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#96: 
bluetoothd: ../src/advertising.c:add_client_complete() Failed to add advertisement: Busy (0x0a)

/github/workspace/src/src/13616515.patch total: 0 errors, 1 warnings, 19 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13616515.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ] advertising: Do not crash in case of adv update failure

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
9: B1 Line exceeds max length (95>80): "bluetoothd: ../src/advertising.c:add_client_complete() Failed to add advertisement: Busy (0x0a)"
10: B1 Line exceeds max length (145>80): "dbus: arguments to dbus_message_get_no_reply() were incorrect, assertion "message != NULL" failed in file ../../../dbus/dbus-message.c line 3235."


---
Regards,
Linux Bluetooth


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

* [PATCH BlueZ v2] advertising: Do not crash in case of adv update failure
  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 ` Arkadiusz Bokowy
  2024-04-12 10:03   ` [BlueZ,v2] " bluez.test.bot
  1 sibling, 1 reply; 4+ messages in thread
From: Arkadiusz Bokowy @ 2024-04-12  8:23 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

* RE: [BlueZ,v2] advertising: Do not crash in case of adv update failure
  2024-04-12  8:23 ` [PATCH BlueZ v2] " Arkadiusz Bokowy
@ 2024-04-12 10:03   ` bluez.test.bot
  0 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-04-12 10:03 UTC (permalink / raw)
  To: linux-bluetooth, arkadiusz.bokowy

[-- Attachment #1: Type: text/plain, Size: 949 bytes --]

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


^ permalink raw reply	[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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).