Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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