Skip to content

nvme: reject invalid reconnect_delay sysfs values - #28

Open
ghost wants to merge 1 commit into
for-next_basefrom
series/1203180=>for-next
Open

ghost wants to merge 1 commit into
for-next_basefrom
series/1203180=>for-next

Conversation

@ghost

@ghost ghost commented Nov 10, 2026

Copy link
Copy Markdown

Pull request for series with
subject: nvme: reject invalid reconnect_delay sysfs values
version: 1
url: https://patchwork.kernel.org/series/1203180/

@ghost

ghost commented Nov 10, 2026

Copy link
Copy Markdown
Author

Upstream branch: de52810
series: https://patchwork.kernel.org/series/1203180/
version: 1

@ghost
ghost force-pushed the for-next_base branch from 8c33852 to 18eb5ad Compare November 10, 2026 10:19
@ghost

ghost commented Nov 10, 2026

Copy link
Copy Markdown
Author

Upstream branch: de52810
series: https://patchwork.kernel.org/series/1203180/
version: 1

nvme_ctrl_reconnect_delay_store() stores whatever kstrtou32() accepted
into opts->reconnect_delay without validating it.  The nvme-fabrics
option parser refuses reconnect_delay values that are zero or negative,
and the rest of the driver relies on that: nvme_ctrl_loss_tmo_store()
computes

	opts->max_reconnects = DIV_ROUND_UP(ctrl_loss_tmo,
					    opts->reconnect_delay);

Writing 0 to reconnect_delay and then a positive value to ctrl_loss_tmo
therefore divides by zero in the kernel.  In addition, a value larger
than INT_MAX is truncated to a negative int in the assignment and
silently bypasses the checks done by the fabrics parser.

Reject zero and values that do not fit into the signed int field.

Fixes: 764075f ("nvme: expose reconnect_delay and ctrl_loss_tmo via sysfs")
Cc: stable@vger.kernel.org
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
@ghost
ghost force-pushed the series/1203180=>for-next branch from 764ee5f to a510f75 Compare November 10, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants