summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDudu Lu <phx0fer@gmail.com>2026-04-15 12:39:53 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2026-05-06 23:19:09 +0300
commit72b8deccff17a7644e0367e1aaf1a36cfb014324 (patch)
treec916dcd5d16fe2ac26989d260152bee0d92da32a /include
parent5ddb8014261137cadaf83ab5617a588d80a22586 (diff)
downloadlinux-72b8deccff17a7644e0367e1aaf1a36cfb014324.tar.xz
Bluetooth: bnep: fix incorrect length parsing in bnep_rx_frame() extension handling
In bnep_rx_frame(), the BNEP_FILTER_NET_TYPE_SET and BNEP_FILTER_MULTI_ADDR_SET extension header parsing has two bugs: 1) The 2-byte length field is read with *(u16 *)(skb->data + 1), which performs a native-endian read. The BNEP protocol specifies this field in big-endian (network byte order), and the same file correctly uses get_unaligned_be16() for the identical fields in bnep_ctrl_set_netfilter() and bnep_ctrl_set_mcfilter(). 2) The length is multiplied by 2, but unlike BNEP_SETUP_CONN_REQ where the length byte counts UUID pairs (requiring * 2 for two UUIDs per entry), the filter extension length field already represents the total data size in bytes. This is confirmed by bnep_ctrl_set_netfilter() which reads the same field as a byte count and divides by 4 to get the number of filter entries. The bogus * 2 means skb_pull advances twice as far as it should, either dropping valid data from the next header or causing the pull to fail entirely when the doubled length exceeds the remaining skb. Fix by splitting the pull into two steps: first use skb_pull_data() to safely pull and validate the 3-byte fixed header (ctrl type + length), then pull the variable-length data using the properly decoded length. Fixes: bf8b9a9cb77b ("Bluetooth: bnep: Add support to extended headers of control frames") Signed-off-by: Dudu Lu <phx0fer@gmail.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions