CVE-2025-39967: fbcon: fix integer overflow in fbcon_do_set_font
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
fbcon: fix integer overflow in fbcon_do_set_font
Fix integer overflow vulnerabilities in fbcon_do_set_font() where font size calculations could overflow when handling user-controlled font parameters.
The vulnerabilities occur when:
1. CALC_FONTSZ(h, pitch, charcount) performs h * pith * charcount multiplication with user-controlled values that can overflow.
2. FONT_EXTRA_WORDS * sizeof(int) + size addition can also overflow
3. This results in smaller allocations than expected, leading to buffer overflows during font data copying.
Add explicit overflow checking using check_mul_overflow() and check_add_overflow() kernel helpers to safety validate all size calculations before allocation.
The Linux kernel CVE team has assigned CVE-2025-39967 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.4.62 with commit 96e41fc29e8af5c5085fb8a79cab8d0d00bab86c and fixed in 5.4.300 with commit 994bdc2d23c79087fbf7dcd9544454e8ebcef877 Issue introduced in 5.9 with commit 39b3cffb8cf3111738ea993e2757ab382253d86a and fixed in 5.10.245 with commit 9c8ec14075c5317edd6b242f1be8167aa1e4e333 Issue introduced in 5.9 with commit 39b3cffb8cf3111738ea993e2757ab382253d86a and fixed in 5.15.194 with commit b8a6e85328aeb9881531dbe89bcd2637a06c3c95 Issue introduced in 5.9 with commit 39b3cffb8cf3111738ea993e2757ab382253d86a and fixed in 6.1.155 with commit a6eb9f423b3db000aaedf83367b8539f6b72dcfc Issue introduced in 5.9 with commit 39b3cffb8cf3111738ea993e2757ab382253d86a and fixed in 6.6.109 with commit adac90bb1aaf45ca66f9db8ac100be16750ace78 Issue introduced in 5.9 with commit 39b3cffb8cf3111738ea993e2757ab382253d86a and fixed in 6.12.50 with commit 4a4bac869560f943edbe3c2b032062f6673b13d3 Issue introduced in 5.9 with commit 39b3cffb8cf3111738ea993e2757ab382253d86a and fixed in 6.16.10 with commit c0c01f9aa08c8e10e10e8c9ebb5be01a4eff6eb7 Issue introduced in 5.9 with commit 39b3cffb8cf3111738ea993e2757ab382253d86a and fixed in 6.17 with commit 1a194e6c8e1ee745e914b0b7f50fa86c89ed13fe Issue introduced in 4.4.235 with commit ae021a904ac82d9fc81c25329d3c465c5a7d5686 Issue introduced in 4.9.235 with commit 451bffa366f2cc0e5314807cb847f31c0226efed Issue introduced in 4.14.196 with commit 2c455e9c5865861f5ce09c5f596909495ed7657c Issue introduced in 4.19.143 with commit 72f099805dbc907fbe8fa19bccdc31d3e2ee6e9e Issue introduced in 5.8.6 with commit 34cf1aff169dc6dedad8d79da7bf1b4de2773dbc
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-39967
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/fbcon.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/994bdc2d23c79087fbf7dcd9544454e8ebcef877 https://git.kernel.org/stable/c/9c8ec14075c5317edd6b242f1be8167aa1e4e333 https://git.kernel.org/stable/c/b8a6e85328aeb9881531dbe89bcd2637a06c3c95 https://git.kernel.org/stable/c/a6eb9f423b3db000aaedf83367b8539f6b72dcfc https://git.kernel.org/stable/c/adac90bb1aaf45ca66f9db8ac100be16750ace78 https://git.kernel.org/stable/c/4a4bac869560f943edbe3c2b032062f6673b13d3 https://git.kernel.org/stable/c/c0c01f9aa08c8e10e10e8c9ebb5be01a4eff6eb7 https://git.kernel.org/stable/c/1a194e6c8e1ee745e914b0b7f50fa86c89ed13fe