Skip to content

Commit

Permalink
mctpd: check IIDs and opcodes in control protocol responses
Browse files Browse the repository at this point in the history
Currently we ignore the IID and opcode fields in control protocol
response messages. This means we may get a delayed response from an
endpoint, it may be interpreted incorrectly as a response to the next
message.

Instead, allocate new IIDs for each message, then check the IIDs in
responses. We do this through a new common response validation function,
mctp_ctrl_validate_response.

This requires some additional string building for error messages.

Signed-off-by: Jeremy Kerr <[email protected]>
  • Loading branch information
jk-ozlabs committed Jun 29, 2024
1 parent 36da928 commit 473126a
Show file tree
Hide file tree
Showing 5 changed files with 231 additions and 68 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
3. The `tests` option has changed type from `feature` to `boolean`. Tests are
enabled by default.

4. We now enforce IID checks on MCTP control protocol responses; this
prevents odd behaviour from delayed or invalid responses.

### Fixed

1. mctpd: EID assignments now work in the case where a new endpoint has a
Expand Down
5 changes: 5 additions & 0 deletions src/mctp-control-spec.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ struct mctp_ctrl_msg_hdr {
uint8_t command_code;
} __attribute__((__packed__));

struct mctp_ctrl_resp {
struct mctp_ctrl_msg_hdr ctrl_hdr;
uint8_t completion_code;
} __attribute__((packed));

typedef enum {
set_eid,
force_eid,
Expand Down
Loading

0 comments on commit 473126a

Please sign in to comment.