[riot-notifications] [RIOT-OS/RIOT] sys/net/gnrc/sock: release pktsnip when message queue is full (#14091)

Martine Lenders notifications at github.com
Fri May 15 18:53:00 CEST 2020


@miri64 approved this pull request.

Untested ACK. This error is so obvious to me, that it does not require in-depth testing. As long as we don't get a duplicate release (which I doubt highly... if there is I throw a round of beer) this fix does what it intents to do.

The callback is called from the `gnrc_udp` thread or `gnrc_ipv6` thread respectively directly, and as any packet handover, the issuing thread of a NETAPI operation expects the handler to take over responsibility for the packet. For the most part this happens, as the callback puts the packet in the `sock`'s `mbox`. However, when that `mbox` is full, just a warning is printed, but the packet stays in the packet buffer and a `MSG_RECV` event is triggered. This is faulty for 2 reasons:

1. The packet stays in packet buffer, with the responsible handler just popping the reference from its stack at callback return, creating a memory leak.
2. A receive event is issued, while no data had been put into the `sock`'s queue (as it is full).

1\. is solved by the `gnrc_pktbuf_release(pkt)` when the queue is full (`mbox_try_put()` returns a value < 1), 2. is solved by the early return introduced as well.



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/14091#pullrequestreview-412812175
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200515/482dd0e1/attachment.htm>


More information about the notifications mailing list