Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport v4.0-branch] net: socket: Release packets in accepted socket in close #85054

Open
wants to merge 1 commit into
base: v4.0-branch
Choose a base branch
from

Conversation

zephyrbot
Copy link
Collaborator

@zephyrbot zephyrbot commented Feb 3, 2025

Backport 535e70a from #84660.

Fixes #84538

If we have received data to the accepted socket, then release
those before removing the accepted socket. This is a rare event
as it requires that we get multiple simultaneous connections
and there is a failure before the socket accept is called by
the application.
For example one such scenario is when HTTP server receives multiple
connection attempts at the same time, and the server poll fails
before socket accept is called. This leads to buffer leak as the
socket close is not called for the accepted socket because the
accepted is not yet created from application point of view.
The solution is to flush the received queue of the accepted socket
before removing the actual accepted socket.

Fixes #84538

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit 535e70a)
@zephyrbot zephyrbot added Backport Backport PR and backport failure issues area: Sockets Networking sockets area: Networking labels Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking area: Sockets Networking sockets Backport Backport PR and backport failure issues
Projects
Status: To do
Development

Successfully merging this pull request may close these issues.

3 participants