Skip to content

Fix use-after-free in GATT client discovery

Gianluca Altomani linux-bluetooth 1 version Applied

Status from this message: This series was applied to bluetooth/bluez.git (master)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2shared/gatt-db: Always notify service removalsrc/shared/gatt-db.c+7 -22 replies
2/2shared/gatt-client: Fix double-queued servicesrc/shared/gatt-client.c+8 -20 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH BlueZ 0/2] Fix use-after-free in GATT client discovery

bluetoothd crashes in discovery_op_complete() when a discovery of a connected peer's GATT database is cut short, e.g. because the link drops mid-discovery. Two separate bugs leave a freed service in the discovery's pending_svcs queue, and each patch fixes one of them.

It reproduces by connecting over LE, reading one characteristic and disconnecting about once a second, with a peer that answers the remote's GATT discovery. Each connection is short enough that the remote's discovery of the peer is still running when the link drops. On 5.72 bluetoothd crashed on the 15th connection in 4 runs out of 4. With both patches it survived 381 connections in a row. On 5.83, 50 such connections crashed the unpatched daemon within the first minute and pass with both patches.

Gianluca Altomani (2):
shared/gatt-db: Always notify service removal
shared/gatt-client: Fix double-queued service

 src/shared/gatt-client.c | 10 ++++++++--
 src/shared/gatt-db.c     |  9 +++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)
Signature · 1 line
2.55.0