Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 8AD2B3B0ADB for ; Thu, 28 May 2026 09:43:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779961415; cv=none; b=OyKMRYDs3eLIHuQGVkzzTllwF86wIoGhjO1J3u4sZIiy+aOxCRhK3YJzfc83kShGcOgqoxy9WaV1EhX/51EhRZvPLqG0OjApor1mO+Tqxz7jvAAFoO83u0vZ7SbyHKnortHg6J3D71GjbfU88u+g0MTb2kKnF90cdadW1B35wZ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779961415; c=relaxed/simple; bh=Yd2nJvbBifVLi9RnWm24oPcX7s+wgRmDvsHv0Tn+cws=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ohK21m3RVYSpw0Ajf1zqBbzcgN/JceA9KFqy3HXCUTzV/B2O61zhza8ZkDHEi9/TtKu9ir1h8SXse+dii8Y6g/5myBvVUWixVKFqoFS4Z7TWgJzRpKQ5hyq87UDjcK8+NIT9c1UbF13WIS9Ha5MLhyKbZO1SEUQShaTXIObnyg8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fyfQFHt4; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="fyfQFHt4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E70551F000E9; Thu, 28 May 2026 09:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779961414; bh=Y4QUGuC0zalmZYSIejYzjhb/rDgJ8TTM+ccFbvCOvek=; h=From:To:Cc:Subject:Date:Reply-To; b=fyfQFHt49ZUgMH7X53uMtOfnxUQmTFQk8k/CglHKrfGe85NK+Yiex4CTHojYOlJWa Uova/retxa6TSzCHUbSuqQ9RxrBqq/HplaW5PFLB+lI6Q3dD12DGZVXeOtiabqXnSk XkwHZ2Q/RtDq1qpM+PfL7ocekrwFMIj7eVqRt6fk= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-46213: HID: appletb-kbd: fix UAF in inactivity-timer cleanup path Date: Thu, 28 May 2026 11:40:48 +0200 Message-ID: <2026052835-CVE-2026-46213-8b71@gregkh> X-Mailer: git-send-email 2.54.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=4441; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=CCZASavUxmtXcuLv01bX6MkrxepBZE3C+JXSxjzSNJU=; b=owGbwMvMwCRo6H6F97bub03G02pJDFkSvJMPmey9GPVUK5fnuc6HG58fbBbN+C64YeMK+fx1X L8jr1od7YhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJBEczzHe3PF6+7bjJ+gsX Das3+LgtehkZt4Rhwa7o9x4KP+Wtz53WW8+8OdSxx3XNMwA= 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: HID: appletb-kbd: fix UAF in inactivity-timer cleanup path Commit 38224c472a03 ("HID: appletb-kbd: fix slab use-after-free bug in appletb_kbd_probe") added timer_delete_sync(&kbd->inactivity_timer) to both the probe close_hw error path and appletb_kbd_remove(), but the way it was wired in left the inactivity timer reachable during driver tear-down via two distinct windows. Window A -- put_device() before timer_delete_sync(): put_device(&kbd->backlight_dev->dev); timer_delete_sync(&kbd->inactivity_timer); The inactivity_timer softirq reads kbd->backlight_dev and calls backlight_device_set_brightness() -> mutex_lock(&ops_lock). If a concurrent hid_appletb_bl unbind drops the last devm reference between these two calls, the backlight_device is freed and the mutex_lock() touches freed memory. Window B -- backlight cleanup before hid_hw_stop(): if (kbd->backlight_dev) { timer_delete_sync(...); put_device(...); } hid_hw_close(hdev); hid_hw_stop(hdev); Even after Window A is closed, hid_hw_close()/hid_hw_stop() still run afterwards, so a late ".event" callback from the HID core (USB URB completion on real Apple hardware) can arrive after timer_delete_sync() drained the softirq but before put_device() drops the reference. That callback reaches reset_inactivity_timer(), which calls mod_timer() and re-arms the timer. The freshly re-armed timer can then fire on the about-to-be-freed backlight_device. Both windows produce the same KASAN slab-use-after-free: BUG: KASAN: slab-use-after-free in __mutex_lock+0x1aab/0x21c0 Read of size 8 at addr ffff88803ee9a108 by task swapper/0/0 Call Trace: __mutex_lock backlight_device_set_brightness appletb_inactivity_timer call_timer_fn run_timer_softirq handle_softirqs Allocated by task N: devm_backlight_device_register appletb_bl_probe Freed by task M: (concurrent hid_appletb_bl unbind path) Close both windows at once by reworking the tear-down in appletb_kbd_remove() and in the probe close_hw error path so that 1) hid_hw_close()/hid_hw_stop() run before the backlight cleanup, guaranteeing no further .event callback can fire and re-arm the timer, and 2) inside the "if (kbd->backlight_dev)" block, timer_delete_sync() runs before put_device(), so the softirq is drained before the final reference is dropped. The Linux kernel CVE team has assigned CVE-2026-46213 to this issue. Affected and fixed versions =========================== Issue introduced in 6.16 with commit 38224c472a038fa9ccd4085511dd9f3d6119dbf9 and fixed in 6.18.32 with commit 59a79938ca5541fe55d675304116b7ea684afef0 Issue introduced in 6.16 with commit 38224c472a038fa9ccd4085511dd9f3d6119dbf9 and fixed in 7.0.9 with commit 93d989e47bc316c793a69c6a332e053c90e29f02 Issue introduced in 6.16 with commit 38224c472a038fa9ccd4085511dd9f3d6119dbf9 and fixed in 7.1-rc4 with commit 4db2af929279c799b5653a39eb0795c72baffca4 Issue introduced in 6.15.6 with commit 51720dee3a61ebace36c3dcdd0b4a488e0970f29 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-46213 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/hid/hid-appletb-kbd.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/59a79938ca5541fe55d675304116b7ea684afef0 https://git.kernel.org/stable/c/93d989e47bc316c793a69c6a332e053c90e29f02 https://git.kernel.org/stable/c/4db2af929279c799b5653a39eb0795c72baffca4