This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 9bcfd2d43a752300c08def7e8702aafe852345b5
Author: Szymon Janc <[email protected]>
AuthorDate: Mon Dec 8 15:19:57 2025 +0100

    nimble/host: Drop incoming data when disconnecting L2CAP channel
    
    There is no point in processing data on channel that is disconnecting.
---
 nimble/host/src/ble_l2cap.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/nimble/host/src/ble_l2cap.c b/nimble/host/src/ble_l2cap.c
index 69e879918..584f44312 100644
--- a/nimble/host/src/ble_l2cap.c
+++ b/nimble/host/src/ble_l2cap.c
@@ -397,6 +397,12 @@ ble_l2cap_rx(uint16_t conn_handle, uint8_t pb, struct 
os_mbuf *om)
         return BLE_HS_ENOENT;
     }
 
+    /* disconnect pending, drop data */
+    if (chan->flags & BLE_L2CAP_CHAN_F_DISCONNECTING) {
+        os_mbuf_free_chain(rx_frags);
+        return 0;
+    }
+
     if (chan->dcid >= BLE_L2CAP_COC_CID_START &&
         chan->dcid <= BLE_L2CAP_COC_CID_END && rx_len > chan->my_coc_mps) {
         ble_l2cap_disconnect(chan);

Reply via email to