You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by gi...@git.apache.org on 2017/06/27 18:28:15 UTC

[GitHub] ccollins476ad opened a new pull request #355: nmgr_ble - don't crash if peer disconnected during MTU query

ccollins476ad opened a new pull request #355: nmgr_ble - don't crash if peer disconnected during MTU query
URL: https://github.com/apache/incubator-mynewt-core/pull/355
 
 
   When queried for the connection's ATT MTU, the BLE newtmgr transport
   assumes the peer is connected.  If the peer is no longer connected when
   the query occurs, a failed assert is triggered.
   
   The assumption that the peer is still connected is not always vaild.  A
   well-timed control-c during a newtmgr image upgrade can trigger this
   crash:
   
   ```
   Program received signal SIGTRAP, Trace/breakpoint trap.
   __assert_func (file=<optimized out>, line=<optimized out>, func=<optimized out>, e=<optimized out>) at kernel/os/src/arch/cortex_m4/os_fault.c:137
   137            asm("bkpt");
   (gdb) whe
   #0  __assert_func (file=<optimized out>, line=<optimized out>, func=<optimized out>, e=<optimized out>) at kernel/os/src/arch/cortex_m4/os_fault.c:137
   #1  0x00025c8e in nmgr_ble_get_mtu (req=<optimized out>) at mgmt/newtmgr/transport/ble/src/newtmgr_ble.c:155
   #2  0x000254aa in nmgr_handle_req (req=0x200016cc <os_msys_init_1_data+336>, nt=0x25c8f <nmgr_ble_get_mtu+30>) at mgmt/newtmgr/src/newtmgr.c:212
   #3  nmgr_process (nt=0x25c8f <nmgr_ble_get_mtu+30>) at mgmt/newtmgr/src/newtmgr.c:334
   #4  nmgr_event_data_in (ev=<optimized out>) at mgmt/newtmgr/src/newtmgr.c:341#5  0x000091b8 in os_eventq_run (evq=<optimized out>) at kernel/os/src/os_eventq.c:172  #6  0x0000886e in main () at apps/bleprph/src/main.c:318
   ```
   
   The fix is to give the transport MTU function a way to indicate failure.
   The function does this by returning 0.  When the MTU function indicates
   failure, the implication is that no sends are possible, so the newtmgr
   command handler aborts without sending a response.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services