Repository navigation
mgmt/smp_uart: Fix TX fragment size and RX line handling - #3837
Merged
Merged
Conversation
NUS_EV_TO_STATE() casted pointer to int, which failed to build with -Werror=pointer-to-int-cast on 64-bit hosts, e.g. for native BSP. Use CONTAINER_OF() instead. Assisted-by: Claude:claude-opus-5-5
First fragment of a frame is prefixed with 2 bytes of frame length, so only sizeof(tmp_buf) - 2 bytes of data fit in tmp_buf. The check added the prefix length instead of subtracting it, so responses of 11 to 14 bytes, e.g. response to os reset request, were copied past the end of tmp_buf on stack. Assisted-by: Claude:claude-opus-5-5
Received line was handed over to the mgmt task in a single slot and assert checked that previous line was already processed. Frames of a packet longer than one line are sent back to back, so it was enough for the mgmt task to be busy for a moment, e.g. when processing a previous request, to hit the assert. Two newline characters sent quickly were enough to trigger it on purpose. Queue received lines and process all of them in mgmt task. Also initialize the queue and the event callback before opening UART as data may be received as soon as UART is opened. Assisted-by: Claude:claude-opus-5-5
andrzej-kaczmarek
approved these changes
Oct 25, 2026
Frames were appended to partially received packet until its length matched packet length declared in the first frame, which could be up to 64 KB, pinning mbufs until msys pool was exhausted and no further input could be received. Packet length was also read from the first frame even if it was too short to contain it. Drop packets longer than MTU or longer than their declared length. Assisted-by: Claude:claude-opus-5-5
Characters were appended to received line until mbuf allocation failed, draining msys pool. Lines longer than maximum frame length are invalid, drop characters past it. Assisted-by: Claude:claude-opus-5-5
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.
No description provided.