From e6f42331baf659b1f0e8bfb94dd61ee245f5e7d8 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 22 Mar 2022 15:51:38 +0000 Subject: [PATCH] lib,rlc_am_nr: fix race condition in handle data PDU. This was causing SDUs being removed from the rx_window, while the status report was geing generated. --- lib/src/rlc/rlc_am_nr.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/rlc/rlc_am_nr.cc b/lib/src/rlc/rlc_am_nr.cc index d920d5504..1de6a85db 100644 --- a/lib/src/rlc/rlc_am_nr.cc +++ b/lib/src/rlc/rlc_am_nr.cc @@ -1064,6 +1064,8 @@ void rlc_am_nr_rx::reestablish() void rlc_am_nr_rx::handle_data_pdu(uint8_t* payload, uint32_t nof_bytes) { + std::lock_guard lock(mutex); + // Get AMD PDU Header rlc_am_nr_pdu_header_t header = {}; uint32_t hdr_len = rlc_am_nr_read_data_pdu_header(payload, nof_bytes, cfg.rx_sn_field_length, &header); @@ -1487,7 +1489,7 @@ bool rlc_am_nr_rx::have_all_segments_been_received( */ void rlc_am_nr_rx::debug_state() const { - RlcDebug("RX entity state: Rx_Next %d, Rx_Next_Status_Trigger %d, Rx_Highest_Status %d, Rx_Next_Highest", + RlcDebug("RX entity state: Rx_Next=%d, Rx_Next_Status_Trigger=%d, Rx_Highest_Status=%d, Rx_Next_Highest=%d", st.rx_next, st.rx_next_status_trigger, st.rx_highest_status,