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 A2D023074B2 for ; Fri, 4 Jul 2025 13:44:43 +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=1751636684; cv=none; b=hgX8Jyyzqx12fCGbVm+RNGdVK+IfRlUbXLkCqKO8l3bl3jxwz1o2YQx+ayCPyAdReflpyM7Lyzn7VfGN8JTsDrkEyCTEu1Ns+Dg+kmBzTSnNYStE9kYn0/kwsJOdu5cg5q7nC0NlSzhOABrgG76Cn+AhUKEJno1PhHpGOFlh9jg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751636684; c=relaxed/simple; bh=NH8bjy+OuQSm5iQeaDkjooc4uUcHzsXQ4N77+qc3nKc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=i50g8hK+LG1DzGdBfR0oYDnZlwCzHAniIb8DV4+Lm9+vlX691rAlvn7+3iydy8V+B8UvFYW1Hs2mmdjEs5PqjGH+DGFu8JPSxNZx/kbONc+6fHbZuPH/mudXbONRNsBKdN7jXLkRMpPQNKk7Wy/WPghJ7eKIy5rd3kIH0F3DQq4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SeQsHQGE; 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="SeQsHQGE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB60EC4CEE3; Fri, 4 Jul 2025 13:44:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751636683; bh=NH8bjy+OuQSm5iQeaDkjooc4uUcHzsXQ4N77+qc3nKc=; h=From:To:Cc:Subject:Date:Reply-to:From; b=SeQsHQGE9a68DswwXWhrLb6DueHXdt905Am8vyhD/CH/QPkTw+6WvWzVI5fUGs64a dnamaRSe7N34sUFuVk30Yr+tKzB2WVh4Ll/1L5KAfU+aPA8Pv3M+Qdz8vqbUuF5HWV 7La7rNbXqZ470VlutkXDWQS0f4v2PZsbToVeET14= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38215: fbdev: Fix do_register_framebuffer to prevent null-ptr-deref in fb_videomode_to_var Date: Fri, 4 Jul 2025 15:37:44 +0200 Message-ID: <2025070423-CVE-2025-38215-ddbd@gregkh> X-Mailer: git-send-email 2.50.0 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=4474; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=pEZY73DYzFrjALcyENMbeTjoSzpK0k9cHrazE1bFcKE=; b=owGbwMvMwCRo6H6F97bub03G02pJDBnpN4UnOsW+qRAXfubLPfkjg2j+j3OdGxiSpMoX8Xv6M fs/a5XoiGVhEGRikBVTZPmyjefo/opDil6Gtqdh5rAygQxh4OIUgImkeDLMU3eb13ynodF2xdza lBkxTt4xF/g+Miy41q1TfFp17WP1r4dcdib8mhHC9PUfAA== 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: Fix do_register_framebuffer to prevent null-ptr-deref in fb_videomode_to_var If fb_add_videomode() in do_register_framebuffer() fails to allocate memory for fb_videomode, it will later lead to a null-ptr dereference in fb_videomode_to_var(), as the fb_info is registered while not having the mode in modelist that is expected to be there, i.e. the one that is described in fb_info->var. ================================================================ general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] CPU: 1 PID: 30371 Comm: syz-executor.1 Not tainted 5.10.226-syzkaller #0 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 RIP: 0010:fb_videomode_to_var+0x24/0x610 drivers/video/fbdev/core/modedb.c:901 Call Trace: display_to_var+0x3a/0x7c0 drivers/video/fbdev/core/fbcon.c:929 fbcon_resize+0x3e2/0x8f0 drivers/video/fbdev/core/fbcon.c:2071 resize_screen drivers/tty/vt/vt.c:1176 [inline] vc_do_resize+0x53a/0x1170 drivers/tty/vt/vt.c:1263 fbcon_modechanged+0x3ac/0x6e0 drivers/video/fbdev/core/fbcon.c:2720 fbcon_update_vcs+0x43/0x60 drivers/video/fbdev/core/fbcon.c:2776 do_fb_ioctl+0x6d2/0x740 drivers/video/fbdev/core/fbmem.c:1128 fb_ioctl+0xe7/0x150 drivers/video/fbdev/core/fbmem.c:1203 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x19a/0x210 fs/ioctl.c:739 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x67/0xd1 ================================================================ Even though fbcon_init() checks beforehand if fb_match_mode() in var_to_display() fails, it can not prevent the panic because fbcon_init() does not return error code. Considering this and the comment in the code about fb_match_mode() returning NULL - "This should not happen" - it is better to prevent registering the fb_info if its mode was not set successfully. Also move fb_add_videomode() closer to the beginning of do_register_framebuffer() to avoid having to do the cleanup on fail. Found by Linux Verification Center (linuxtesting.org) with Syzkaller. The Linux kernel CVE team has assigned CVE-2025-38215 to this issue. Affected and fixed versions =========================== Issue introduced in 2.6.12 with commit 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 and fixed in 6.6.95 with commit 0909b2b49c4546a7a08c80f53d93736b63270827 Issue introduced in 2.6.12 with commit 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 and fixed in 6.12.35 with commit 3f2098f4fba7718eb2501207ca6e99d22427f25a Issue introduced in 2.6.12 with commit 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 and fixed in 6.15.4 with commit d803c4c2a4ac8ce2be6d899d5c7ab0bf7ec355e9 Issue introduced in 2.6.12 with commit 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 and fixed in 6.16-rc1 with commit 17186f1f90d34fa701e4f14e6818305151637b9e 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-38215 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/fbmem.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/0909b2b49c4546a7a08c80f53d93736b63270827 https://git.kernel.org/stable/c/3f2098f4fba7718eb2501207ca6e99d22427f25a https://git.kernel.org/stable/c/d803c4c2a4ac8ce2be6d899d5c7ab0bf7ec355e9 https://git.kernel.org/stable/c/17186f1f90d34fa701e4f14e6818305151637b9e