Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A39D332EAF for ; Fri, 31 Oct 2025 09:42:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761903721; cv=none; b=Olkm73bucRXwOuJajH5Cy8MM5X/486ZtDsxmvhB+GV5SUIS7xu3gHw3rrUFCLnuuOEeabu0H5ctdPxTAeNlBsh0ww3MuGyqSs6R6N0CFRfMNUmM0F1WEV9uTFQqqGn62Jmldi7lv3WpAAHnU4Yvx7e5S+X823BHpWNevby1NddA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761903721; c=relaxed/simple; bh=eO5e1MXmQ+gsbYRah3mVW2Ozqvg2HQSdhRK5aX4IWZs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=dSEgsTcu0Vb/O7JIjEcGoeSWNyoMLzZdys0GKEtnuqmAdc4/+iL++LD+0UcFfunqxkmoUEJzVO4a5U2TPKCOQxt6iab2fGvuS4zGBT+Uki5VSZXI7ARr7LbtKUEZiX9pNfQdiPq+QuJHMsKdQppwUrjqMjUDzgfCBOYl+PQ9EDg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=G6Pw3imZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="G6Pw3imZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A8A6C4CEE7; Fri, 31 Oct 2025 09:42:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1761903720; bh=eO5e1MXmQ+gsbYRah3mVW2Ozqvg2HQSdhRK5aX4IWZs=; h=From:To:Cc:Subject:Date:Reply-to:From; b=G6Pw3imZubonWlZIzdnBg6O1yiMjfPhMnK+d2YcyNXo0HHcLJyTzJ4y3EUREM3VFr sVixjCw4Qi9feIDhKYzgiqq+4jsa6BbAe5zGQlt+Q/KQwaPoDnfmJhnNEt/BmQ+bbp C12M/sKAphCovup4FvAEBVheCAlir2fZGrsvy7wE= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-40106: comedi: fix divide-by-zero in comedi_buf_munge() Date: Fri, 31 Oct 2025 10:41:56 +0100 Message-ID: <2025103155-CVE-2025-40106-ed47@gregkh> X-Mailer: git-send-email 2.51.2 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3127; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Av/gLhCj3DT1iqalfC8nnIXab7kcxheYSyYC1/hHE/g=; b=owGbwMvMwCRo6H6F97bub03G02pJDJksLcnJVvev8gtK9nXt4N138mXMpHuKrbsCZ32dIPxxw kNNpaVPOmJZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiJ3MY5pcLfLs/59IC4xcL 5ur3zLm5vWWH/mGGBVs2hOzwYbE4KXwyfF3T32otBzXG7wA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: comedi: fix divide-by-zero in comedi_buf_munge() The comedi_buf_munge() function performs a modulo operation `async->munge_chan %= async->cmd.chanlist_len` without first checking if chanlist_len is zero. If a user program submits a command with chanlist_len set to zero, this causes a divide-by-zero error when the device processes data in the interrupt handler path. Add a check for zero chanlist_len at the beginning of the function, similar to the existing checks for !map and CMDF_RAWDATA flag. When chanlist_len is zero, update munge_count and return early, indicating the data was handled without munging. This prevents potential kernel panics from malformed user commands. The Linux kernel CVE team has assigned CVE-2025-40106 to this issue. Affected and fixed versions =========================== Fixed in 5.4.301 with commit 4ffea48c69cb2b96a281cb7e5e42d706996631db Fixed in 5.10.246 with commit 8f3e4cd9be4b47246ea73ce5e3e0fa2f57f0d10c Fixed in 5.15.196 with commit 2670932f2465793fea1ef073e40883e8390fa4d9 Fixed in 6.1.158 with commit 6db19822512396be1a3e1e20c16c97270285ba1a Fixed in 6.6.115 with commit d4854eff25efb06d0d84c13e7129bbdba4125f8c Fixed in 6.12.56 with commit a4bb5d1bc2f238461bcbe5303eb500466690bb2c Fixed in 6.17.6 with commit 55520f65fd447e04099a2c44185453c18ea73b7e Fixed in 6.18-rc3 with commit 87b318ba81dda2ee7b603f4f6c55e78ec3e95974 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2025-40106 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/comedi/comedi_buf.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/4ffea48c69cb2b96a281cb7e5e42d706996631db https://git.kernel.org/stable/c/8f3e4cd9be4b47246ea73ce5e3e0fa2f57f0d10c https://git.kernel.org/stable/c/2670932f2465793fea1ef073e40883e8390fa4d9 https://git.kernel.org/stable/c/6db19822512396be1a3e1e20c16c97270285ba1a https://git.kernel.org/stable/c/d4854eff25efb06d0d84c13e7129bbdba4125f8c https://git.kernel.org/stable/c/a4bb5d1bc2f238461bcbe5303eb500466690bb2c https://git.kernel.org/stable/c/55520f65fd447e04099a2c44185453c18ea73b7e https://git.kernel.org/stable/c/87b318ba81dda2ee7b603f4f6c55e78ec3e95974