apache / mynewt-nimble

Apache mynewt
https://mynewt.apache.org/
Apache License 2.0
664 stars 384 forks source link

Crash when a lot of data needs to be proxied #1220

Open InfiniteYuan opened 2 years ago

InfiniteYuan commented 2 years ago

Problem Describing

Can't alloc os_mbuf when a lot of data needs to be proxied in BLE-MESH, so om is null to cause crash(assert).

static int proxy_send(uint16_t conn_handle, const void *data, uint16_t len) {
    ···
    BT_DBG("%u bytes: %s", len, bt_hex(data, len));
    om = ble_hs_mbuf_from_flat(data, len);
    assert(om);
    err = ble_gatts_notify_custom(conn_handle, svc_handles.proxy_data_out_h, om);
    notify_complete();
    ···
}

Related

These are also handled with assert: pb_gatt_srv.c#L410-L411 and proxy_srv.c#L876-L877. We should reconsider how to deal with it.

InfiniteYuan commented 2 years ago

@michal-narajowski Please help look into this issue. Thx very much.