Bluetooth: Host: Fix missing pull left mem in scan pdu

For num_reports field bigger 1, should pull left mem.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This commit is contained in:
Lingao Meng 2022-12-08 11:18:46 +08:00 committed by Carles Cufí
commit f3cea46c75

View file

@ -607,7 +607,7 @@ void bt_hci_le_adv_ext_report(struct net_buf *buf)
*/
create_ext_adv_info(evt, &scan_info);
le_adv_recv(&evt->addr, &scan_info, &buf->b, evt->length);
continue;
goto cont;
}
is_new_advertiser = reassembling_advertiser.state == FRAG_ADV_INACTIVE ||
@ -620,7 +620,7 @@ void bt_hci_le_adv_ext_report(struct net_buf *buf)
*/
create_ext_adv_info(evt, &scan_info);
le_adv_recv(&evt->addr, &scan_info, &buf->b, evt->length);
continue;
goto cont;
}
if (is_new_advertiser && reassembling_advertiser.state == FRAG_ADV_REASSEMBLING) {
@ -629,8 +629,7 @@ void bt_hci_le_adv_ext_report(struct net_buf *buf)
"report is discarded and future scan results may be incomplete. "
"Interleaving of fragmented advertising reports from different "
"advertisers is not yet supported.");
(void)net_buf_pull_mem(buf, evt->length);
continue;
goto cont;
}
if (data_status == BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_INCOMPLETE) {
@ -638,9 +637,8 @@ void bt_hci_le_adv_ext_report(struct net_buf *buf)
* We do not need to keep track of this advertiser.
* Discard this report.
*/
(void)net_buf_pull_mem(buf, evt->length);
reset_reassembling_advertiser();
continue;
goto cont;
}
if (is_new_advertiser) {
@ -660,14 +658,13 @@ void bt_hci_le_adv_ext_report(struct net_buf *buf)
}
if (reassembling_advertiser.state == FRAG_ADV_DISCARDING) {
(void)net_buf_pull_mem(buf, evt->length);
if (!more_to_come) {
/* We do no longer need to keep track of this advertiser as
* all the expected data is received.
*/
reset_reassembling_advertiser();
}
continue;
goto cont;
}
net_buf_simple_add_mem(&ext_scan_buf, buf->data, evt->length);
@ -686,6 +683,7 @@ void bt_hci_le_adv_ext_report(struct net_buf *buf)
/* We do no longer need to keep track of this advertiser. */
reset_reassembling_advertiser();
cont:
net_buf_pull(buf, evt->length);
}
}