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

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

commit 5ef26fc998b192bc5c078dcd6b8757d87be12247
Author: Szymon Janc <[email protected]>
AuthorDate: Wed Oct 7 18:37:54 2026 +0200

    nimble/host: Handle EATT transmission failure without assert
    
    ble_l2cap_send can fail (e.g. on mbuf allocation failure) but any error
    other than stall or busy resulted in assert in ble_eatt_tx. Return the
    error to the caller instead, freeing the PDU if it was not consumed.
    
    Assisted-by: Claude:claude-opus-5-5
---
 nimble/host/src/ble_eatt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/nimble/host/src/ble_eatt.c b/nimble/host/src/ble_eatt.c
index 7ad5c9288..6bff6a6ee 100644
--- a/nimble/host/src/ble_eatt.c
+++ b/nimble/host/src/ble_eatt.c
@@ -516,9 +516,14 @@ ble_eatt_tx(uint16_t conn_handle, uint16_t cid, struct 
os_mbuf *txom)
          * on BLE_L2CAP_EVENT_COC_TX_UNSTALLED event.
          */
         STAILQ_INSERT_HEAD(&eatt->eatt_tx_q, OS_MBUF_PKTHDR(txom), omp_next);
+    } else if (rc == BLE_HS_EBADDATA) {
+        /* SDU too large, txom was not consumed */
+        BLE_EATT_LOG_ERROR("eatt: %s, ERROR %d\n", __func__, rc);
+        goto error;
     } else {
+        /* Transmission failed, txom was consumed */
         BLE_EATT_LOG_ERROR("eatt: %s, ERROR %d ", __func__, rc);
-        assert(0);
+        return rc;
     }
 done:
     return 0;

Reply via email to