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 8C42222C32D for ; Mon, 28 Jul 2025 11:22:34 +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=1753701754; cv=none; b=l9e5jaO8jl08/63tIXvl37xOD3fKHVWLsuBtLy1NB6We8L/rthPxW2tDCAqGcGcxNXMACJE0ZyQez80051WqNFoEwb2PsEkm6+be/JYsEIGEifrmvlHo4G8seBg7zDwlbfN4KEXWr/rjA2QQajBZvqi9Wbylr29mQ8XscS7J3LE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753701754; c=relaxed/simple; bh=0JPWfML1VR6b2GRVTaXvqZ2L8F36b7mPPT176trWbgA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=P2wACvDmkzYrLl+2tutARfktIY8MtAAcWgDXOpFEUFpyjj05EjN0HAgqYT22Ut3QV4YS/h/gVkR8C7tiQbaZJdS3VbO4bj+8EnHY3jU+w77JTjmOXhleEZv8JoATECDxofxnLebzWlRH+xhoIQ46L9WmhtDdHGoIFk8bsJCtNWY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lwmRtWHA; 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="lwmRtWHA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4452C4CEE7; Mon, 28 Jul 2025 11:22:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1753701754; bh=0JPWfML1VR6b2GRVTaXvqZ2L8F36b7mPPT176trWbgA=; h=From:To:Cc:Subject:Date:Reply-to:From; b=lwmRtWHAYjmKBN2fu/rCsTfXGA7ledX8NcByaRk48qssvN/v7F2mxIatxow3y0R3b 5zJW8x46YsPMNPp1Xgoew7d3XxZ/ksXEq4r1RswCIERVLEmpdtvGk8M3clzmxGARkc dr5G1lRODqkHtReizCESE/6xS6/qi4Tx2W58dzsw= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38481: comedi: Fail COMEDI_INSNLIST ioctl if n_insns is too large Date: Mon, 28 Jul 2025 13:22:23 +0200 Message-ID: <2025072814-CVE-2025-38481-1476@gregkh> X-Mailer: git-send-email 2.50.1 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=3153; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=w3P2lIabnIVHWocyZBUinTdk1By7QGIl5aEulClDn/A=; b=owGbwMvMwCRo6H6F97bub03G02pJDBntsWkKgpHV2p6HP/4+P+Vi/ZbM3rlnFMWczUzcq5jKm iSFePw7YlkYBJkYZMUUWb5s4zm6v+KQopeh7WmYOaxMIEMYuDgFYCI+rxnmFyt2HZgm+Lss0VHG kjnr//bygklrGOYnFyt9Zb/lx6099/SatpAKu7VP3voBAA== 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: Fail COMEDI_INSNLIST ioctl if n_insns is too large The handling of the `COMEDI_INSNLIST` ioctl allocates a kernel buffer to hold the array of `struct comedi_insn`, getting the length from the `n_insns` member of the `struct comedi_insnlist` supplied by the user. The allocation will fail with a WARNING and a stack dump if it is too large. Avoid that by failing with an `-EINVAL` error if the supplied `n_insns` value is unreasonable. Define the limit on the `n_insns` value in the `MAX_INSNS` macro. Set this to the same value as `MAX_SAMPLES` (65536), which is the maximum allowed sum of the values of the member `n` in the array of `struct comedi_insn`, and sensible comedi instructions will have an `n` of at least 1. The Linux kernel CVE team has assigned CVE-2025-38481 to this issue. Affected and fixed versions =========================== Issue introduced in 2.6.29 with commit ed9eccbe8970f6eedc1b978c157caf1251a896d4 and fixed in 6.1.147 with commit d4c73ce13f5b5a0fe0319f1f352ff602f0ace8e3 Issue introduced in 2.6.29 with commit ed9eccbe8970f6eedc1b978c157caf1251a896d4 and fixed in 6.6.100 with commit c9d3d9667443caafa804cd07940aeaef8e53aa90 Issue introduced in 2.6.29 with commit ed9eccbe8970f6eedc1b978c157caf1251a896d4 and fixed in 6.12.40 with commit 992d600f284e719242a434166e86c1999649b71c Issue introduced in 2.6.29 with commit ed9eccbe8970f6eedc1b978c157caf1251a896d4 and fixed in 6.15.8 with commit e3b8322cc8081d142ee4c1a43e1d702bdba1ed76 Issue introduced in 2.6.29 with commit ed9eccbe8970f6eedc1b978c157caf1251a896d4 and fixed in 6.16 with commit 08ae4b20f5e82101d77326ecab9089e110f224cc 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-38481 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_fops.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/d4c73ce13f5b5a0fe0319f1f352ff602f0ace8e3 https://git.kernel.org/stable/c/c9d3d9667443caafa804cd07940aeaef8e53aa90 https://git.kernel.org/stable/c/992d600f284e719242a434166e86c1999649b71c https://git.kernel.org/stable/c/e3b8322cc8081d142ee4c1a43e1d702bdba1ed76 https://git.kernel.org/stable/c/08ae4b20f5e82101d77326ecab9089e110f224cc