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=1796385573; b=YATsnhydRBbRbSeFJE7ZcE5wJD6eMGv8fiNjguCEkSA3Q7VxiFjxntF9iWpGywI40ioX wkUzNe6Lff0BGcXPXX+D/Rh252/kTEpyeZgAh+YOM9pCbpoT5Y/DuqkSyRPS+yXeEjB0L Vq5lU7bmRuPWh58HvxxOY6AmonlV7+rpO72vkDYO9u5wNKo85WrHhpHZF6rZQBSHzQSkv 7d6dPg3jZ/n/WFMJJgZwqPEBABZaDSM+EikJ8eqbu4deJGIml1QxU0VNsHD6Qj+vSy+sq crBFTW9WaSBZbtCVx7AJA+kWt+NPhU3HdX8TdY75/luWgRpN/Z1FezmIeaqJy0+CQlw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385573; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=Hw3dqrHjD14rqcUegFaeRc76ep3EJBFX/+sl5JvW0nU=; b=4G9Ad/f4aUrUgG32o2qnB7ARHwUvcrkerfVEAz43xw07W6v9IJ2BIh2HLN4xKV0Y3UNg pNltxLCIIvAkBQmmelCejXEdwk7/C/bmxa2tO4U5W0XCjUGHbtSrOArfNzw11uR3ByKIO U5BU3kmd6snqpWU4lsxNELIpu/58XAVo+nIvIpiKcDbRxP2OLRtASb8PB56doIzTTwwDy lZ1qAeOjCLSdZ+cCVNi/4kF3kNY7G+ZwNczCxyh/DdAUYA5fW5JtUABXLPzZbSM9bxNPM DWkE9smmiGDd1nBVEFaYjAzFNk0EYbM3A8B24kXX1CH6X2HZSvgd5c7y45Z+LJnK/LQ== 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=N45nLnnV; 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 3F622606A32C; Fri, 4 Dec 2026 11:59:33 +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=N45nLnnV Received: by smtp.kernel.org (Postfix) with ESMTPSA id 969E21F00A0C; Fri, 4 Dec 2026 11:59:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385573; bh=Hw3dqrHjD14rqcUegFaeRc76ep3EJBFX/+sl5JvW0nU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=N45nLnnVpV+zr8xPe64D/TG9sYqoinN9VpsBx7wW7nog2XY9oq7zgKGvdAZQdqBx/ 6EsWXSReifsHfJRYeCml+lL62XyVRhuhreQ30pBXeN7jI1WhA08VFjiaeQpMnEA4mM 29i/bxSMLboTY5En7rMBIvp/6Smrnu4mpXE3jRII= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yingjie Wang , Mikulas Patocka Subject: [PATCH 6.6 0605/1167] dm mpath: cap queue_if_no_path_timeout_secs Date: Fri, 4 Dec 2026 19:00:32 +0900 Message-ID: <20261204100717.815443642@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yingjie Wang commit ae5b40accbc06f93e6a513e0e9a07fd32b197e49 upstream. enable_nopath_timeout() arms the no-path timer with jiffies + queue_if_no_path_timeout_secs * HZ. The module parameter is an unbounded unsigned long, so the delay can exceed what mod_timer() handles: a delay above LONG_MAX is treated as already expired, and values above ULONG_MAX / HZ also wrap in the multiplication. The timer then clears queue_if_no_path right away, and I/O queued after the last path fails gets -EIO instead of waiting for the configured time. On x86-64 with HZ=1000, 9223372036854776 seconds failed a write after 124 ms while one second less remained queued throughout a 4.2-second observation window. A value of 18446744073709552 seconds wrapped to 384 jiffies and failed the write after 455 ms. On 32-bit kernels with HZ=1000 the delay passes LONG_MAX above 2147483 seconds, a little under 25 days. Cap the seconds value at the largest whole-second delay not exceeding MAX_JIFFY_OFFSET before multiplying by HZ. This prevents signed-delta overflow and multiplication wrap. The timer wheel's existing handling of very long delays is unchanged. Fixes: be240ff5e402 ("dm mpath: Add timeout mechanism for queue_if_no_path") Cc: stable@vger.kernel.org Signed-off-by: Yingjie Wang Signed-off-by: Mikulas Patocka Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-mpath.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -802,7 +802,8 @@ static void queue_if_no_path_timeout_wor static void enable_nopath_timeout(struct multipath *m) { unsigned long queue_if_no_path_timeout = - READ_ONCE(queue_if_no_path_timeout_secs) * HZ; + min_t(unsigned long, READ_ONCE(queue_if_no_path_timeout_secs), + MAX_JIFFY_OFFSET / HZ) * HZ; lockdep_assert_held(&m->lock);