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=1796388427; b=NokEiEzR5j2iIikp/k5nBpvYCecOFp90WgcmwWtSJsAqRNvzs1bUJFlHTP+MLOG9z/5z 8UMEQSMy6YEAyo2iGsfzyvKPP5e0CN5a4b46jvuq8twnHVqbWCgM8oEb2WAIBUzPrhJ+o rQdSY7wy1/TjoWfHcPA1MvM6jwOAfuy5B1x6vqETh7jDv8sgOta2Bvyocrf7pEiYpInaC b6rxOxQQJCMe/myIBaP3IuJqI6xcN638jcY1OaP2v8JO3ne8v3MzsI5rmqdj1J2i0NKrS BtT06ZZw21ebStNHgmjEjr00fW+LBOQvzlWWGziTAs7mgVUpmG951bk/zDXQRz6vo2g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388427; 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=1tYkMmmZnPL7A5EsB3RRBIonk1fOqBVekR8CGR1vxzE=; b=OD99VOKI5tHBFsrRTlcHcWssb027Xz6J4frVf1LcqlkZkgslxVxVfTRmU2realVgmLXu lrqcBOtxHWdp/mOqCvNWYQ1fTJEbUVoYJQ8EFGyDsNC5szNSn+P+bhnfIJfdHTHy9xIwj zAlb1CLkllMo5zRwib29NmwuZS9hYptunX76HOjE9P0Cbg3ee3wZZZOJoZw9cKrJlSN/j BZgOg9SCkUyXiXI5P8ZfZ21lh9nHT/ArhG/QmU0JQE+NrhD77vriNvgJRB0kvI3ILZDf2 PzMxxi0NbB9ZfTtOdlf+KJN/Bb4t24tzT/DYVg0adKWqiztBVrr0fGCzPsxSEDXdOkw== 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=UFoCh667; 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 455BF606A332; Fri, 4 Dec 2026 12:47:07 +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=UFoCh667 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE84B1F000C2; Fri, 4 Dec 2026 12:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388427; bh=1tYkMmmZnPL7A5EsB3RRBIonk1fOqBVekR8CGR1vxzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UFoCh667MphM81c/8oCXOjkduG6vxeRmBrE0vkCzGyBbX56J1bEmrA8GmI3RnES32 W5Y04J5/AmNBgjHO+51xAwKyjNh8g75YtMZCdfpoWuznmFZvjDhXPoI7OOPyHMRuqC rXHdPvmQhUVUWeE1RyprIxbugJab+9QDJD6HcLLM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Josef Bacik , Ian Abbott Subject: [PATCH 6.1 0582/1059] comedi: ni_tio: Fix overflow of the clock period Date: Fri, 4 Dec 2026 19:01:53 +0900 Message-ID: <20261204100659.232065707@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josef Bacik commit ec214735bb113be747454812035b83010892e0d2 upstream. ni_tio_set_clock_src() stores the period of the clock source, which the user passes in nanoseconds, in picoseconds: counter->clock_period_ps = period_ns * 1000; period_ns is an unsigned int, so that the product is computed in 32 bits, although clock_period_ps is a u64. It wraps for periods above 4294967 ns, that is for external clocks slower than 233 Hz. INSN_CONFIG_GET_CLOCK_SRC then reports a wrong period, and ni_tio_set_sync_mode() decides on a wrong one: 4294968 ns become 704 ps, which is below the limit of 25 ns under which the alternate synchronization mode for fast clocks is switched on. The multiplication was done in 64 bits until the constant pico_per_nano, a uint64_t, was replaced by a literal. Widen again. Fixes: 3e90b1c7ebe9 ("staging: comedi: ni_tio: tidy up ni_tio_set_clock_src() and helpers") Cc: stable Signed-off-by: Josef Bacik Reviewed-by: Ian Abbott Link: https://patch.msgid.link/20261027-llm-char-misc-comedi-v1-4-1899771ee15b@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/comedi/drivers/ni_tio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/comedi/drivers/ni_tio.c +++ b/drivers/comedi/drivers/ni_tio.c @@ -800,7 +800,7 @@ static int ni_tio_set_clock_src(struct n GI_PRESCALE_X2(counter_dev->variant) | GI_PRESCALE_X8(counter_dev->variant), bits); } - counter->clock_period_ps = period_ns * 1000; + counter->clock_period_ps = (u64)period_ns * 1000; ni_tio_set_sync_mode(counter); return 0; }