Skip to content

Commit d120ab1

Browse files
prathjecarlescufi
authored andcommitted
[nrf fromlist] Bluetooth: L2CAP: Fix missing net_buf_unref()
In case of non-recoverable errors (e.g. the connection breaks while transmitting), the l2cap_chan_tx_process deques the net_buf but does not unreference it. As this is inside a work queue thread, the sending thread gets no information on this error, relying on the tx_process to ultimately free the buffer. Upstream PR: zephyrproject-rtos/zephyr#36031 Signed-off-by: Patrick Rathje <[email protected]>
1 parent 960491d commit d120ab1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

subsys/bluetooth/host/l2cap.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,8 @@ static void l2cap_chan_tx_process(struct k_work *work)
872872
if (sent < 0) {
873873
if (sent == -EAGAIN) {
874874
ch->tx_buf = buf;
875+
} else {
876+
net_buf_unref(buf);
875877
}
876878
break;
877879
}

0 commit comments

Comments
 (0)