From 4d66dba0d229e8746839eb8de0a8844ebe40c482 Mon Sep 17 00:00:00 2001
From: Wu Jing <wu.jing@cn.fujitsu.com>
Date: Sat, 8 Jun 2019 13:38:55 +0900
Subject: [PATCH] avoid segfault in RLC

---
 openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c
index 9d69882923d..4a065539013 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c
@@ -938,7 +938,7 @@ rlc_am_rx_check_all_byte_segments(
   rlc_am_pdu_info_t  *pdu_info_p        = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
   mem_block_t        *cursor_p        = NULL;
   mem_block_t        *first_cursor_p  = NULL;
-  rlc_sn_t            sn              = pdu_info_p->sn;
+  rlc_usn_t            sn              = pdu_info_p->sn;
   sdu_size_t          next_waited_so;
   sdu_size_t          last_end_so;
 
@@ -969,6 +969,9 @@ rlc_am_rx_check_all_byte_segments(
   // the so field of the first PDU should be 0
   //cursor_p = list.head;
   //we start from the first stored PDU segment of this SN
+  if(cursor_p->data == NULL){
+    return;
+  }
   pdu_info_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
 
   // if the first segment does not have SO = 0 then no need to continue
@@ -985,6 +988,9 @@ rlc_am_rx_check_all_byte_segments(
   while (cursor_p->next != NULL) {
     //msg("rlc_am_rx_check_all_byte_segments(%d) @4\n",sn);
     cursor_p = cursor_p->next;
+  if(cursor_p->data == NULL){
+    return;
+  }
     pdu_info_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
 
     if (pdu_info_p->sn == sn) {
-- 
GitLab