Skip to content

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

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, libnvme_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: linux-nvme/libnvme#1142

Comment thread libnvme/src/nvme/mi-mctp.c Outdated
"MPR maximum wait time exceeded\n");
errno = ETIMEDOUT;
rc = -1;
goto out;

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.

The error code should be directly returned. we stopped using errno.

@niuxiaoch

Copy link
Copy Markdown
Author

Updated to return -ETIMEDOUT directly without setting errno. Thanks!

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

Copy link
Copy Markdown
Author

Following @jk-ozlabs's review on linux-nvme/libnvme#1159, I have reworked this patch to reject subsequent MPR responses per command directly with -EPROTO (without using errno) while keeping the existing per-response mprt_max clamp. Please take another look when you have time!

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/libnvme#1142
Signed-off-by: niuxiaoch <niuxiaolong893@gmail.com>
@igaw
igaw merged commit c734bd8 into linux-nvme:master Nov 24, 2026
37 of 38 checks passed
@igaw

igaw commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

thanks!

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

2 participants