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 4C64214A91 for ; Mon, 8 Dec 2025 00:47:44 +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=1765154864; cv=none; b=W55jU74nUpISljbB/DDNHitOkZLBjbA5F/3dLcfnqYigKu5wCoylsWcvg27YmGzy30M+zv2oNHUc8O1IV1x/DF/rdgTKctom7pYeqt90ZIgKO4FlPhL6eeaDQaiy2i9Fy8P+vycKglxUJ1XNi1rxV5MWj3/kwa16YGx8KJCc97Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765154864; c=relaxed/simple; bh=BV/YGrgCyPzyCsGrjKFTgYro52rxBcE66T6WZ7G7my0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mIK/ieo3LLSP6vjnvDSgU/qZsT59vA62dfr4ExZmggbrrK6jk/XhL4jyASwYx77omxRWgPOf93rJ+klDgQ8zUkM0Y1jbOj07B4xVy15h7+Umj+dcNl4pFyK/SIR7FDIFI/EhGgQO8uZCMDTP7sVouWLnYRc5AxQr0xRBPxsfxA4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=T5GrBY+v; 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="T5GrBY+v" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DF10C4CEFB; Mon, 8 Dec 2025 00:47:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1765154863; bh=BV/YGrgCyPzyCsGrjKFTgYro52rxBcE66T6WZ7G7my0=; h=From:To:Cc:Subject:Date:Reply-To:From; b=T5GrBY+vxQrTWvlJ1OcUo2MzSOzsQXKO6MEXPStSvNt6QYxFNL27PzMsVF3UBdOdY iuDfAE9/Z0NsD5NROyhzTc45AtYZm3q4tLvJ2bAm2cJD7O2OLXfGAORaWfTfEDZE28 it/ul4knHhRk9IO6O2rNog+dvxWrgrOT2/0EcXuQ= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-40304: fbdev: Add bounds checking in bit_putcs to fix vmalloc-out-of-bounds Date: Mon, 8 Dec 2025 09:47:28 +0900 Message-ID: <2025120820-CVE-2025-40304-47b3@gregkh> X-Mailer: git-send-email 2.52.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=3138; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=8e++2z5YjbWOcdttAABbRTPDKi2Pa8VOKYLOG6I9jK8=; b=owGbwMvMwCRo6H6F97bub03G02pJDJlmChIzxD5Lxp7l4Lsx6bmIzYbCC3lWzucfTCqRZPqTE T6hY5lrRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEwkyYdhwdHFF0JdjunsieDw 9Fjm/frKSe69OxjmaSndeP8zWGXVmqSTzbP3hgY7t8W/BAA= 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: fbdev: Add bounds checking in bit_putcs to fix vmalloc-out-of-bounds Add bounds checking to prevent writes past framebuffer boundaries when rendering text near screen edges. Return early if the Y position is off-screen and clip image height to screen boundary. Break from the rendering loop if the X position is off-screen. When clipping image width to fit the screen, update the character count to match the clipped width to prevent buffer size mismatches. Without the character count update, bit_putcs_aligned and bit_putcs_unaligned receive mismatched parameters where the buffer is allocated for the clipped width but cnt reflects the original larger count, causing out-of-bounds writes. The Linux kernel CVE team has assigned CVE-2025-40304 to this issue. Affected and fixed versions =========================== Fixed in 5.4.302 with commit 996bfaa7372d6718b6d860bdf78f6618e850c702 Fixed in 5.10.247 with commit f0982400648a3e00580253e0c48e991f34d2684c Fixed in 5.15.197 with commit 1943b69e87b0ab35032d47de0a7fca9a3d1d6fc1 Fixed in 6.1.159 with commit ebc0730b490c7f27340b1222e01dd106e820320d Fixed in 6.6.117 with commit 86df8ade88d290725554cefd03101ecd0fbd3752 Fixed in 6.12.58 with commit 15ba9acafb0517f8359ca30002c189a68ddbb939 Fixed in 6.17.8 with commit 2d1359e11674ed4274934eac8a71877ae5ae7bbb Fixed in 6.18 with commit 3637d34b35b287ab830e66048841ace404382b67 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-40304 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/video/fbdev/core/bitblit.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/996bfaa7372d6718b6d860bdf78f6618e850c702 https://git.kernel.org/stable/c/f0982400648a3e00580253e0c48e991f34d2684c https://git.kernel.org/stable/c/1943b69e87b0ab35032d47de0a7fca9a3d1d6fc1 https://git.kernel.org/stable/c/ebc0730b490c7f27340b1222e01dd106e820320d https://git.kernel.org/stable/c/86df8ade88d290725554cefd03101ecd0fbd3752 https://git.kernel.org/stable/c/15ba9acafb0517f8359ca30002c189a68ddbb939 https://git.kernel.org/stable/c/2d1359e11674ed4274934eac8a71877ae5ae7bbb https://git.kernel.org/stable/c/3637d34b35b287ab830e66048841ace404382b67