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=1796385634; b=d94tdTNSJe3JfePqpiPfaxRhMTCnL3y0Fq9BGqM9eHbc1r056ZHI6uXCBGsXOu07eYzW yTqsiT7keTStSGWAkn1ZGQRTXEa6Q7x2elxcu3FDrNVzjkd5b6eNxcrXOGYV20/0UOQmP 7D5E5kPBY7rN7bdDV0/KKxWri6bYYYIaW31Oyrn8tjQrHqBmhS+Hkyd08JA9oVLMPZewp nR7jK8FV9Dd+6715sZfW05wfo5ZLBueLCUTSJQ8qHldgXdzuoMnXYCO4kuCMBsym3e3IJ RqRl7y5cDzL/isUJe4hoQyhRvd8ZD5z3Baz/KixFqW4118SOjkk8sU/rN+WIXbO9EwQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385634; 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=slxHA7Fbx2+exoLlgSgrUwPTKQLw/X3yZHAeA65eubE=; b=XlkEEjdwBuB5cPoMKG18nYr8wvR9utW90IsI8rhzKi98rYo4hUVxKeSXMufAN2mGU5hH M2S59A6GgmKnNkBtU4caxlXhajZ+Gqz6VX5wNdIr8nqyTM+dQI82AEJgS9wdVZWB3d0PL yuFIceEWJuhRaCsxhleutoPdS7xMs/BY7GBkalWmY45Ptlq4DRrWN+GNjF97VlIlRaVym al1AjxmkSVEhrE2MemvfPH2nHNaShM/ulyfYYYbdMZ1HayQcWFA0AAbkKl6E8SxrUfSRa iG5UDuZ8mywHGMQT+nbiqV2LrDC7wH1mwGl1GV4qZQ3Ic/q2d9OPHwA8y+u15Rv5DPw== 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="yV94w5r/"; 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 00489606A322; Fri, 4 Dec 2026 12:00:34 +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=yV94w5r/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BB691F000C2; Fri, 4 Dec 2026 12:00:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385633; bh=slxHA7Fbx2+exoLlgSgrUwPTKQLw/X3yZHAeA65eubE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=yV94w5r/z3hbdoZjfz9mAC23dOywRcvZSCmoq/J5ssu7pJoXpteDmRWmv49sdsnaU 43AMAVoaa7inO0leJYK5oJXc5VGVs+hZYi8Q3xMFn/2U5MSnLKUuH0ORyAxbObLf4L gE2QJtTD0x9RbXW/bhmyxRw3/knGCXf06fmp1FnY= 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.6 0627/1167] comedi: ni_tio: Fix overflow of the clock period Date: Fri, 4 Dec 2026 19:00:54 +0900 Message-ID: <20261204100718.394551920@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: 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; }