net: Do not remove fragments if main buffer is not removed
The fix prevents the net_nbuf_unref() from removing fragment list if the top level net_buf is not removed. Change-Id: Ice580c25bd74f3239c01321f2b9d61cc8c0c9c1d Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
1bf6a529a1
commit
9d0de92f59
1 changed files with 3 additions and 2 deletions
|
@ -542,10 +542,11 @@ void net_nbuf_unref(struct net_buf *buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove the fragment list elements first, otherwise we
|
/* Remove the fragment list elements first, otherwise we
|
||||||
* have a memory leak.
|
* have a memory leak. But only if we are to be remove the
|
||||||
|
* buffer.
|
||||||
*/
|
*/
|
||||||
frag = buf->frags;
|
frag = buf->frags;
|
||||||
while (frag) {
|
while (!(buf->ref - 1) && frag) {
|
||||||
struct net_buf *next = frag->frags;
|
struct net_buf *next = frag->frags;
|
||||||
|
|
||||||
net_buf_frag_del(buf, frag);
|
net_buf_frag_del(buf, frag);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue