l1sap: Fix abort on big RTP packet received

Recently while testing new osmo-mgw, big RTP packets (around 4K bytes,
see OS#2625 for more info), were being received on the BTS, which was
aborting with the following message:
"msgb(0xff208): Not enough tailroom msgb_put (348 < 1488)"

The crash can be reproduced in a sysmobts as well as on my PC locally
with osmo-bts-trx. I used osmo-bts-trx to test that the patch solved the
abort.

Fixes: OS#2624

Change-Id: Idfde1dacc3dc3d3d5e239cf1f7e39ade7fc25975
This commit is contained in:
Pau Espin 2017-11-08 16:38:53 +01:00
parent 80117acba6
commit 2564756296
1 changed files with 3 additions and 1 deletions

View File

@ -117,7 +117,9 @@ static void queue_limit_to(const char *prefix, struct llist_head *queue, unsigne
* in front and behind data pointer */
struct msgb *l1sap_msgb_alloc(unsigned int l2_len)
{
struct msgb *msg = msgb_alloc_headroom(512, 128, "l1sap_prim");
int headroom = 128;
int size = headroom + sizeof(struct osmo_phsap_prim) + l2_len;
struct msgb *msg = msgb_alloc_headroom(size, headroom, "l1sap_prim");
if (!msg)
return NULL;