Bluetooth: AVCTP: add error handling for fragmented message.

Fragmented AVCTP message is not supported now. Therefore
A error message is printed.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
This commit is contained in:
Zihao Gao 2024-10-30 10:45:03 +08:00 committed by Anas Nashif
parent 5d322350b4
commit 498f81e45f

View file

@ -80,6 +80,7 @@ static int avctp_l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
struct bt_avctp *session = AVCTP_CHAN(chan);
struct bt_avctp_header *hdr = (void *)buf->data;
uint8_t tid;
bt_avctp_pkt_type_t pkt_type;
bt_avctp_cr_t cr;
if (buf->len < sizeof(*hdr)) {
@ -88,8 +89,20 @@ static int avctp_l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
}
tid = BT_AVCTP_HDR_GET_TRANSACTION_LABLE(hdr);
pkt_type = BT_AVCTP_HDR_GET_PACKET_TYPE(hdr);
cr = BT_AVCTP_HDR_GET_CR(hdr);
switch (pkt_type) {
case BT_AVCTP_PKT_TYPE_SINGLE:
break;
case BT_AVCTP_PKT_TYPE_START:
case BT_AVCTP_PKT_TYPE_CONTINUE:
case BT_AVCTP_PKT_TYPE_END:
default:
LOG_ERR("fragmented AVCTP message is not supported, pkt_type = %d", pkt_type);
return -EINVAL;
}
switch (hdr->pid) {
#if defined(CONFIG_BT_AVRCP)
case sys_cpu_to_be16(BT_SDP_AV_REMOTE_SVCLASS):