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 12BDB3DE45E for ; Fri, 24 Apr 2026 14:45:04 +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=1777041905; cv=none; b=otn4eZYKQTpblGV9YuAWS2l9Jh8TVTdx5u4iEGLFpT0ds8wqCWI/Bpi2C2Uboq6DN/pkwBY82AXLy+oDt47wnVecWwdZQUmUmUNKUUaF/8tzcV50VoUTyUdtDoxrYO4HOpVTYulE/I3dKZAr2b96En2VjbSn7ZjWos5G2U+nWgA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777041905; c=relaxed/simple; bh=ffD0FNdJRpnC+Sqf9vI+ZPkSFOx8ucPQTt+7EIPUjBA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Uq0Ake45kBnB9MS2jl4894XziHH3doTBh7x5CYkK3iN4sta/JSqzcEsjjB4viIQyRpJF+lgUqW+QZISwtSgr7v9RDWuBQ1Nx9r3qSOX+m8NI+mGcJzN9HqMlw+4d0/P9DblG9iwW7ibvr+r1PH3V0pc1Br4dGIZZrOx6CALnbyM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MTlUTADO; 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="MTlUTADO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EB68C19425; Fri, 24 Apr 2026 14:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777041904; bh=ffD0FNdJRpnC+Sqf9vI+ZPkSFOx8ucPQTt+7EIPUjBA=; h=From:To:Cc:Subject:Date:Reply-To:From; b=MTlUTADOwo9Qg/7yQahdnPt66QNn+gAOCQVnmOFki67tBgATyy6FdIaOQwOEB9dpU /3vV6QJeo4oPAxuKiy1gPWuxLSY+ZtagXF73Kk0CGNCxF98OS1oCfZaoF6+jrT3dNk t0Y8I7gYVWoZIptI12DG2voVaJKFhXPSsflBG9eU= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-31617: usb: gadget: f_ncm: validate minimum block_len in ncm_unwrap_ntb() Date: Fri, 24 Apr 2026 16:43:53 +0200 Message-ID: <2026042424-CVE-2026-31617-6e1b@gregkh> X-Mailer: git-send-email 2.53.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2939; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=FTg87iZaTrXE4kUG77uvqXj9zNIGR0phiR/zdfNsPaA=; b=owGbwMvMwCRo6H6F97bub03G02pJDJmvG3sOWSoc2M8XL7KjapMd27btha9y7vlw57tq8tYJ8 FQq6zF3xLIwCDIxyIopsnzZxnN0f8UhRS9D29Mwc1iZQIYwcHEKwET0fjLMD/gwU1xzIbeOyA2f R1518S9OmnZvYljQd8lKuuHnQ015sX33XOdd4+LcGbEfAA== 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: usb: gadget: f_ncm: validate minimum block_len in ncm_unwrap_ntb() The block_len read from the host-supplied NTB header is checked against ntb_max but has no lower bound. When block_len is smaller than opts->ndp_size, the bounds check of: ndp_index > (block_len - opts->ndp_size) will underflow producing a huge unsigned value that ndp_index can never exceed, defeating the check entirely. The same underflow occurs in the datagram index checks against block_len - opts->dpe_size. With those checks neutered, a malicious USB host can choose ndp_index and datagram offsets that point past the actual transfer, and the skb_put_data() copies adjacent kernel memory into the network skb. Fix this by rejecting block lengths that cannot hold at least the NTB header plus one NDP. This will make block_len - opts->ndp_size and block_len - opts->dpe_size both well-defined. Commit 8d2b1a1ec9f5 ("CDC-NCM: avoid overflow in sanity checking") fixed a related class of issues on the host side of NCM. The Linux kernel CVE team has assigned CVE-2026-31617 to this issue. Affected and fixed versions =========================== Fixed in 6.12.83 with commit 8757a2593631443648218244b9788e193ae0fdc1 Fixed in 6.18.24 with commit 6762f8a95772265dd0c2ffe7f400493f3115b135 Fixed in 6.19.14 with commit d58ba8f6546232f8414f396c189297dbee03f1a7 Fixed in 7.0.1 with commit 74908b0318d1df1188457040b8714ff4d4b68126 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-2026-31617 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/usb/gadget/function/f_ncm.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/8757a2593631443648218244b9788e193ae0fdc1 https://git.kernel.org/stable/c/6762f8a95772265dd0c2ffe7f400493f3115b135 https://git.kernel.org/stable/c/d58ba8f6546232f8414f396c189297dbee03f1a7 https://git.kernel.org/stable/c/74908b0318d1df1188457040b8714ff4d4b68126 https://git.kernel.org/stable/c/8f993d30b95dc9557a8a96ceca11abed674c8acb