Skip to content

shared/gatt-client: Track internal discovery reads

Kyle Pepper linux-bluetooth 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest3 patches 1 replyIn review

Changes in v2 from the cover letter

- Reuse pending_requests instead of adding per-read client fields.
- Separate shared support from each fix and its tests.
- Test queued, pending and continued reads. Cache Server Features in the Database Hash tests so they exercise that fix independently.
- Rebase onto current master, preserving its GATT parser updates.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3shared/gatt-client: Support pending GATT helper requestssrc/shared/gatt-client.c src/shared/gatt-helpers.c src/shared/gatt-helpers.h+39 -41 reply
2/3shared/gatt-client: Track pending Server Features readssrc/shared/gatt-client.c unit/test-gatt.c+43 -60 replies
3/3shared/gatt-client: Track pending discovery Database Hash readssrc/shared/gatt-client.c unit/test-gatt.c+62 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] shared/gatt-client: Track internal discovery reads

Track Server Features and discovery Database Hash reads in pending_requests so client cancellation releases them before the client is freed.

Patch 1 adds shared request support. Patches 2 and 3 fix each read with separate native ATT tests. Both depend only on patch 1; either fix and its tests can be reverted independently.

Changes in v2:
- Reuse pending_requests instead of adding per-read client fields.
- Separate shared support from each fix and its tests.
- Test queued, pending and continued reads. Cache Server Features in the Database Hash tests so they exercise that fix independently.
- Rebase onto current master, preserving its GATT parser updates.

GCC and Clang ASan/UBSan and GCC LTO: 236 passed, zero failed, one not run. All six regressions reproduce the use-after-free on the unchanged base. Removing either fix reproduces only that read's three regressions; the other three still pass. Both reverts apply cleanly. Checkpatch passes. Native make check passes all 35 programs with Valgrind disabled; the host's Valgrind crashes in the dynamic loader before executing tests.

Previous version:
https://lore.kernel.org/linux-bluetooth/[email protected]/

Kyle Pepper (3):
shared/gatt-client: Support pending GATT helper requests shared/gatt-client: Track pending Server Features reads shared/gatt-client: Track pending discovery Database Hash reads

 src/shared/gatt-client.c  | 58 +++++++++++++++++++++++++-------
 src/shared/gatt-helpers.c | 26 ++++++++++++---
 src/shared/gatt-helpers.h |  7 ++++
 unit/test-gatt.c          | 70 ++++++++++++++++++++++++++++++++++++++-
 4 files changed, 144 insertions(+), 17 deletions(-)

base-commit: 9659adb6819d7e0284d0d2ba226a3894423d8db4

Signature · 1 line
2.56.0