Skip to content

mi-mctp: reject multiple MPR responses for a single command - #1159

Merged
igaw merged 1 commit into
linux-nvme:masterfrom
niuxiaoch:patch-1
Nov 24, 2026
Merged

igaw merged 1 commit into
linux-nvme:masterfrom
niuxiaoch:patch-1

Conversation

@niuxiaoch

@niuxiaoch niuxiaoch commented Nov 21, 2026 •

Copy link
Copy Markdown

Per NVMe-MI v2.2 section 4.1.2.3, a More Processing Required (MPR) response shall only be transmitted once for a Command Message. Currently, nvme_mi_mctp_submit() loops unconditionally on every MPR response, allowing a faulty or malicious endpoint sending repeated MPR responses to stall the caller indefinitely while holding the MCTP tag.

Track whether an MPR response has already been received for the current command in mpr_seen and reject any subsequent MPR response with EPROTO, while keeping the existing per-response clamp to ep->mprt_max.

Fixes #1142

@jk-ozlabs

Copy link
Copy Markdown
Collaborator

As I mentioned in #1142, there can only be one MPR response per command; if we want to cap the wait time, we should reject subsequent MPR responses, and so there should be no "cumulative" wait time.

Is there a reason to do otherwise?

@niuxiaoch niuxiaoch changed the title mi-mctp: cap cumulative MPR wait time to mprt_max mi-mctp: reject multiple MPR responses for a single command Nov 23, 2026
@niuxiaoch

Copy link
Copy Markdown
Author

Thanks for the review, @jk-ozlabs! That makes complete sense — I initially went with the cumulative mprt_max approach based on the earlier discussion in #1142, but since NVMe-MI v2.2 § 4.1.2.3 strictly permits only one MPR response per command (and ep->mprt_max defaults to 0), rejecting subsequent MPR responses directly is much cleaner and avoids any unbounded wait even when mprt_max is unset.

I have updated the PR to track mpr_seen and reject any additional MPR response with EPROTO while keeping the existing per-response mprt_max clamp, and will update the corresponding libnvme3 PR (linux-nvme/nvme-cli#4461) accordingly.

@jk-ozlabs

Copy link
Copy Markdown
Collaborator

OK, looks good overall, but no need to split into the two commits - the second mostly removes stuff added in the first.

If you squash these two together, keeping the commit from the second, that should result in a sensible PR.

Per NVMe-MI v2.2 section 4.1.2.3, a More Processing Required (MPR)
response shall only be transmitted once for a Command Message.
Track whether an MPR response has already been received for the current
command and reject any subsequent MPR response with EPROTO, while
keeping the existing per-response clamp to ep->mprt_max.

Fixes: linux-nvme#1142
Signed-off-by: niuxiaoch <niuxiaolong893@gmail.com>
@niuxiaoch

Copy link
Copy Markdown
Author

Squashed into a single commit. Thanks @jk-ozlabs!

@jk-ozlabs jk-ozlabs left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@igaw
igaw merged commit 48b99e6 into linux-nvme:master Nov 24, 2026
12 checks passed
@igaw

igaw commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Thanks a lot everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mi-mctp: unbounded consecutive MPR responses can hang an endpoint indefinitely

3 participants