* [PATCH BlueZ 0/2] Don't probe LE Audio profiles on unpaired devices @ 2026-11-18 14:14 AuthenticSm1les 2026-11-18 14:14 ` [PATCH BlueZ 1/2] profile: Add paired_only flag AuthenticSm1les 2026-11-18 14:14 ` [PATCH BlueZ 2/2] audio: Mark LE Audio client profiles paired_only AuthenticSm1les 0 siblings, 2 replies; 5+ messages in thread From: AuthenticSm1les @ 2026-11-18 14:14 UTC (permalink / raw) To: linux-bluetooth; +Cc: AuthenticSm1les Hi, When an unpaired phone connects to us over LE, for example Android's Quick Share checking a GATT advertisement, bluetoothd probes the LE Audio client profiles. Their reads fail with Insufficient Authentication, bt_att raises security and the phone shows a pairing dialog. That's the issue reported in #1789. In the "Don't auto-bond on reactive GATT security elevation" thread Luiz suggested fixing the plugins rather than the elevation, so this adds a paired_only flag to btd_profile and sets it on the LE Audio client profiles whose services need encryption. Tested on an Intel 8265 (BT 4.2) with a Samsung phone. Quick Share from the unpaired phone no longer gets a pairing dialog, and tmap still reads the phone fine. Pairing over BR/EDR from bluetoothctl still works and an A2DP/HFP headset reconnects as before. Unit tests pass. I couldn't test with real LE Audio hardware, pairing while an LE link is already up, or a dual-mode device paired over BR/EDR and then connecting over LE. Testing on any of those would be appreciated. Link: https://github.com/bluez/bluez/issues/1789 AuthenticSm1les (2): profile: Add paired_only flag audio: Mark LE Audio client profiles paired_only profiles/audio/bap.c | 1 + profiles/audio/bass.c | 1 + profiles/audio/ccp.c | 1 + profiles/audio/csip.c | 1 + profiles/audio/mcp.c | 2 ++ profiles/audio/micp.c | 1 + profiles/audio/vcp.c | 1 + src/device.c | 29 +++++++++++++++++++++++++++++ src/profile.h | 7 +++++++ src/service.c | 13 +++++++++++++ 10 files changed, 57 insertions(+) -- 2.56.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH BlueZ 1/2] profile: Add paired_only flag 2026-11-18 14:14 [PATCH BlueZ 0/2] Don't probe LE Audio profiles on unpaired devices AuthenticSm1les @ 2026-11-18 14:14 ` AuthenticSm1les 2026-11-18 15:04 ` Luiz Augusto von Dentz 2026-11-18 20:06 ` Don't probe LE Audio profiles on unpaired devices bluez.test.bot 2026-11-18 14:14 ` [PATCH BlueZ 2/2] audio: Mark LE Audio client profiles paired_only AuthenticSm1les 1 sibling, 2 replies; 5+ messages in thread From: AuthenticSm1les @ 2026-11-18 14:14 UTC (permalink / raw) To: linux-bluetooth; +Cc: AuthenticSm1les Some profiles talk to remote services that need an encrypted link. When an unpaired device connects to us, for example a phone checking a GATT advertisement, those profiles still get probed, their reads fail with Insufficient Authentication and bt_att bumps the security level. The phone then pops up a pairing request the user never asked for. Add a paired_only flag to btd_profile. service_accept() skips such profiles unless the device is paired, on either bearer, or bonding. device_bonding_complete() accepts them once pairing is done, so there is no need to reconnect. --- src/device.c | 29 +++++++++++++++++++++++++++++ src/profile.h | 7 +++++++ src/service.c | 13 +++++++++++++ 3 files changed, 49 insertions(+) diff --git a/src/device.c b/src/device.c index 36a980d1e..9b410a913 100644 --- a/src/device.c +++ b/src/device.c @@ -4922,6 +4922,28 @@ static void device_accept_gatt_profiles(struct btd_device *device) g_slist_free(services); } +static void device_accept_paired_only_profiles(struct btd_device *device) +{ + GSList *l; + bool initiator = btd_device_is_initiator(device); + GSList *services; + + if (!device->client) + return; + + services = g_slist_copy(device->services); + services = btd_profile_sort_list(services, get_service_profile, NULL); + + for (l = services; l != NULL; l = g_slist_next(l)) { + struct btd_service *service = l->data; + + if (btd_service_get_profile(service)->paired_only) + service_accept(service, initiator); + } + + g_slist_free(services); +} + static void device_remove_gatt_service(struct btd_device *device, struct gatt_db_attribute *attr) { @@ -7582,6 +7604,13 @@ void device_bonding_complete(struct btd_device *device, uint8_t bdaddr_type, device_set_paired(device, bdaddr_type); + /* Profiles that require pairing were turned away while unpaired. + * They are GATT based, so start them once the LE services are known, + * whichever bearer the pairing was done on. + */ + if (device->le_state.svc_resolved) + device_accept_paired_only_profiles(device); + /* If services are already resolved just reply to the pairing * request */ diff --git a/src/profile.h b/src/profile.h index 270f09ea2..add55fdef 100644 --- a/src/profile.h +++ b/src/profile.h @@ -61,6 +61,13 @@ struct btd_profile { */ bool testing; + /* Indicates the profile shall only be accepted on devices that are + * paired or being paired. Use it for profiles whose remote service + * requires an encrypted link, so that a peer that connects to us + * unpaired is not prompted to pair by our attempts to read it. + */ + bool paired_only; + /* Indicates the profile should be ordered after profiles providing * these remote uuids when connecting. The callback function is called * when all uuids have finished connecting (successfully or not). diff --git a/src/service.c b/src/service.c index 8301b1ead..6b35a407c 100644 --- a/src/service.c +++ b/src/service.c @@ -301,6 +301,19 @@ int service_accept(struct btd_service *service, bool initiator) return -ECONNABORTED; } + /* Pairing on either bearer counts: the user chose to pair the device, + * so a missing LE key may be completed when the profile needs it. + */ + if (service->profile->paired_only && + !device_is_paired(service->device, BDADDR_BREDR) && + !device_is_paired(service->device, + btd_device_get_bdaddr_type(service->device)) && + !device_is_bonding(service->device, NULL)) { + DBG("%s requires pairing: not accepting yet", + service->profile->name); + return -ECONNREFUSED; + } + service->initiator = initiator; add_depends(service); -- 2.56.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH BlueZ 1/2] profile: Add paired_only flag 2026-11-18 14:14 ` [PATCH BlueZ 1/2] profile: Add paired_only flag AuthenticSm1les @ 2026-11-18 15:04 ` Luiz Augusto von Dentz 2026-11-18 20:06 ` Don't probe LE Audio profiles on unpaired devices bluez.test.bot 1 sibling, 0 replies; 5+ messages in thread From: Luiz Augusto von Dentz @ 2026-11-18 15:04 UTC (permalink / raw) To: AuthenticSm1les; +Cc: linux-bluetooth Hi, On Wed, Nov 18, 2026 at 9:18 AM AuthenticSm1les <khidarlaminehamdi@gmail.com> wrote: > > Some profiles talk to remote services that need an encrypted link. > When an unpaired device connects to us, for example a phone checking a > GATT advertisement, those profiles still get probed, their reads fail > with Insufficient Authentication and bt_att bumps the security level. > The phone then pops up a pairing request the user never asked for. > > Add a paired_only flag to btd_profile. service_accept() skips such > profiles unless the device is paired, on either bearer, or bonding. > device_bonding_complete() accepts them once pairing is done, so there > is no need to reconnect. > --- > src/device.c | 29 +++++++++++++++++++++++++++++ > src/profile.h | 7 +++++++ > src/service.c | 13 +++++++++++++ > 3 files changed, 49 insertions(+) > > diff --git a/src/device.c b/src/device.c > index 36a980d1e..9b410a913 100644 > --- a/src/device.c > +++ b/src/device.c > @@ -4922,6 +4922,28 @@ static void device_accept_gatt_profiles(struct btd_device *device) > g_slist_free(services); > } > > +static void device_accept_paired_only_profiles(struct btd_device *device) > +{ > + GSList *l; > + bool initiator = btd_device_is_initiator(device); > + GSList *services; > + > + if (!device->client) > + return; > + > + services = g_slist_copy(device->services); > + services = btd_profile_sort_list(services, get_service_profile, NULL); > + > + for (l = services; l != NULL; l = g_slist_next(l)) { > + struct btd_service *service = l->data; > + > + if (btd_service_get_profile(service)->paired_only) > + service_accept(service, initiator); > + } > + > + g_slist_free(services); > +} > + > static void device_remove_gatt_service(struct btd_device *device, > struct gatt_db_attribute *attr) > { > @@ -7582,6 +7604,13 @@ void device_bonding_complete(struct btd_device *device, uint8_t bdaddr_type, > > device_set_paired(device, bdaddr_type); > > + /* Profiles that require pairing were turned away while unpaired. > + * They are GATT based, so start them once the LE services are known, > + * whichever bearer the pairing was done on. > + */ > + if (device->le_state.svc_resolved) > + device_accept_paired_only_profiles(device); > + > /* If services are already resolved just reply to the pairing > * request > */ > diff --git a/src/profile.h b/src/profile.h > index 270f09ea2..add55fdef 100644 > --- a/src/profile.h > +++ b/src/profile.h > @@ -61,6 +61,13 @@ struct btd_profile { > */ > bool testing; > > + /* Indicates the profile shall only be accepted on devices that are > + * paired or being paired. Use it for profiles whose remote service > + * requires an encrypted link, so that a peer that connects to us > + * unpaired is not prompted to pair by our attempts to read it. > + */ > + bool paired_only; > + > /* Indicates the profile should be ordered after profiles providing > * these remote uuids when connecting. The callback function is called > * when all uuids have finished connecting (successfully or not). > diff --git a/src/service.c b/src/service.c > index 8301b1ead..6b35a407c 100644 > --- a/src/service.c > +++ b/src/service.c > @@ -301,6 +301,19 @@ int service_accept(struct btd_service *service, bool initiator) > return -ECONNABORTED; > } > > + /* Pairing on either bearer counts: the user chose to pair the device, > + * so a missing LE key may be completed when the profile needs it. > + */ > + if (service->profile->paired_only && > + !device_is_paired(service->device, BDADDR_BREDR) && > + !device_is_paired(service->device, > + btd_device_get_bdaddr_type(service->device)) && > + !device_is_bonding(service->device, NULL)) { > + DBG("%s requires pairing: not accepting yet", > + service->profile->name); > + return -ECONNREFUSED; > + } > + > service->initiator = initiator; > add_depends(service); > > -- > 2.56.1 Nack, on demand pairing needs to be supported beside this probably breaks server role as well since it won't be probed until the device pairs but that is not what you are really doing here instead it just doesn't call the accept callback, that perhaps can be done by checking if btd_opts.gatt_client is false then the connection cannot be accepted, but that is already the case so I suspect the problem is that you are initiating the connection (aka central) thus why disabling the GATT client doesn't work: if (!btd_device_is_initiator(device) && !btd_opts.gatt_client) { DBG("GATT client disabled: skipping GATT client"); return; } For this to work as intended you will need to be the peripheral, or we need to remove the check for btd_device_is_initiator but it may have other implications since that would stop the central from resolving services, etc. We can try changing [GATT] Client to accept role as well, so you can say Client = central (disables peripheral requests) Client = peripheral (disables central requests) and Client = false (disable all requests). Anyway, this all seems way too complicated compared to just disabling all plugins that you don't need to use. -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Don't probe LE Audio profiles on unpaired devices 2026-11-18 14:14 ` [PATCH BlueZ 1/2] profile: Add paired_only flag AuthenticSm1les 2026-11-18 15:04 ` Luiz Augusto von Dentz @ 2026-11-18 20:06 ` bluez.test.bot 1 sibling, 0 replies; 5+ messages in thread From: bluez.test.bot @ 2026-11-18 20:06 UTC (permalink / raw) To: linux-bluetooth, khidarlaminehamdi [-- Attachment #1: Type: text/plain, Size: 1260 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/series/1215085/ ---Test result--- Test Summary: CheckPatch PASS 0.97 seconds GitLint PASS 0.65 seconds BuildEll PASS 17.87 seconds BluezMake PASS 265.62 seconds MakeCheck PASS 3.56 seconds MakeDistcheck PASS 136.21 seconds CheckValgrind PASS 144.07 seconds CheckSmatch PASS 245.57 seconds bluezmakeextell PASS 90.92 seconds TestFunctional FAIL 1168.70 seconds IncrementalBuild PASS 276.67 seconds ScanBuild PASS 959.21 seconds Details ############################## Test: TestFunctional - FAIL Desc: Run test-functional Output: FAIL functional.test_bap::test_bass_past_earbuds_transport_acquire[hosts11-vm3]: AssertionError: Failed to acquire: org.bluez.Error.Failed https://github.com/bluez/bluez/pull/2845 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH BlueZ 2/2] audio: Mark LE Audio client profiles paired_only 2026-11-18 14:14 [PATCH BlueZ 0/2] Don't probe LE Audio profiles on unpaired devices AuthenticSm1les 2026-11-18 14:14 ` [PATCH BlueZ 1/2] profile: Add paired_only flag AuthenticSm1les @ 2026-11-18 14:14 ` AuthenticSm1les 1 sibling, 0 replies; 5+ messages in thread From: AuthenticSm1les @ 2026-11-18 14:14 UTC (permalink / raw) To: linux-bluetooth; +Cc: AuthenticSm1les All characteristics of these services require encryption, so the profiles can't do anything useful on an unpaired device: bap PACS v1.0.2 Table 3.1, ASCS v1.0.1 Table 4.1 bass BASS v1.0.1 Table 3.1 ccp TBS v1.0 Table 3.1 csip CSIS v1.1 Table 5.1 mcp MCS v1.0.1 Table 3.1 micp MICS v1.0 Table 3.1, AICS v1.0.1 Table 3.1 vcp VCS v1.0.1 Table 3.1, VOCS v1.0.1 Table 3.1 Reading them anyway is what triggers the pairing request, e.g. mcp reading Media Player Name from a phone that only connected to check a GATT advertisement. tmap and gmap are left alone since TMAP/GMAP v1.0.1 section 4.8 wants their characteristics readable without encryption. Note that Device1.Connect() on an unpaired LE Audio device no longer pairs it as a side effect, it has to be paired first. --- profiles/audio/bap.c | 1 + profiles/audio/bass.c | 1 + profiles/audio/ccp.c | 1 + profiles/audio/csip.c | 1 + profiles/audio/mcp.c | 2 ++ profiles/audio/micp.c | 1 + profiles/audio/vcp.c | 1 + 7 files changed, 8 insertions(+) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 457ba5de8..c383101ba 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -4350,6 +4350,7 @@ static void bap_adapter_remove(struct btd_profile *p, static struct btd_profile bap_profile = { .name = "bap", + .paired_only = true, .priority = BTD_PROFILE_PRIORITY_MEDIUM, .bearer = BTD_PROFILE_BEARER_LE, .remote_uuid = PACS_UUID_STR, diff --git a/profiles/audio/bass.c b/profiles/audio/bass.c index fd05195f3..3d36d1a2a 100644 --- a/profiles/audio/bass.c +++ b/profiles/audio/bass.c @@ -2542,6 +2542,7 @@ static void bass_server_remove(struct btd_profile *p, static struct btd_profile bass_service = { .name = "bass", + .paired_only = true, .priority = BTD_PROFILE_PRIORITY_MEDIUM, .bearer = BTD_PROFILE_BEARER_LE, .remote_uuid = BASS_UUID_STR, diff --git a/profiles/audio/ccp.c b/profiles/audio/ccp.c index fb85045bb..bdd685262 100644 --- a/profiles/audio/ccp.c +++ b/profiles/audio/ccp.c @@ -207,6 +207,7 @@ ccp_server_remove(struct btd_profile *p, static struct btd_profile ccp_profile = { .name = "ccp", + .paired_only = true, .priority = BTD_PROFILE_PRIORITY_MEDIUM, .bearer = BTD_PROFILE_BEARER_LE, .remote_uuid = GTBS_UUID_STR, diff --git a/profiles/audio/csip.c b/profiles/audio/csip.c index bbd9e4ffd..3c67bda59 100644 --- a/profiles/audio/csip.c +++ b/profiles/audio/csip.c @@ -302,6 +302,7 @@ static void csip_remove(struct btd_service *service) static struct btd_profile csip_profile = { .name = "csip", + .paired_only = true, .priority = BTD_PROFILE_PRIORITY_MEDIUM, .bearer = BTD_PROFILE_BEARER_LE, .remote_uuid = CSIS_UUID_STR, diff --git a/profiles/audio/mcp.c b/profiles/audio/mcp.c index 7522ca4e6..362d258d5 100644 --- a/profiles/audio/mcp.c +++ b/profiles/audio/mcp.c @@ -1109,6 +1109,7 @@ static void gmcs_remove(struct btd_profile *p, struct btd_adapter *adapter) static struct btd_profile mcp_gmcs_profile = { .name = "mcp-gmcs", + .paired_only = true, .priority = BTD_PROFILE_PRIORITY_MEDIUM, .bearer = BTD_PROFILE_BEARER_LE, .remote_uuid = GMCS_UUID_STR, @@ -1126,6 +1127,7 @@ static struct btd_profile mcp_gmcs_profile = { static struct btd_profile mcp_mcs_profile = { .name = "mcp-mcs", + .paired_only = true, .priority = BTD_PROFILE_PRIORITY_MEDIUM, .bearer = BTD_PROFILE_BEARER_LE, .remote_uuid = MCS_UUID_STR, diff --git a/profiles/audio/micp.c b/profiles/audio/micp.c index 3d39ef5e1..e65bf8461 100644 --- a/profiles/audio/micp.c +++ b/profiles/audio/micp.c @@ -299,6 +299,7 @@ static void micp_server_remove(struct btd_profile *p, static struct btd_profile micp_profile = { .name = "micp", + .paired_only = true, .priority = BTD_PROFILE_PRIORITY_MEDIUM, .bearer = BTD_PROFILE_BEARER_LE, .remote_uuid = MICS_UUID_STR, diff --git a/profiles/audio/vcp.c b/profiles/audio/vcp.c index 00ee2b64b..07ef9fbcb 100644 --- a/profiles/audio/vcp.c +++ b/profiles/audio/vcp.c @@ -331,6 +331,7 @@ static void vcp_server_remove(struct btd_profile *p, static struct btd_profile vcp_profile = { .name = "vcp", + .paired_only = true, .priority = BTD_PROFILE_PRIORITY_MEDIUM, .bearer = BTD_PROFILE_BEARER_LE, .remote_uuid = VCS_UUID_STR, -- 2.56.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-18 20:06 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-18 14:14 [PATCH BlueZ 0/2] Don't probe LE Audio profiles on unpaired devices AuthenticSm1les 2026-11-18 14:14 ` [PATCH BlueZ 1/2] profile: Add paired_only flag AuthenticSm1les 2026-11-18 15:04 ` Luiz Augusto von Dentz 2026-11-18 20:06 ` Don't probe LE Audio profiles on unpaired devices bluez.test.bot 2026-11-18 14:14 ` [PATCH BlueZ 2/2] audio: Mark LE Audio client profiles paired_only AuthenticSm1les
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox