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 Oct 17, 2024
1 parent 9986862 commit 13ff37d
Show file tree
Hide file tree
Showing 5 changed files with 234 additions and 68 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Changed

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

## [2.0] - 2024-09-19

### Added
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 13ff37d

Please sign in to comment.