net: pkt: Fix fixed buffer allocation with headroom bug
The size calculation for the first buffer, in case extra headroom is requested, had a bug which could result in a size variable underflow followed by net_buf exhaustion. In case the net_buf size was larger than requested size, but smaller than requested size + headroom, the whole buffer size was subtracted from the requested size. This however did not take the extra headroom into account and in effect could result in underflow. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
14a00f259f
commit
ea191bddaf
1 changed files with 1 additions and 1 deletions
|
|
@ -970,7 +970,7 @@ static struct net_buf *pkt_alloc_buffer(struct net_pkt *pkt,
|
||||||
|
|
||||||
size = 0U;
|
size = 0U;
|
||||||
} else {
|
} else {
|
||||||
size -= current->size;
|
size -= current->size - headroom;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (current->size > size) {
|
if (current->size > size) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue