From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796221464; b=G0UzH/iTHxZEOrn7GVXSert4pscEpdRdfwAGXUAyP1r1YjyZIQA4yu+nHaYjqQjguKEs TLWkUi34l2PiB0DOi2FIb/e+zbEzHA7ugctfJKp0RUmFwYnd+rcsSTjhmnnAQdDVC/xHz afSpmcb5yHBFo4B/YQRBUfRS979bK3o1VKXorRP8aMwBi/LMbuXUuV9c/6kae+a74IPvH VteaIu+buZZlLTgq9jW1/DCu1uYRjRZu3Ga4jeFrT7bkicpVtDQCvrZtuiKy044mfpCYu F23jT5cHGB84COuZGSt3SfMPpcXULBBCUwam6LHxhM5ekVo0h6TeIrkbqVll21UZ+yw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221464; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=rYLL54iy46SwAHrWaI/ncgBRujb5VMUQM23sbXaC9ik=; b=nZ1hbl5HBvj6cvz3cyMRJboL6y4HgL1DYDyCBpYrRiUDR/wVUvyoc7bu650LlE6P1h67 iKoCfF7ea1XD31a+5LN45K91Qqn21UrQbE0rzgXOiSxam/d6BHea9jYrLZCPZ/ei0X8EZ mClKVbELjYVeVDbhk7YLtarJsspFWgMx9RelDaPO/PwktaidZHz5na1htDNxfekpuixgC ZIrj+0V5RsVAVwwv1uX5cMgzH3ZLMuHO4UDwcfJGg+oUMZ9dpmJZmS1g/e72WqpqCoooY bqpcXHnPCG2PqfmBwGE4k69+ribUDnly/dsYzhTbqxHlqUA8As09+AhNmZUiJrXEGMA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=inyrS48T; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B7EF606A31A for ; Wed, 2 Dec 2026 14:24:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=inyrS48T Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD5781F000C1; Wed, 2 Dec 2026 14:24:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221464; bh=rYLL54iy46SwAHrWaI/ncgBRujb5VMUQM23sbXaC9ik=; h=Subject:To:Cc:From:Date; b=inyrS48Tb7Ll1OSXuQpVTyQ5K+FSeKEEM7agmbL90ATOXjr3PtJEqhYHR1y6vTHdd YDTrv/EBzEFcLCB73PnytK4OZ25nqlguD2R/YAEg5YjgGMXm3Fe4U8oZnPh68/m7mX JYNGzxJ9qg6fGFmqDMNnyS6LaxMcTUYnI2IimTb4= Subject: FAILED: patch "[PATCH] nvme: avoid wrapping admin_timeout and io_timeout" failed to apply to 6.6-stable tree To: 1075151112@qq.com,hch@lst.de,kbusch@kernel.org Cc: From: Date: Wed, 02 Dec 2026 14:51:24 +0100 Message-ID: <2026120224-president-backdrop-13ff@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-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 . 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.6.y git checkout FETCH_HEAD git cherry-pick -x 4a5aeebf1a00360bcc53c9e29fcd8d47aefa4c1d # git commit -s git send-email --to '' --in-reply-to '2026120224-president-backdrop-13ff@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 4a5aeebf1a00360bcc53c9e29fcd8d47aefa4c1d Mon Sep 17 00:00:00 2001 From: Yingjie Wang <1075151112@qq.com> Date: Fri, 6 Nov 2026 14:25:16 +0800 Subject: [PATCH] nvme: avoid wrapping admin_timeout and io_timeout NVME_ADMIN_TIMEOUT and NVME_IO_TIMEOUT multiply the admin_timeout and io_timeout module parameters by HZ in unsigned int arithmetic, and nvme_fw_act_work() does the same through secs_to_jiffies(). The parameters accept any unsigned int, so values above UINT_MAX / HZ wrap. With HZ=1000, io_timeout=4294968 becomes 704 jiffies, and a controller created afterwards times out I/O after 0.7 seconds instead of about 49.7 days. On 32-bit systems, results above MAX_JIFFY_OFFSET are also unsafe relative delays and can be treated as already expired. These large values are used in practice. AWS documents nvme_core.io_timeout=4294967295 for EBS volumes and says Amazon Linux uses it by default. With HZ=1000, the current code happens to wrap this setting to 4294966296 jiffies, which still behaves as a long timeout on 64-bit systems. Add nvme_timeout_to_jiffies(), which caps the seconds value so that the result fits the u32 timeout fields and stays within MAX_JIFFY_OFFSET for 32-bit timers, and use it for both macros and for the firmware activation wait. On 64-bit kernels every timeout that did not wrap is unchanged. Larger values saturate instead of being rejected so that the documented setting keeps a long timeout. Fixes: 8ae4e4477d8f ("nvme: update timeout module parameter type") Cc: stable@vger.kernel.org Signed-off-by: Yingjie Wang <1075151112@qq.com> Reviewed-by: Christoph Hellwig Signed-off-by: Keith Busch diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index f4aa02869b79..5b642b5aec1a 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -4903,7 +4903,7 @@ static void nvme_fw_act_work(struct work_struct *work) if (ctrl->mtfa) fw_act_timeout = jiffies + msecs_to_jiffies(ctrl->mtfa * 100); else - fw_act_timeout = jiffies + secs_to_jiffies(admin_timeout); + fw_act_timeout = jiffies + NVME_ADMIN_TIMEOUT; nvme_quiesce_io_queues(ctrl); while (nvme_ctrl_pp_status(ctrl)) { diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 8833a463f1c8..2543e52d6358 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -22,11 +22,20 @@ extern const struct pr_ops nvme_pr_ops; +/* Seconds to jiffies, capped for the u32 timeouts and timer delays */ +static inline unsigned int nvme_timeout_to_jiffies(unsigned int timeout) +{ + unsigned long max_secs; + + max_secs = min_t(unsigned long, UINT_MAX, MAX_JIFFY_OFFSET) / HZ; + return min_t(unsigned long, timeout, max_secs) * HZ; +} + extern unsigned int nvme_io_timeout; -#define NVME_IO_TIMEOUT (nvme_io_timeout * HZ) +#define NVME_IO_TIMEOUT nvme_timeout_to_jiffies(nvme_io_timeout) extern unsigned int admin_timeout; -#define NVME_ADMIN_TIMEOUT (admin_timeout * HZ) +#define NVME_ADMIN_TIMEOUT nvme_timeout_to_jiffies(admin_timeout) #define NVME_DEFAULT_KATO 5