Skip to content
Snippets Groups Projects
Commit ae30b17c authored by Hsin-chen Chuang's avatar Hsin-chen Chuang
Browse files

Floss: socket: Reject listening with the same service record

Bug: 296819230
Tag: #floss
Test: Manually register the same UUID twice, the later is rejected
Test: mmm packages/modules/Bluetooth
Change-Id: I0421c808c8d165f9b56775cfbc32b02b04911582
parent 674b6683
No related branches found
No related tags found
No related merge requests found
......@@ -575,6 +575,14 @@ impl BluetoothSocketManager {
log::debug!("service {} is blocked by admin policy", uuid);
return SocketResult::new(BtStatus::AuthRejected, INVALID_SOCKET_ID);
}
if self
.listening
.iter()
.any(|(_, v)| v.iter().any(|s| s.uuid.map_or(false, |u| u == uuid)))
{
log::warn!("Service {} already exists", uuid);
return SocketResult::new(BtStatus::Fail, INVALID_SOCKET_ID);
}
}
// Create listener socket pair
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment