All of lore.kernel.org
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: shao.mingyin@zte.com.cn,kbusch@kernel.org
Cc: <stable@vger.kernel.org>
Subject: FAILED: patch "[PATCH] nvme: reject invalid reconnect_delay sysfs values" failed to apply to 6.1-stable tree
Date: Wed, 02 Dec 2026 14:51:40 +0100	[thread overview]
Message-ID: <2026120240-olympics-conceded-8003@gregkh> (raw)


The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x f92fe8dea19c743eb9e4d998ae0384344dd40091
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026120240-olympics-conceded-8003@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'

Possible dependencies:



thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From f92fe8dea19c743eb9e4d998ae0384344dd40091 Mon Sep 17 00:00:00 2001
From: Shao Mingyin <shao.mingyin@zte.com.cn>
Date: Thu, 5 Nov 2026 21:58:07 +0800
Subject: [PATCH] nvme: reject invalid reconnect_delay sysfs values

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: 764075fdcb2f ("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>
Signed-off-by: Keith Busch <kbusch@kernel.org>

diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
index 3724b5ce03a0..9672ca3f74d2 100644
--- a/drivers/nvme/host/sysfs.c
+++ b/drivers/nvme/host/sysfs.c
@@ -632,6 +632,9 @@ static ssize_t nvme_ctrl_reconnect_delay_store(struct device *dev,
 	if (err)
 		return err;
 
+	if (!v || v > INT_MAX)
+		return -EINVAL;
+
 	ctrl->opts->reconnect_delay = v;
 	return count;
 }


                 reply	other threads:[~2026-12-02 14:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2026120240-olympics-conceded-8003@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=kbusch@kernel.org \
    --cc=shao.mingyin@zte.com.cn \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.