net: mdns_responder: Use static storage for listener poll arrays (cherry-pick) - #2
Open
mikeysklar wants to merge 1 commit into
Open
Conversation
The socket service dispatcher stores the pointer to the poll fd array passed at registration and reuses it later (e.g. when a peer dispatcher on the same service is unregistered). The IPv6 and IPv4 poll arrays in init_listener() had automatic storage, so this stored pointer dangled once the function returned, leading to a stack-use-after-return. Move the arrays to file scope so they outlive the registration, as the LLMNR responder already does. Assisted-by: Cursor:claude-opus-4.8 Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no> (cherry picked from commit ba0bd94) Signed-off-by: Mikey Sklar <mikeysklar@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picks upstream
ba0bd94d4e9ontozephyr_260803, unchanged. Authorship and sign-off preserved.The socket service dispatcher keeps the poll fd array pointer it was given at registration, but
init_listener()passed arrays with automatic storage, so the pointer dangles once it returns. Upstream moved them to file scope.This branch still has the bug, and the CircuitPython zephyr-cp manifest pins
3c402d80bd8from it:Symptom is intermittent
<hostname>.localfailures with nothing logged. On a SiWx917-DK2605A one probe window answered and a later one gave 0 of 6 rounds; with the fix, 5 reset cycles x 3 rounds all answered. Any zephyr-cp board withCONFIG_MDNS_RESPONDER=yis exposed.Once this lands the
revision:inzephyr-config/west.ymlcan move.On the two red checks, both are pre-existing and not from this patch:
Manifestfails with "Refusing to check out fork pull request code from apull_request_targetworkflow", so it fails for any fork PR here.compliancefails only onsubsys/tracing/perfetto/decode_trace.py(ruff E501 and E722). This patch touches one file,subsys/net/lib/dns/mdns_responder.c.Neither is fixable from a fork.