nimble/l2cap: Fix locking when receiving LE CoC credit update Lets remove lock once we have conn and chan. Functions ble_l2cap_coc_continue_tx() and ble_l2cap_sig_disconnect() do own locking when needed,
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f902592a Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f902592a Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f902592a Branch: refs/heads/master Commit: f902592a8e83030111a5555be12530a681ca6b97 Parents: 04d4600 Author: Åukasz Rymanowski <[email protected]> Authored: Tue Mar 14 14:37:20 2017 +0100 Committer: Åukasz Rymanowski <[email protected]> Committed: Thu Apr 6 10:04:03 2017 +0200 ---------------------------------------------------------------------- net/nimble/host/src/ble_l2cap_coc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f902592a/net/nimble/host/src/ble_l2cap_coc.c ---------------------------------------------------------------------- diff --git a/net/nimble/host/src/ble_l2cap_coc.c b/net/nimble/host/src/ble_l2cap_coc.c index fbfbf31..3f8373f 100644 --- a/net/nimble/host/src/ble_l2cap_coc.c +++ b/net/nimble/host/src/ble_l2cap_coc.c @@ -437,15 +437,14 @@ ble_l2cap_coc_le_credits_update(uint16_t conn_handle, uint16_t dcid, if (chan->coc_tx.credits + credits > 0xFFFF) { BLE_HS_LOG(INFO, "LE CoC credits overflow...disconnecting\n"); - ble_l2cap_sig_disconnect(chan); ble_hs_unlock(); + ble_l2cap_sig_disconnect(chan); return; } chan->coc_tx.credits += credits; - ble_l2cap_coc_continue_tx(chan); - ble_hs_unlock(); + ble_l2cap_coc_continue_tx(chan); } void
