mac_pdu: fix issue when packing CE but no space left in PDU

we've not checked the return value when adding a new CE, like BSR or PHR,
for a UL MAC PDU. For very small UL grants, this could fail and
we need to remove the subheader again before packing the PDU.

This fixes issue #1649.
master
Andre Puschmann 4 years ago
parent 7d0ae71f17
commit 6364a4513c

@ -200,7 +200,9 @@ uint8_t* mux::pdu_get(srslte::byte_buffer_t* payload, uint32_t pdu_sz)
// MAC control element for BSR, with exception of BSR included for padding;
if (regular_bsr) {
if (pdu_msg.new_subh()) {
pdu_msg.get()->set_bsr(bsr.buff_size, bsr_format_convert(bsr.format));
if (pdu_msg.get()->set_bsr(bsr.buff_size, bsr_format_convert(bsr.format)) == false) {
pdu_msg.del_subh();
}
}
}
@ -209,7 +211,9 @@ uint8_t* mux::pdu_get(srslte::byte_buffer_t* payload, uint32_t pdu_sz)
float phr_value;
if (phr_procedure->generate_phr_on_ul_grant(&phr_value)) {
if (pdu_msg.new_subh()) {
pdu_msg.get()->set_phr(phr_value);
if (pdu_msg.get()->set_phr(phr_value) == false) {
pdu_msg.del_subh();
}
}
}
}
@ -253,7 +257,9 @@ uint8_t* mux::pdu_get(srslte::byte_buffer_t* payload, uint32_t pdu_sz)
// Insert Padding BSR if not inserted Regular/Periodic BSR
if (bsr_procedure->generate_padding_bsr(pdu_msg.rem_size(), &bsr)) {
if (pdu_msg.new_subh()) {
pdu_msg.get()->set_bsr(bsr.buff_size, bsr_format_convert(bsr.format));
if (pdu_msg.get()->set_bsr(bsr.buff_size, bsr_format_convert(bsr.format)) == false) {
pdu_msg.del_subh();
}
}
}
}

Loading…
Cancel
Save