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=1796221467; b=zXe7Hv0cE99Cm/GlV4+up5yewpZTU6vdObfU6Vr09ZdTIrwqeUG181VvgONweeX21nzw RTM1RGHx/nf9+wN2m+T69HDIfOe9ItXZXfamstR+iFT/MRoqsFzRDMtITwAHWspAXzHrZ bf0L6+9UKpIp79fbyd4UO3cXMxcwyLQPqO046cFL0iz/c5ksrX1ZAppqhKidFzP4ctWc6 GcautIrdwh5tYZ7Ko3fky+NCKXw0KuKGfyGhsKI/0Vlbzg5GoBkzAhh/4PYPOchSS0A2a 1kV0PBmpB8nvD4A9S9TT/EgouKQp+lgv/ljJHoGjD+s7TGNzXriyokQHcRKogOnGw9g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221467; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=g/N5vaBLaA8CX1m4wd3hDy0DUUDhtBzvBH2PGPz88xI=; b=HmSZhcAyC7c39dcqN7bTgsFqudJHlmPCig6/pqekj6A5TDYD2ZuRWrep95dKaYhbpvlB CrkIo4Zd+GhNmFOP69+e7bojdG3vqd19Cw21zzMDbnkFBfcfOl8gG0mrXi49JkRCkAJcc VT5B9KHBTzXVr3HYILoBmpKtFu0C25y1fkBHrQU9opMckRpfIgjKSOzAjp7SfdV+AdM05 3DIeRg2Xn70keSM8+vkPNHHwziDzcoKmdR7Pic1LzzAWoC+nuSfkWXlP8jkP/X0ZjERqh gRRQQemSV25UiyTruAQPZLrYhlLgeeKbyy3nv0tPl8wvgq0/L1r1QvV6sQS4b70PvUQ== 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=h8aTDk9G; 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 95E5F606A322 for ; Wed, 2 Dec 2026 14:24:27 +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=h8aTDk9G Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF92C1F000C1; Wed, 2 Dec 2026 14:24:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221467; bh=g/N5vaBLaA8CX1m4wd3hDy0DUUDhtBzvBH2PGPz88xI=; h=Subject:To:Cc:From:Date; b=h8aTDk9GXiXyg3kiCEt+ZgRKsBx+zeMK+ERoF8KzCCC0rsjOi7AQJjIRAeFpFBREu H50pQSeuY+y9FecwnrP/ZnUCieIadneBjA7M7ADl5uIi+/lgixwhXRExz5+HTRg60p 9z/TyHDRUGz+x7LTzpn9FD3DAZT2aGiOxCgwLCfk= Subject: FAILED: patch "[PATCH] nvme: avoid wrapping admin_timeout and io_timeout" failed to apply to 6.1-stable tree To: 1075151112@qq.com,hch@lst.de,kbusch@kernel.org Cc: From: Date: Wed, 02 Dec 2026 14:51:25 +0100 Message-ID: <2026120225-periscope-abruptly-bdb6@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.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 . 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 4a5aeebf1a00360bcc53c9e29fcd8d47aefa4c1d # git commit -s git send-email --to '' --in-reply-to '2026120225-periscope-abruptly-bdb6@gregkh' --subject-prefix 'PATCH 6.1.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