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

nimble/host: Fix SMP command allocation #1920

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

andrzej-kaczmarek
Copy link
Contributor

os_mbuf_extend can allocate new mbuf if there's not enough space in txom for complete SMP command. In such case we write SMP command data to the original mbuf which doesn't have om_len updated instead to newly created mbuf. This can happen especially for SMP Public Key if block size is not large enough to fit pkthdr and 65 bytes of command data.

We should use pointer returned from os_mbuf_extend as a SMP command data pointer as this always points to added space.

os_mbuf_extend can allocate new mbuf if there's not enough space in txom
for complete SMP command. In such case we write SMP command data to the
original mbuf which doesn't have om_len updated instead to newly created
mbuf. This can happen especially for SMP Public Key if block size is not
large enough to fit pkthdr and 65 bytes of command data.

We should use pointer returned from os_mbuf_extend as a SMP command data
pointer as this always points to added space.
@github-actions github-actions bot added host size/XS Extra small PR labels Nov 20, 2024
@andrzej-kaczmarek andrzej-kaczmarek merged commit ca6a764 into apache:master Nov 25, 2024
19 checks passed
@andrzej-kaczmarek andrzej-kaczmarek deleted the smp-buf-fix branch November 25, 2024 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
host size/XS Extra small PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants