diff options
author | Brian Gix <brian.gix@intel.com> | 2019-12-03 13:04:09 -0800 |
---|---|---|
committer | Brian Gix <brian.gix@intel.com> | 2019-12-04 09:11:46 -0800 |
commit | 681b623c82616ba24e2eebc748a17786fb0cc3b2 (patch) | |
tree | f5fb793d2f0d1b6ac105b768c57e3e5fd61c5201 /mesh/pb-adv.c | |
parent | 467d282562dd3e4056aef74ab16b0bc910c6d074 (diff) | |
download | bluez-681b623c82616ba24e2eebc748a17786fb0cc3b2.tar.gz |
mesh: Rearrange PB-ACK for possible session close
In certain circumstances, reception of PB-ADV messages may trigger
session close. This rearrange ACKs new verified messages before
performing call-back to avoid situations where the session no longer
exists after the message has been handled.
This caused static analysis errors during provisioning, which are now
addressed.
Diffstat (limited to 'mesh/pb-adv.c')
-rw-r--r-- | mesh/pb-adv.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mesh/pb-adv.c b/mesh/pb-adv.c index 586cd7f15..27cbc469e 100644 --- a/mesh/pb-adv.c +++ b/mesh/pb-adv.c @@ -254,7 +254,7 @@ static void pb_adv_packet(void *user_data, const uint8_t *pkt, uint16_t len) uint8_t type; bool first; - if (!session || pb_session != session) + if (!pb_session || pb_session != session) return; link_id = l_get_be32(pkt + 1); @@ -426,14 +426,14 @@ static void pb_adv_packet(void *user_data, const uint8_t *pkt, uint16_t len) return; } + send_ack(session, session->peer_trans_num); + if (session->last_peer_trans_num != session->peer_trans_num) { session->got_segs = 0; + session->last_peer_trans_num = session->peer_trans_num; session->rx_cb(session->user_data, session->sar, session->exp_len); } - - session->last_peer_trans_num = session->peer_trans_num; - send_ack(session, session->last_peer_trans_num); } } |