CVE-2026-58990 AI-generated analysis
platform/packages/modules/Bluetooth, system/stack/l2cap (L2CAP flow control / ERTM configuration, l2c_fcr.cc)
Adds a minimum-MPS check in l2c_fcr_process_peer_cfg_req so that a peer L2CAP CONFIG_REQ carrying an ERTM/streaming MPS of 1..7 is overridden to 8 and rejected as L2CAP_PEER_CFG_UNACCEPTABLE, preventing a later uint16 underflow of max_pdu - L2CAP_SDU_LEN_OVERHEAD used for buffer sizing.
Root cause
l2c_fcr_process_peer_cfg_req in system/stack/l2cap/l2c_fcr.cc only clamped the peer's requested FCR MPS from above (MPS == 0 or MPS > peer MTU is replaced by the peer MTU; MPS > max_retrans_size is clamped to max_retrans_size). There was no lower bound, so a remote CONFIG_REQ with fcr_present, a non-basic mode and an MPS of 1 was accepted. According to the commit message, during L2CAP transmission the Maximum PDU Payload Size (max_pdu) is derived from this MPS, and max_pdu - L2CAP_SDU_LEN_OVERHEAD (2) is computed in a uint16; with max_pdu == 1 this underflows to 65535 and that value is then used for a buffer allocation, producing a roughly 65 KB heap overflow. The transmit-side code is not included in the material.
How the fix works
- system/stack/l2cap/l2c_fcr.cc:l2c_fcr_process_peer_cfg_req: inside the fcr_ok == L2CAP_PEER_CFG_OK block, in the branch for p_cfg->fcr_present && mode != L2CAP_FCR_BASIC_MODE, a new check is inserted before the existing 'MPS not bigger than MTU' check: if p_cfg->fcr.mps > 0 && p_cfg->fcr.mps < 8, then p_cfg->fcr.mps = 8, p_ccb->out_cfg_fcr_present = true, and fcr_ok = L2CAP_PEER_CFG_UNACCEPTABLE.
- Effect: a peer MPS in the range 1..7 can no longer be stored as the negotiated MPS; the response carries FCR parameters with MPS 8 and the configuration is reported as unacceptable to the caller (l2cu_process_peer_cfg_req in system/stack/l2cap/l2c_utils.cc, per index search). The existing upper-bound clamps (peer MTU, max_retrans_size) still run afterwards on the adjusted value.
- The fix is purely at negotiation time; the subtraction site in the transmit path that underflows is not changed.
Completeness
- Covers the peer CONFIG_REQ path only (l2c_fcr_process_peer_cfg_req), and only when fcr_present is set and mode is not L2CAP_FCR_BASIC_MODE, and only when fcr_ok is still L2CAP_PEER_CFG_OK when the block is entered (i.e. the requested mode was accepted).
- MPS == 0 is deliberately excluded from the new check and continues to be replaced by p_ccb->peer_cfg.mtu by the pre-existing check; whether peer_cfg.mtu itself is guaranteed >= 8 at this point is not shown in the material (the index snippet of l2cu_process_peer_cfg_req computes required_remote_mtu as at least L2CAP_MIN_MTU and has a 'Make sure MTU is at least the minimum' comment, but the enforcing code and its ordering relative to this call are not shown).
- The underflowing subtraction (max_pdu - L2CAP_SDU_LEN_OVERHEAD) in the transmit path is not hardened itself; the fix relies on the negotiated MPS never being below 8. Any other path that sets the effective MPS (for example processing of a peer CONFIG_RSP, or locally supplied FCR parameters) is not touched by this diff and is not shown in the material.
- The minimum of 8 is a hard-coded literal, not a named constant; it is larger than the 2-byte L2CAP_SDU_LEN_OVERHEAD cited as the underflow cause.
Behavior changes
- Peer CONFIG_REQ with non-basic FCR mode and MPS in 1..7 is now answered as unacceptable (fcr_ok = L2CAP_PEER_CFG_UNACCEPTABLE) with FCR parameters included in the response and MPS set to 8; previously such values were accepted (subject only to the upper clamps).
- No change for MPS == 0 or MPS >= 8; basic mode channels are unaffected.
Per major
- Android 14: same fix: commit 2d09a1bdb0c2 in android-security-14.0.0_r31 adds the identical 7-line block in l2c_fcr_process_peer_cfg_req (context uses L2CAP_FCS_LEN); 4/4 lines of the patched region present.
- Android 15: same fix: commit 54b3732cd1c8 in android-security-15.0.0_r19, identical block, cherry-picked from c2a47d8f70ef; 4/4 lines present.
- Android 16: same fix: commit a3809a8ad783 in android-security-16.0.0_r10, identical block; surrounding max_retrans_size computation uses fcs_len instead of L2CAP_FCS_LEN but the inserted code is unchanged; 5/5 lines present.
- Android 17: same fix: commit 11b436976323 in android-security-17.0.0_r3, identical block; surrounding context differs slightly (the max_retrans_size computation sits inside an enclosing block that closes just before the insertion) but the inserted code is unchanged; 4/4 lines present.
Unknowns
- The transmit-side code where max_pdu is derived from the MPS and L2CAP_SDU_LEN_OVERHEAD is subtracted, and the allocation that consumes the underflowed value, are described only in the commit message and not shown.
- Whether a CONFIG_RSP processing path or local configuration can set an MPS below 8 without passing through this check.
- Whether peer_cfg.mtu is guaranteed to be at least 8 when MPS == 0 is replaced by it.
- The commit message references atest net_test_stack_l2cap, but no test changes appear in the diff; whether a regression test was added elsewhere is not shown.
- Why the bulletin classifies the issue as ID (information disclosure) while the commit describes a heap overflow is not explained in the material.