Skip to content

Commit 3b53c65

Browse files
PavelVPVrlubos
authored andcommitted
Revert "[nrf noup] bluetooth: conn: Allow for an extra ref in bt_l2cap_send_pdu"
This reverts commit b0ce7fe. Signed-off-by: Pavel Vasilyev <[email protected]>
1 parent db82e54 commit 3b53c65

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

subsys/bluetooth/host/conn.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -695,13 +695,7 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf,
695695

696696
uint16_t frag_len = MIN(conn_mtu(conn), len);
697697

698-
if (buf->ref > 1 + (cb ? 1 : 0)) {
699-
/* Allow for an additional buffer reference if callback is provided.
700-
* This can be used to extend lifetime of the net buffer until the
701-
* data transmission is confirmed by ACK of the remote.
702-
*/
703-
__ASSERT_NO_MSG(false);
704-
}
698+
__ASSERT_NO_MSG(buf->ref == 1);
705699

706700
if (buf->len > frag_len) {
707701
LOG_DBG("keep %p around", buf);

subsys/bluetooth/host/l2cap.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -717,17 +717,13 @@ static void cancel_data_ready(struct bt_l2cap_le_chan *le_chan)
717717
int bt_l2cap_send_pdu(struct bt_l2cap_le_chan *le_chan, struct net_buf *pdu,
718718
bt_conn_tx_cb_t cb, void *user_data)
719719
{
720-
/* Allow for an additional buffer reference if callback is provided. This can be used to
721-
* extend lifetime of the net buffer until the data transmission is confirmed by ACK of the
722-
* remote.
723-
*/
724-
if (pdu->ref > 1 + (cb ? 1 : 0)) {
720+
if (pdu->ref != 1) {
725721
/* The host may alter the buf contents when fragmenting. Higher
726722
* layers cannot expect the buf contents to stay intact. Extra
727723
* refs suggests a silent data corruption would occur if not for
728724
* this error.
729725
*/
730-
LOG_ERR("Expecting up to %d refs, got %d", cb ? 2 : 1, pdu->ref);
726+
LOG_ERR("Expecting 1 ref, got %d", pdu->ref);
731727
return -EINVAL;
732728
}
733729

0 commit comments

Comments
 (0)