linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] shared/gatt-client: Fix not sending confirmations
@ 2023-08-28 17:55 Luiz Augusto von Dentz
  2023-08-28 19:16 ` [BlueZ] " bluez.test.bot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2023-08-28 17:55 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Commit fde32ff9c9c0 ("shared/gatt-client: Allow registering with NULL
callback") added an early return to the notify_cb function when the
current client's notify_list is empty which prevents sending
confirmations to indications.

Reported-by: Javier de San Pedro <dev.git@javispedro.com>
---
 src/shared/gatt-client.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index efc013a20dcf..5de679c9b29c 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -2232,11 +2232,11 @@ static void notify_cb(struct bt_att_chan *chan, uint8_t opcode,
 	struct bt_gatt_client *client = user_data;
 	struct value_data data;
 
-	if (queue_isempty(client->notify_list))
-		return;
-
 	bt_gatt_client_ref(client);
 
+	if (queue_isempty(client->notify_list))
+		goto done;
+
 	memset(&data, 0, sizeof(data));
 
 	if (opcode == BT_ATT_OP_HANDLE_NFY_MULT) {
@@ -2271,6 +2271,7 @@ static void notify_cb(struct bt_att_chan *chan, uint8_t opcode,
 		queue_foreach(client->notify_list, notify_handler, &data);
 	}
 
+done:
 	if (opcode == BT_ATT_OP_HANDLE_IND && !client->parent)
 		bt_att_chan_send(chan, BT_ATT_OP_HANDLE_CONF, NULL, 0,
 							NULL, NULL, NULL);
-- 
2.41.0


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

* RE: [BlueZ] shared/gatt-client: Fix not sending confirmations
  2023-08-28 17:55 [PATCH BlueZ] shared/gatt-client: Fix not sending confirmations Luiz Augusto von Dentz
@ 2023-08-28 19:16 ` bluez.test.bot
  2023-08-28 19:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  2023-08-29 22:17 ` Javier de San Pedro
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2023-08-28 19:16 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 4001 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=780014

---Test result---

Test Summary:
CheckPatch                    FAIL      0.79 seconds
GitLint                       PASS      0.37 seconds
BuildEll                      PASS      27.87 seconds
BluezMake                     PASS      862.90 seconds
MakeCheck                     PASS      12.61 seconds
MakeDistcheck                 PASS      156.98 seconds
CheckValgrind                 PASS      257.28 seconds
CheckSmatch                   PASS      343.83 seconds
bluezmakeextell               PASS      105.81 seconds
IncrementalBuild              PASS      709.33 seconds
ScanBuild                     WARNING   1073.71 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ] shared/gatt-client: Fix not sending confirmations
WARNING:UNKNOWN_COMMIT_ID: Unknown commit id 'fde32ff9c9c0', maybe rebased or not pulled?
#81: 
Commit fde32ff9c9c0 ("shared/gatt-client: Allow registering with NULL

/github/workspace/src/src/13368176.patch total: 0 errors, 1 warnings, 21 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/13368176.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: ScanBuild - WARNING
Desc: Run Scan Build
Output:
src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed
        gatt_db_unregister(op->client->db, op->db_id);
                           ^~~~~~~~~~
src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed
        discovery_op_complete(op, false, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:993:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1099:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1291:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1356:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1631:6: warning: Use of memory after it is freed
        if (read_db_hash(op)) {
            ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1636:2: warning: Use of memory after it is freed
        discover_all(op);
        ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2140:6: warning: Use of memory after it is freed
        if (read_db_hash(op)) {
            ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2148:8: warning: Use of memory after it is freed
                                                        discovery_op_ref(op),
                                                        ^~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3237:2: warning: Use of memory after it is freed
        complete_write_long_op(req, success, 0, false);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3259:2: warning: Use of memory after it is freed
        request_unref(req);
        ^~~~~~~~~~~~~~~~~~
12 warnings generated.



---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ] shared/gatt-client: Fix not sending confirmations
  2023-08-28 17:55 [PATCH BlueZ] shared/gatt-client: Fix not sending confirmations Luiz Augusto von Dentz
  2023-08-28 19:16 ` [BlueZ] " bluez.test.bot
@ 2023-08-28 19:20 ` patchwork-bot+bluetooth
  2023-08-29 22:17 ` Javier de San Pedro
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2023-08-28 19:20 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon, 28 Aug 2023 10:55:53 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> Commit fde32ff9c9c0 ("shared/gatt-client: Allow registering with NULL
> callback") added an early return to the notify_cb function when the
> current client's notify_list is empty which prevents sending
> confirmations to indications.
> 
> [...]

Here is the summary with links:
  - [BlueZ] shared/gatt-client: Fix not sending confirmations
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=670f0d0f618d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH BlueZ] shared/gatt-client: Fix not sending confirmations
  2023-08-28 17:55 [PATCH BlueZ] shared/gatt-client: Fix not sending confirmations Luiz Augusto von Dentz
  2023-08-28 19:16 ` [BlueZ] " bluez.test.bot
  2023-08-28 19:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth
@ 2023-08-29 22:17 ` Javier de San Pedro
  2 siblings, 0 replies; 4+ messages in thread
From: Javier de San Pedro @ 2023-08-29 22:17 UTC (permalink / raw)
  To: Luiz Augusto von Dentz, linux-bluetooth

El 28/8/23 a las 19:55, Luiz Augusto von Dentz escribió:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> Commit fde32ff9c9c0 ("shared/gatt-client: Allow registering with NULL
> callback") added an early return to the notify_cb function when the
> current client's notify_list is empty which prevents sending
> confirmations to indications.

Thanks, confirming your patch also works for me.

Javier.

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

end of thread, other threads:[~2023-08-29 22:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-28 17:55 [PATCH BlueZ] shared/gatt-client: Fix not sending confirmations Luiz Augusto von Dentz
2023-08-28 19:16 ` [BlueZ] " bluez.test.bot
2023-08-28 19:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth
2023-08-29 22:17 ` Javier de San Pedro

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