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

Commit df09c2c4 authored by Liang Li's avatar Liang Li
Browse files

Add guardrail for offload RFCOMM socket local mtu

The offload stack may not know about the L2CAP mtu used for the offload RFCOMM socket, so it is safer to gate the local mtu in the BT stack in case a very large mtu is requested for the socket.

Flag: com.android.bluetooth.flags.socket_settings_api
Bug: 342012881
Bug: 374358112
Test: m com.android.btservices
Change-Id: I18e5de7514cde1c67c9c7ace201cd2a18dd264e9
parent 7190f0a8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -206,7 +206,8 @@ int RFCOMM_CreateConnectionWithSecurity(uint16_t uuid, uint8_t scn, bool is_serv
    p_port->rfc_cfg_info = cfg;
    // Update the local mtu with the optional configuration if set by the app
    if (p_port->rfc_cfg_info.rx_mtu_present) {
      p_port->mtu = p_port->rfc_cfg_info.rx_mtu;
      p_port->mtu =
              (p_port->rfc_cfg_info.rx_mtu < rfcomm_mtu) ? p_port->rfc_cfg_info.rx_mtu : rfcomm_mtu;
    }
  }