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 C358330EF9F for ; Tue, 28 Oct 2025 11:52:05 +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=1761652328; cv=none; b=HLpQcmvQS7AA30aYy3H6qcxrB3Jlm1SzQsWnKQygcRlyxcrmVp+THJLJG2y/RnUH/1RQ+OB4CJmNymBY/xDEunvFMZgaeu8o93pXpvLSKzaM/AamXjPXoCQQRCjE4SDFdiW66XkRKTsAVmiuJL8gj4XZ0deyUiKLq9LBq4BjTlc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761652328; c=relaxed/simple; bh=d/pu5R39jVluzaeL2heMnmBfLwR722h64ObyE+Ethto=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LTjLZ/2G1lZEl7ViF1DeKOhQ53QUCWlozituhs/O2zPlytHuQ9qc085swt+mp+h+waFzVARvqvD/GcccphdyBHhPS3obgi2QTsyFE7D/ysgJaadMsI7b3Peu75BV98gjf97IdZr9U5QRuRRcFBfgBTDq6KmYHwDecInkXoLiOiI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2IJ4WHpF; 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="2IJ4WHpF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0A65C4CEFD; Tue, 28 Oct 2025 11:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1761652325; bh=d/pu5R39jVluzaeL2heMnmBfLwR722h64ObyE+Ethto=; h=From:To:Cc:Subject:Date:Reply-to:From; b=2IJ4WHpF+hNg3jyl+V/Xm1fVda7Gc+C63RDz4mjNLpZzFMjNC0IRg+AVaTgYwEbZW bE30FyV7LTqFPTilWNEFS2PqMG6pK7KKTDCS3ZtM0PuZhFEBl71SGHK0MS65S5vteM 09zXF1xXL8XAF24Tvdj6DwLB6NGo6QkuXZPgG3C4= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-40037: fbdev: simplefb: Fix use after free in simplefb_detach_genpds() Date: Tue, 28 Oct 2025 12:48:14 +0100 Message-ID: <2025102811-CVE-2025-40037-5cfd@gregkh> X-Mailer: git-send-email 2.51.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=5539; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=aWDvJej85RL0rywFcQj4bLiByVJDLD0ZNLvgBuTaUF0=; b=owGbwMvMwCRo6H6F97bub03G02pJDJkMa6tffNp31L4m8uM3ru/sWQ/z4l9zVV37f25Wh/lL5 pVJPw7+74hlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJiM9mmO9eqRkmb5HytrCE 22dj/LuPWc9+/mSYH5nFfM+3wH6OZm1ncPtKvd/fcvO2AQA= 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: simplefb: Fix use after free in simplefb_detach_genpds() The pm_domain cleanup can not be devres managed as it uses struct simplefb_par which is allocated within struct fb_info by framebuffer_alloc(). This allocation is explicitly freed by unregister_framebuffer() in simplefb_remove(). Devres managed cleanup runs after the device remove call and thus can no longer access struct simplefb_par. Call simplefb_detach_genpds() explicitly from simplefb_destroy() like the cleanup functions for clocks and regulators. Fixes an use after free on M2 Mac mini during aperture_remove_conflicting_devices() using the downstream asahi kernel with Debian's kernel config. For unknown reasons this started to consistently dereference an invalid pointer in v6.16.3 based kernels. [ 6.736134] BUG: KASAN: slab-use-after-free in simplefb_detach_genpds+0x58/0x220 [ 6.743545] Read of size 4 at addr ffff8000304743f0 by task (udev-worker)/227 [ 6.750697] [ 6.752182] CPU: 6 UID: 0 PID: 227 Comm: (udev-worker) Tainted: G S 6.16.3-asahi+ #16 PREEMPTLAZY [ 6.752186] Tainted: [S]=CPU_OUT_OF_SPEC [ 6.752187] Hardware name: Apple Mac mini (M2, 2023) (DT) [ 6.752189] Call trace: [ 6.752190] show_stack+0x34/0x98 (C) [ 6.752194] dump_stack_lvl+0x60/0x80 [ 6.752197] print_report+0x17c/0x4d8 [ 6.752201] kasan_report+0xb4/0x100 [ 6.752206] __asan_report_load4_noabort+0x20/0x30 [ 6.752209] simplefb_detach_genpds+0x58/0x220 [ 6.752213] devm_action_release+0x50/0x98 [ 6.752216] release_nodes+0xd0/0x2c8 [ 6.752219] devres_release_all+0xfc/0x178 [ 6.752221] device_unbind_cleanup+0x28/0x168 [ 6.752224] device_release_driver_internal+0x34c/0x470 [ 6.752228] device_release_driver+0x20/0x38 [ 6.752231] bus_remove_device+0x1b0/0x380 [ 6.752234] device_del+0x314/0x820 [ 6.752238] platform_device_del+0x3c/0x1e8 [ 6.752242] platform_device_unregister+0x20/0x50 [ 6.752246] aperture_detach_platform_device+0x1c/0x30 [ 6.752250] aperture_detach_devices+0x16c/0x290 [ 6.752253] aperture_remove_conflicting_devices+0x34/0x50 ... [ 6.752343] [ 6.967409] Allocated by task 62: [ 6.970724] kasan_save_stack+0x3c/0x70 [ 6.974560] kasan_save_track+0x20/0x40 [ 6.978397] kasan_save_alloc_info+0x40/0x58 [ 6.982670] __kasan_kmalloc+0xd4/0xd8 [ 6.986420] __kmalloc_noprof+0x194/0x540 [ 6.990432] framebuffer_alloc+0xc8/0x130 [ 6.994444] simplefb_probe+0x258/0x2378 ... [ 7.054356] [ 7.055838] Freed by task 227: [ 7.058891] kasan_save_stack+0x3c/0x70 [ 7.062727] kasan_save_track+0x20/0x40 [ 7.066565] kasan_save_free_info+0x4c/0x80 [ 7.070751] __kasan_slab_free+0x6c/0xa0 [ 7.074675] kfree+0x10c/0x380 [ 7.077727] framebuffer_release+0x5c/0x90 [ 7.081826] simplefb_destroy+0x1b4/0x2c0 [ 7.085837] put_fb_info+0x98/0x100 [ 7.089326] unregister_framebuffer+0x178/0x320 [ 7.093861] simplefb_remove+0x3c/0x60 [ 7.097611] platform_remove+0x60/0x98 [ 7.101361] device_remove+0xb8/0x160 [ 7.105024] device_release_driver_internal+0x2fc/0x470 [ 7.110256] device_release_driver+0x20/0x38 [ 7.114529] bus_remove_device+0x1b0/0x380 [ 7.118628] device_del+0x314/0x820 [ 7.122116] platform_device_del+0x3c/0x1e8 [ 7.126302] platform_device_unregister+0x20/0x50 [ 7.131012] aperture_detach_platform_device+0x1c/0x30 [ 7.136157] aperture_detach_devices+0x16c/0x290 [ 7.140779] aperture_remove_conflicting_devices+0x34/0x50 ... The Linux kernel CVE team has assigned CVE-2025-40037 to this issue. Affected and fixed versions =========================== Issue introduced in 6.8 with commit 92a511a568e44cf11681a2223cae4d576a1a515d and fixed in 6.12.53 with commit b1deb39cfd614fb2f278b71011692a8dbf0f05ba Issue introduced in 6.8 with commit 92a511a568e44cf11681a2223cae4d576a1a515d and fixed in 6.17.3 with commit b6ff0d8de8452ec0e18e5bd7394c2a23e7ff7353 Issue introduced in 6.8 with commit 92a511a568e44cf11681a2223cae4d576a1a515d and fixed in 6.18-rc1 with commit da1bb9135213744e7ec398826c8f2e843de4fb94 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-40037 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/simplefb.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/b1deb39cfd614fb2f278b71011692a8dbf0f05ba https://git.kernel.org/stable/c/b6ff0d8de8452ec0e18e5bd7394c2a23e7ff7353 https://git.kernel.org/stable/c/da1bb9135213744e7ec398826c8f2e843de4fb94