[Backport v4.3-branch] MCTP over I2C+GPIO fixes - #117354
Open
github-actions[bot] wants to merge 3 commits into
Open
[Backport v4.3-branch] MCTP over I2C+GPIO fixes#117354github-actions[bot] wants to merge 3 commits into
github-actions[bot] wants to merge 3 commits into
Conversation
An off by one bug was present on I2C+GPIO check of packet size. It would normally not be a problem if the controller respected the protocol and asked to read only the available bytes. However, a buggy controller could end up reading one byte more from the buffer containing the packet. While at it, ensure that a buggy controller that keeps on reading won't wrap over the counter (a unint8_t variable) and restart reading the current packet. Assisted-by: Claude:claude-opus-5 Signed-off-by: Ederson de Souza <ederson.desouza@intel.com> (cherry picked from commit 66bfe3b)
If a buggy controller issues a read request but the target doesn't have a packet to be read, bail out instead of reading from NULL. Assisted-by: Claude:claude-opus-5 Signed-off-by: Ederson de Souza <ederson.desouza@intel.com> (cherry picked from commit a097178)
To handle tx from the target, the I2C+GPIO support simulates a register/address protocol: controller writes one byte (register address) and reads another (or several) with the contents. However, a buggy controller may confuse the target as the target keeps last read register in its own state machine even after the reading was performed. This patch makes the controller cleanup its state machine after receiving an I2C stop, so it's always read for next reading. Assisted-by: Claude:claude-opus-5 Signed-off-by: Ederson de Souza <ederson.desouza@intel.com> (cherry picked from commit 60f7fee)
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.
Backport 60f7fee~3..60f7fee from #116105.
Original PR description:
Some fixes, all around some "protocol confusion"[1]:
[1] "Protocol" here is the simple protocol used by the target to accept readings from the controller. It was supposed to write to a "register" and read either the length of the available packet or the packet data. But a buggy controller could confuse the target, so some checks are added.
Fixes: #117353